This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes I�m new with Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "I�m new with Spring" Watch "I�m new with Spring" New topic
Author

I�m new with Spring

Antonio Li��n
Greenhorn

Joined: Jul 02, 2008
Posts: 4
Hello, I'm using Spring to manage some forms and, until now, when the user introduced an incorrect value for a field (i.e. an invalid user), I sended him to another jsp. Now I won't to send him to the same jsp whith a message saying "you were wrong..." or something like that. I put this code in my SimpleFormController:




I expected that would make this to work correctly, it only redirect to te jsp, but no errors apperars.
How would i make this??
Thanks a lot.
Ramesh Etta
Ranch Hand

Joined: Sep 18, 2007
Posts: 46
create a validator annd inject that to you controller
like
<bean id="yourcontroller" class="YourController" >
<property name="validator" ref="yourValidatorRef" >
..............
</bean>
<bean id="youValidatorRef" class="YourValidatorClass" />

and call <form:errors path="*" />
here form tag is springs form tag.

for more information refer Spring Reference document, on how to create validators
Antonio Li��n
Greenhorn

Joined: Jul 02, 2008
Posts: 4
Thanks for the reply, but i'm not talking about validation. I already have a validator that tests the values looking for empty or whitespaced values, I'm talking about to compare a value with one in the database, and if them are differents, then show the error.





Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I�m new with Spring
 
Similar Threads
Spring problem (SimpleFormController)
Problem with @PathVariable in Spring 3
Spring - passing values by parametrs to Controller
How do I create a basic confirmation page with dynamic content?
reloading the same page with message - spring mvc