• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Multiple windows - clearing html:errors on parent window

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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......
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

[ June 08, 2006: Message edited by: Merrill Higginson ]
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic