File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes how to know if has validation errors on jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to know if has validation errors on jsp" Watch "how to know if has validation errors on jsp" New topic
Author

how to know if has validation errors on jsp

Moli molina
Greenhorn

Joined: Apr 07, 2010
Posts: 19
Anybody know how to obtenin at JSP level, if has validation errors?

there anything like:




I need to create a javascript function to load some input when validation fails...

Many thanks!

Pallav Bora
Ranch Hand

Joined: Oct 13, 2009
Posts: 73
Just from the top of my head, if you define a different page/tile for result type INPUT (validation error) then you can put your javascript there.

For example :

<action name="getX_1" method="getX" class="com.x.X">
<result type="tiles" name="success">getX_1_page</result>
</action>



<action name="getX_2" method="getX_2" class="com.x.X">
<result type="tiles" name="success">getX_2</result>
<result type="tiles" name="input" >getX_1_page_error</result>
</action>

Now the JSP referered to by getX_1_page_error can have the Javascript. You will not need to check for error because you go to that page only when you have error.

getX_1_page and getX_1_page_error are same except for the fact that getX_1_page_error has Javascript to deal with the errors.

Hope this helps
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://struts.apache.org/2.1.8/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html
Moli molina
Greenhorn

Joined: Apr 07, 2010
Posts: 19
thanks for your reply.

Solved..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to know if has validation errors on jsp
 
Similar Threads
Problems with diaplayTag
fow to forward to an action from jsp ?
Struts Jsp Restrictions
Accessing action errors in JSP
Struts2: Compare request parameter not working