File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSLT EL display session attribute

 
vijaya bacina
Ranch Hand
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a list of names in session. I want to diplay them on jsp using JSTL EL.
in servlet i place the list in session.
and in jsp i did the following

I am getting an error message like this
java.lang.IllegalStateException: jsp.error.page.noSession
Any ideas what is wrong with the code.
How to access the session attribute using JSTLEL
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure why you are getting that particular message, but your code should be:

 
vijaya bacina
Ranch Hand
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mine is working if i use scriptlet to get attribute value from session like this

and i am accessing this messages variable in forEach. it is working fine now. but i am not sure why i get that illegastateexception message when i try to use sessionScope!
Is there a way to replace the above scriptlet with EL
[ June 08, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not need the scriplet. Does my version work for you? Do you get the exception on any reference to a session-scoped variable?
 
vijaya bacina
Ranch Hand
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i tried placing ${not empty but i am getting the error message
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That error means:

jsp.error.page.noSession=Cannot access session scope in page that does not participate
in any session

For some reason, your page has no session. You need to figure out why. What declarations do you make for the page?
 
vijaya bacina
Ranch Hand
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the jsp actually consists of two frames. each frame is a result of new request. is this the reason? but session should be available to jsps even if it is new request. right?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, are you sure that you are not using a declaration to remove one of the JSPs from the session?
 
vijaya bacina
Ranch Hand
Posts: 155
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The jsp is still in session. otherwise even this statement should not work.
 
Grace Phone
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with this because I faced similar problem because there was session=false directive declared in common page used by my page. It gave me headache over hours. Then I awared of the stack trace telling me no session in this page. When I enable it session=true and everything works well.

It might work well if you use like this. But when using sessionScope, it gonna give you session not found error.

Thanks to this link http://stackoverflow.com/questions/4730790/problem-with-session-attributes-in-jsp-el-using-spring-mvc

Cheers !

Bear Bibeault wrote:That error means:

jsp.error.page.noSession=Cannot access session scope in page that does not participate
in any session

For some reason, your page has no session. You need to figure out why. What declarations do you make for the page?
 
aatish pandya
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijaya,

I am having a similar problem,

I am trying to display a sample List using EL from Servlets and Bean File, but the output is blank Browser!

Bean File -



Servlet


JSP File



 
Muhammad Rizwan
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aatish

I am having same problem , the output is blank Browser!.

how did you manage to get around this?

thanks
Muhammad



 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic