Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Servlets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2007, 05:07 PM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Tomcat session varibale

Hello all,
   I have created a file of servlet pages that publish those pages on network by Tomcat 6. I have a log in page, programmed by servlet and also another page that activates the application acording to the given parameters by searching webserver. I should use the taken variable on the log in page in another servlet page. I tried to create a session variable and use it inside the other web servlet. However I am unable to suceed... Can you help me as soon as possible..
Best,
ilker

 
Old June 2nd, 2007, 07:53 AM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey I have the same problem ...
I also can not refresh my servlet page with session variables automatically
PLEASE HELP

poRuski ponimayesh ??
 
Old June 4th, 2007, 05:48 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

Can you be more clear in terms of your problem? I couldn't understand the word file of servlet pages?

If you want to use some data across user's session you can use similar block as follows

HttpSession session = request.getSession(true);
session.setAttribute("VALUE1","SOMEVALUE YOU WANT TO USE IN OTHER PAGES/SERVLETS");

In other servlets/pages you can use the following block to get the values

HttpSession session = request.getSession(false);
Object val = session.getAttribte("VALUE1");

You have to add the first block in the login servlet and you can use the second block where ever you want that value.

Hope i am helpful.

Regards,
Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat - Creates New Session for every request IE6 vickyk_in Apache Tomcat 1 March 27th, 2007 10:41 PM
Passing session variables from IIs to Tomcat aman thaper Internet Information Services 0 November 14th, 2006 09:34 AM
JWS Axis Tomcat (posted to Apache Tomcat too) rushman Servlets 0 April 15th, 2005 09:32 AM
Passing a varibale into a query Hudson40 Access VBA 2 February 25th, 2005 08:19 AM
Tomcat, Linux and Session scope. shantawn Apache Tomcat 1 November 14th, 2004 01:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.