aspose file tools*
The moose likes JSP and the fly likes JSTL Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL Help" Watch "JSTL Help" New topic
Author

JSTL Help

Ravi Kumar
Greenhorn

Joined: Sep 07, 2005
Posts: 24
Hello All,

I need some help with JSTL tags. One with retreiving values from request object and other with storing the values into session so that I can access the value from another page.

I trying to replace scriptlet code with JSTL tags.
Here is my working scriplet code.






I am trying to access the hello variable from other page.
by using


Could anyone provide with some direction.
I am using core tags to do the if else logic.
here is my JSTL Code.

And trying to access the variable value in another page by



I am getting error message saying that session has no value.
Please let me know what is wrong with the above code.

[ February 12, 2007: Message edited by: Kris10 ]
[ February 13, 2007: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

"Kris10", you have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ravi Kumar
Greenhorn

Joined: Sep 07, 2005
Posts: 24
Hello All,

I got most of the part working. However I have one question

1. Is there anyway to see that the session values do not expire.

Using scriplets I was doing
session.setMaxInactiveInterval(-1);

How do I set this??

[ February 12, 2007: Message edited by: Ravi Kumar ]
[ February 12, 2007: Message edited by: Ravi Kumar ]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Ravi Kumar:
Is there anyway to see that the session values do not expire.


Session values never get expired. Session itself get expired.
Ravi Kumar
Greenhorn

Joined: Sep 07, 2005
Posts: 24
Thanks Adeel Yes I meant the session. Is there anyway to see that the session doesn't expire. Any alternative approach to this.
[ February 13, 2007: Message edited by: Ravi Kumar ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

Preventing the session from expiring would not be the best of ideas. Why would you want sessions not to ever expire?
Ravi Kumar
Greenhorn

Joined: Sep 07, 2005
Posts: 24
I am storing values into session. When the session expires, a new session is created. I don't want to loose the value in session. That's the reason I am trying to set my session not to expire.

My Issue is resolved.I used the same scriplet code to set the session not to expire.

However if there is any way I could do using JSTL I would like to know.

Thanks
[ February 13, 2007: Message edited by: Ravi Kumar ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

Give a man a gun and he's liable to shoot himself in the foot.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Ravi Kumar:
However if there is any way I could do using JSTL I would like to know.


Use your existing JSTL code after removing the conditions. Then you will get to know that the problem was there in your condition.

I shouldn't be that much sure about it. Anyways lets see..
Hunny Lee
Greenhorn

Joined: Feb 17, 2007
Posts: 23
Originally posted by Kris10:
...
I am using core tags to do the if else logic.
here is my JSTL Code.

...


the bold line above should be:
<c:when test="${param.username eq 'Customer'}">

About the session-timeout though, I'm sure you wouldn't want your sessions to never expire. Would you (or your clients) want to retrieve a session that was created years ago (If session id is still saved in the URL or cookie)? You also wouldn't want to burden your server with stale sessions.

Anyway, to answer your question, I don't think there's a JSTL for that. You can move your session time-out settings in the deployment descriptor, though.
[ February 17, 2007: Message edited by: Hunny Growl ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JSTL Help