Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to know if has validation errors on jsp

 
Moli molina
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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!

 
Pallav Bora
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • 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
 
Moli molina
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply.

Solved..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic