aspose file tools*
The moose likes Struts and the fly likes Multiple windows - clearing html:errors on parent window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple windows - clearing html:errors on parent window" Watch "Multiple windows - clearing html:errors on parent window" New topic
Author

Multiple windows - clearing html:errors on parent window

Jane Shields
Greenhorn

Joined: Jun 06, 2006
Posts: 1
Hi,

I have a JSP report search page which displays error messages for missing mandatory fields using html:errors properties.

If a user gets these errors then performs a successful search, they get an excel results page in a new window with the content type for the page as "application/vnd.ms-excel".


The problem is that the 'parent' report search page still displays the errors. The action class sends it's response to the new window so the original page is not refreshed. I need to display the search criteria on the original page but remove the errors when a user performs a successful search.

I cannot see how to do this.
1. I thought of calling a JavaScript function when the getReport button was pressed to clear the errors. But the html:errors are Struts components so cant be altered on the client side....

2. From the server side, the action class can only send one response which we currently send to the results window. I cannot refresh/rebuild the search page AND forward to the results page.


If I'm missing something obvious, please help......
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can remove the messages with javascript by using the the Document Object Model (DOM). There is a removeChild() method that you can execute from any node. All you have to do is get a reference to the part of the page that is showing the message (table? Unordered list?), find it's immediate parent, and execute the removeChild() method.

Another way to do it would be to hide the message without actually removing it. If you're not familiar with the DOM, here's a link that will get you started:

http://www.javascriptkit.com/javatutors/dom.shtml
[ June 08, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple windows - clearing html:errors on parent window