Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to display validation error messages in JSP

 
Vivek Kr Agrawal
Ranch Hand
Posts: 51
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to do a server side validation and then trying to pass the error message in the same jsp.
The flow will be like index.jsp to servlet(validation) and then to same index.jsp with error message.
Right now I am using this code.


Now I just want to display this label during runtime by jsp coding.

Thanks in advance!!
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vivek,

You can add the error messages from servlet in the request object and send them back to jsp and display the error messages.
Regards
Jatan
 
Vivek Kr Agrawal
Ranch Hand
Posts: 51
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jatan,
Thanks for answering. Now I am able to set error messages through request setAttribute method.But can there be a solution through which one can access id of an element via jsp?

Again thanks for giving your valuble time and suggestion.

With Regards,
Vivek
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What you are going to achieve by doing this?


Regards
Jatan
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
id values are for use on the client by JavaScript.
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

No only values are submitted in the request and you can get those values from request object doing request.getparameter().
id is to identify the control in javascript.

Regards
Jatan
 
Vivek Kr Agrawal
Ranch Hand
Posts: 51
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic