It's not a secret anymore!*
The moose likes Struts and the fly likes Selective Validation... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Selective Validation..." Watch "Selective Validation..." New topic
Author

Selective Validation...

Ajay J Rao
Greenhorn

Joined: Aug 06, 2008
Posts: 1
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Selective Validation...