File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Selective Validation...

Ajay J Rao

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.

<action path="/validateUser"
type="com.action.login.LoginAction" name="LoginForm"
scope="request" validate="true" input="loginHome"
key="error.application.exception" path="loginException"
type="com.exception.ApplicationException" />
<exception key="error.general.exception"
path="exception" />
<forward name="success" path="/" />
<form name="LoginForm">
<field property="userName" depends="required">
<arg0 key="error.login.username.required" />
<field property="password" depends="required">
<arg0 key="error.login.password.required" />

The URL is like
[ 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:


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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Selective Validation...
It's not a secret anymore!