File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Problem clearing previous data in jSP(Struts app) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem clearing previous data in jSP(Struts app)" Watch "Problem clearing previous data in jSP(Struts app)" New topic
Author

Problem clearing previous data in jSP(Struts app)

sumita mukherjee
Greenhorn

Joined: Aug 27, 2007
Posts: 22
Hi,

I have 2 jsp pages in my Struts application. Each shows data according to the some forward from the actionClass. But sometimes, if the data is shown in A.jsp, the data in B.jsp does not get cleared up, which is from the previous condition.
session.invalidate() does not work, because it clears the data of that page anyways. I want to control whether or not i want to refresh the page in the other jsp. So may be I can set some parameter in the actionclasses which controls wheher the particular jsps are to be cleared of any prev data.
I hope I have explained myself clearly.

Can anybody please help me?

Thanks & regards,
~S
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Can you put the action mapping that you are referring to?
Shane W
Ranch Hand

Joined: Aug 31, 2007
Posts: 30
Are you using form beans?If yes,did you add reset method to it?
sumita mukherjee
Greenhorn

Joined: Aug 27, 2007
Posts: 22
Previously I was using form beans and had a reset method. But now I am putting simple string data in the jsp page which I set in an action with a session variable. This is because there were some problem showing transformed XML to HTML data with bean. So there is no reset method(I was facing this prob even when i was using a bean and the reset methods).

Anyways, so the problem is that the individual jsps are not getting refreshed as it is the other jsp that is showing the data and this once does not know about it. There has to be some mechanism in jsp which polls a particular vaiable at regular intervals, and whenever the variable is set to true the page should refreshed.
That variable might be set in the action class.

I know tsi is possible but cannot put it into action. I even tried with javascript, but got stuck.

~S
Shane W
Ranch Hand

Joined: Aug 31, 2007
Posts: 30
Hi
Let me put to words what i understand from your problem statement:
You set some attributes in the request/session object which you retrieve and display on the JSP.Now you say that the page is already loaded(ie, values last set before loading the page are displayed) and then in the Action, you again set some other values to the same attributes and you want the already loaded JSP to display these values, is it right? If so, you do need a polling mechanism to show it(think in lines of Ajax).But I find it difficult to understand how you expect it to show the values without reloading the page(or part of it).Will keep you informed if I come across something that may help.Confirm if I have understood your problem properly.

Apple Man
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem clearing previous data in jSP(Struts app)