Solved

Problem with jsp page

Posted on 2009-06-28
3
207 Views
Last Modified: 2013-11-24
Is there a way to invoke the validator and show the errors on the jsp page using spring bind errors tag ?.

I have multiple buttons on my form and i am getting the button value through JS. When the form is first load i am showing a text box and search button. So if the search is successfull then i am showing the rest of the form fields and have a Submit button. Now when a person clicks on Submit i would like to see if he has filled out all the form fields. If not then i would like to show the spring bind errors on the jsp page.

If i do this :-
<property name="validator" ref bean ="formValidator"/>
then the form does not work as it tries to validate all of the form fields. In my case i have those hidden and could be shown once the search is succesfful. Any input would be really helpful.
0
Comment
Question by:Micheal_Male
  • 2
3 Comments
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 24737613
in your validator check if the button clicked was "search" if it was then just pass the validator..

0
 

Author Comment

by:Micheal_Male
ID: 24741746
Kuldeep unfortunately it is still the same problem. Actually i can see my validator gets invoked but instead of showing the message on the field it just reset the whole form and what i see is the first text field with the search button.

<c:if test = "${valid > 0}" >
then show the rest of the fields.
</c:if>

0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 500 total points
ID: 24743032
your validator will get invoked. What I meant was INSIDE your validator class check if the search button was clicked ( you can do that by adding the button in your form bean).
i.e. in your validator
if(!object.getCommand().equals("search")){do the validations)
.  ( I have assumed that the button id is "command")

It should make it work ( i.e. it will call the validator but your validater will pass without checking if the button was "search").
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unexpected HttpURLConnection connection behavior 2 86
advertisement module in core php 4 147
Image decoding from Camera 3 72
hibernate jars 4 4
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now