• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

session object

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi;

Since session object is default true in JSP page, do i need to call

request.getSessiobn(true) to create a session.

I think i can use session directly. Is that right?

<%
session = request.getSession(true); //should be comment out
session.setAttibute("userName", userName);
%>

By the way, i did false session in my directive.

I was told that if i do not call
session = request.getSession(true);

The session will be locally and i can not see the attibute in my next page, is that right?

Thanks

-Maria
 
Maria Tan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi;

Sorry i didn't type correct. Here is my question:


Since session object is default true in JSP page, do i need to call

request.getSessiobn(true) to create a session.

I think i can use session directly. Is that right?

<%
session = request.getSession(true); //should be comment out
session.setAttibute("userName", userName);
%>

By the way, i didn't false session in my directive.

I was told that if i use session hidden in JSP, it will be locally and i can not get the attibute setting in my session in my next page. But if i call

session = request.getSession(true);

The session will be global. Then i can get attribute. Is this true?

Thanks in advance

-Maria
 
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Maria Tan:
Sorry i didn't type correct. Here is my question:

If you make a posting error, you can edit your post by clicking the icon.
 
Ranch Hand
Posts: 72
Scala Monad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you dont need to make a call to request.getSession(true or false) inside JSP since implicit 'session' object is available by default. However 'session' attribute of 'page' directive matters.

<%@ page session="false" %> //no session object

by default, session="true"
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic