• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Action class error problem

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi experts,
I want to show my action class error message in a jsp page via java script alert confirm(); box.
Please help me to solve this.
Many thanks in advance.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"martin luther",
Please check your private messages.
-Ben
 
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, one way can be that after you get the error message in action. Dump it in a hidden string property on the jsp ( getter and setter for the property will be in form bean).
Then, on page load i.e. in the body tag there is a "onload" event. You can write a javascript method that will be called on load of your corrsponding jsp. the javascript function will access the hidden property.

e.g.

Suppose hidden tag is :

Then on body tag


The javascript function can be something like :
 
Ramanuj Kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Anubhav,
Thanks for your reply.but after implementing like this i always getting error message when ever i load the page.
But what i actually want is.once i save the page data will goes to server and check whether that name is present already or not.if yes then only it will show me error.
here is my code.

here i am getting error but my requirement is after showing the message user can save too.so i need confirm(); java script dailog box.
can you tell me how i can show the action class message in my jsp page through java script code.
 
reply
    Bookmark Topic Watch Topic
  • New Topic