aspose file tools*
The moose likes Struts and the fly likes Action class error problem 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 "Action class error problem" Watch "Action class error problem" New topic
Author

Action class error problem

Ramanuj Kumar
Greenhorn

Joined: Feb 22, 2008
Posts: 18
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.


With Regards,<br />Rama
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"martin luther",
Please check your private messages.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Anubhav Anand
Ranch Hand

Joined: May 18, 2007
Posts: 341

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

Joined: Feb 22, 2008
Posts: 18
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action class error problem