Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in accessing Session parameter inside s if

 
suresh midde
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am facing a problem in accessing the session attribute in my jsp page.

<%

String role = (String)session.getAttribute("currentRole");
out.println(role);
%>

currentRole contain string values 1 set in session

<s:if test='session.getAttribute("currentRole")=="1"'>
<jsp:include page="superadminmenu.jsp"></jsp:include>
</s:if>

trying the above condition is not working .


Also searching through some forums, tried to set this session value in s:set like
<s:set name="technologyName" value='(String)session.getAttribute("currentRole")'/>

Unable to get the <s:property value="%{#technologyName}" /> when i tried to print.

And by the way, when is the symbols %{#} , %{} and # used.

Regards
Suresh Midde

 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi suresh,
try

same as

take a look at the link below
http://struts.apache.org/2.x/docs/accessing-application-session-request-objects.html

 
suresh midde
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Debraj,

Thanks , it is working
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic