wood burning stoves 2.0*
The moose likes Struts and the fly likes Problem refreshing page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem refreshing page" Watch "Problem refreshing page" New topic
Author

Problem refreshing page

Rashmini Palakurti
Greenhorn

Joined: Jun 29, 2005
Posts: 13
hi!
I have a problem in refreshing a page when an application exception is thrown. I have a jsp where in if user enters a year and month and presses submit button then a pdf report is generated and acrobat reader open dialog box pops-up, but if data doesnt exists for that year and month then an application exception thrown and is shown in same jsp.

Scenario: If user enters year and month for which data doesnt exists then application exception is shown in the page correctly , but after that if he gives valid input then pdf is generated but this jsp is not refreshed as a result the error for previous input is not wiped out... this is happening because when there is no error , i am returning success in my action and for success i have a forward action in my struts-config which opens pdf in a new jsp and it doesnt return this jsp and this jsp is not reloaded. can anyone give me a solution where in for the same forward parameter i can refresh this input jsp as well as open pdf in another jsp.
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

That's a tough one.

I think I would actually avoid solving this and make the error message include the incorrect month and day in its display.


A good workman is known by his tools.
Rashmini Palakurti
Greenhorn

Joined: Jun 29, 2005
Posts: 13
hi!

I think u have not correctly understood my difficulty.My problem is not with displaying the error Message , but to wipe out when the correct month is given(that is refreshing this page) which is not possible now bcoz action is redirected to open pdf rather than this page...
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

I understood your problem. I just don't think there is an elegant way to solve it. You'd have to do something tricky with javascript or redirects. For instance, make the error text non-displayable when the submit button gets clicked.

Explanation for my previous post:
You want this solution because you do not want to confuse the user with an error on a successful submission. My point was that it would be much easier to avoid the confusion by being very specific in the error message so that the user can compare the error's month/day to what they entered and see that the error was from a previous submission.
Rashmini Palakurti
Greenhorn

Joined: Jun 29, 2005
Posts: 13
Thanx Marc..
What i thought was to redirect to same jsp when submit is clicked and check
the action path or set some flag which tells submit was successful and then forward it to JSP which will open PDF.

If u have any other better idea then plz do post it.
 
Consider Paul's rocket mass heater.
 
subject: Problem refreshing page