• 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

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..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic