Abdel Raoof Olakara
Abdel Raoof Olakara

Reputation: 19353

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 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.

Upvotes: 1

Views: 23319

Answers (3)

Zoot
Zoot

Reputation: 2235

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

Upvotes: 2

user216441
user216441

Reputation:

Add this to your clickable element:

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

For example:

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

Upvotes: 1

jerjer
jerjer

Reputation: 8770

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

Upvotes: 3

Related Questions