开发者

Page redirect / refresh using ExtJS

My Web application makes use of Ext JS & Java web technology. Due to the size and complexity of the application, I need to 开发者_如何学Go do a complete refresh of the page (load a different page) when user select some menu from the menu bar. What is the best what to redirect to the required page?

For example, In my main menu, I have two menu Stock & Location. These two menu will take the user to different JSP files (stockmgt.jsp & locmgt.jsp) with new layouts,menu items etc.

One possibility is to use location.href in the button or menu handler. But if I do this, will I retain the session variables, and other parameters?

What are the best practices in doing these kind of redirect or page refresh?

Thanks in advance for the ideas, comment and suggestions.


location.href will do, unless otherwise if they are on different domain.


These three methods will do the job (Source- MediaCollege.com):

<input type="button" value="Reload Page" onClick="window.location.reload()">



<input type="button" value="Reload Page" onClick="history.go(0)">



<input type="button" value="Reload Page" onClick="window.location.href=window.location.href">

If you're just looking for code to stick directly in a script, try:

window.location.reload()

history.go(0)

window.location.href=window.location.href


Add this to your clickable element:

onclick = "location.href='anotherpage.jsp'"

For example:

< img src="blablabla.png" onclick="location.href='anotherpage.jsp'" >

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜