aspose file tools*
The moose likes Struts and the fly likes How to load JSP dynamically using mapping.findForward() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to load JSP dynamically using mapping.findForward()" Watch "How to load JSP dynamically using mapping.findForward()" New topic
Author

How to load JSP dynamically using mapping.findForward()

Shailesh Gupta
Greenhorn

Joined: May 05, 2006
Posts: 7
Hello Guys,

I wanted to know that whats the way of redirecting the control to any JSP page using ''mapping.findForward("success")'' statement and ensuring that when the JSP page to which control is passed gets loaded with latest data again.

basically whats happening now is that when JSP page is displayed it is displaying me the old data. but i want to ensure that when this JSP is displayed it should be loaded again completely. Does any one can tell me how we can do that.

Thanks.


Never Say Never
Pras Tiwari
Ranch Hand

Joined: Nov 07, 2005
Posts: 186
Hi,

You might be using Scope="Session" for that action . Try scope="request".
This might solve your problem.

Regards,
Prash


********Deserve Before You Desire********
Shailesh Gupta
Greenhorn

Joined: May 05, 2006
Posts: 7
hi there,

thanks for the answer. but i havent tried it yet as i already found a way without using the suggestion u made. all i did was to call the method which would load the latest data into session before redirecting control to a JSP.

But now I have another problem. The above mentioned problem having being solved at my PC(which is the server) is coming up when I try to run the apication from some other PC. At client side old JSP page gets loaded despite the fact that session contains latest data. I am bemused by this behaviour.

Can any one throw some light on the reason why a browser might load the old page at some instance and on some other loads the new page.

thanks and regards,
shailesh
sai prasanna
Ranch Hand

Joined: May 02, 2005
Posts: 167
I think this is because the jsp page is been cached by the browser.
so set HTTP header attributes at the begining of Jsp page for both HTTP version 1.0 and 1.1

<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
Shailesh Gupta
Greenhorn

Joined: May 05, 2006
Posts: 7
The problem got solved after i added the following code at top of my every JSP page for which I dont want caching to be performed by the client.

<%
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setDateHeader("Expires", 0); //prevents caching at the proxy server
response.setHeader("Cache-Control", "private"); // HTTP 1.1
response.setHeader("Cache-Control", "no-store"); // HTTP 1.1
response.setHeader("Cache-Control", "max-stale=0"); // HTTP 1.1
%>

Now the problem is solved.
Thanks & Regards,
Shail
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to load JSP dynamically using mapping.findForward()