aspose file tools*
The moose likes Struts and the fly likes Checking page sessions 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 » Struts
Bookmark "Checking page sessions" Watch "Checking page sessions" New topic
Author

Checking page sessions

shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Hi Guys

I am trying to setup a session checker for my password protected page. Its not going too well. When I run it on firefox the page keeps reloading the content over and over, in IE7 it prints out the login page and the password protected page. Can some take a look at my code and tell me where I going wrong:

checkLogin.jsp:


Password protected page:
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm opposed to putting this sort of logic on the view side.

That said, your second <s:if...> tag's conditional is incorrect, it should be "==", not "=", which is assignment (at least I think it is under OGNL).

Also note that a single character in single quotes in OGNL will be treated as a Java character, *not* as a String--that *may* be what you intended, but I'm skeptical. I'd also recommend using an actual boolean value rather than a number, represented as a string.

I'm also not sure you want forwards there--wouldn't you want to use an include?
shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Neither am I but I couldnt find any other way to do it in an action. I might actaully move over to one but how would I link it to the password page (i.e. the class is run everytime the page is loaded) ? Would an include suffice ?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Personally I'd put this kind of application-wide functionality in an interceptor, but I suppose you could put it in a base action class.
shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Well I have looked into the interceptor and it looks good, I might use that instead, but I am still confused as to how I will link it to the JSP file. Its easy for an action because you can specify it in the struts file but I cant think of any way to invoke it for a JSP page (in the struts.xml file).


.
[ December 24, 2008: Message edited by: shaf maff ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checking page sessions
 
Similar Threads
set the strut tag
Problem in running struts application
how to populate a list in a another select tag using a select tag using struts 2 & DOJO (ajax)
unable to exceute logout program
Struts 2 - If test of parameter value