PDA

View Full Version : Returning Server Side errors on the same JSP



agrharsh
Sep 15th, 2005, 06:03 AM
Hi All,

I have created a Login jsp & LoginController which validates the user-id/password combination. Now what I want is that in case user-id/password do not match, user should be thrown an error on the same Login page. Here is what I have done to achive this:

Controller Code

return new ModelAndView(new RedirectView(getFailureView()), "errorLogin", "Invalid Login. Please try again.");

where in app-servlet.xml faliure view is defined like this:

<bean id="loginForm" class="com.etax.admin.login.controller.LoginController">
...
<property name="failureView"><value>login.htm</value></property>
...
</bean>

and URLMapping,
<prop key="/login.htm">loginForm</prop>


JSP Code:
<tr>
<td colspan=2>
<c:out value="${errorLogin}"/>
</td>
</tr>


I would deeply apreciate your inputs.

Thanks!!!

Colin Yates
Sep 15th, 2005, 06:18 AM
You really need to read the reference manual :) http://static.springframework.org/spring/docs/1.1.5/reference/index.html

agrharsh
Sep 15th, 2005, 06:28 AM
Yes, I agree I should hav but havent read the manual. The schedule I was working against didnt allowed me to :(

I would be greateful if you could point me to the specific section please.

Colin Yates
Sep 15th, 2005, 06:44 AM
At the very least you should read chapter 12, the MVC stuff :) Don't feel I was saying "don't come back until you read it", I wasn't.

I was merely indicating that the reference manual does a much better job of explaining stuff that I could do ;)