• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

how to know if has validation errors on jsp

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://struts.apache.org/2.1.8/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html
 
Moli molina
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply.

Solved..
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic