This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Selective Validation...

 
Ajay J Rao
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application, I login and go to a main screen. Now I copy the URL and log out. When I paste the URL back again on the screen, I am getting the Login screen again, but with message "User name is required".

I just want the login screen w/o the message on the screen. How do I do this?

The code is something like this.

Struts-Config.xml
********
<action path="/validateUser"
type="com.action.login.LoginAction" name="LoginForm"
scope="request" validate="true" input="loginHome"
parameter="method">
<exception
handler="com.handler.CustomExceptionHandler"
key="error.application.exception" path="loginException"
scope="request"
type="com.exception.ApplicationException" />
<exception key="error.general.exception"
type="java.lang.throwable"
handler="com.handler.CustomExceptionHandler"
path="exception" />
<forward name="success" path="/getProjects.do?method=getProjectList" />
</action>
************
Validation.xml
<form name="LoginForm">
<field property="userName" depends="required">
<arg0 key="error.login.username.required" />
</field>
<field property="password" depends="required">
<arg0 key="error.login.password.required" />
</field>
</form>

The URL is like
http://localhost:8080/LoginLogoutTest/validateUser.do?method=login
[ August 06, 2008: Message edited by: Ajay J Rao ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest that you specify redirect="true" on the forward. If you do so, the URI that the user sees after logging in will be:

http://localhost:8080/LoginLogoutTest/getProjects.do?method=getProjectList

Naturally there must be some mechanism either in each action or in a filter to verify whether a user is currently logged in or not and if not to redirect to the login page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic