Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action class error problem

 
Ramanuj Kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Anubhav Anand
Ranch Hand
Posts: 341
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic