aspose file tools*
The moose likes Struts and the fly likes Problem in accessing Session parameter inside s if Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in accessing Session parameter inside s if" Watch "Problem in accessing Session parameter inside s if" New topic
Author

Problem in accessing Session parameter inside s if

suresh midde
Greenhorn

Joined: Aug 22, 2008
Posts: 25
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

Joined: Mar 08, 2011
Posts: 188

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

Joined: Aug 22, 2008
Posts: 25
Hi Debraj,

Thanks , it is working
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in accessing Session parameter inside s if
 
Similar Threads
using scriptelet in s:if
using scriptelet in s:if
problem with display tag
OGNL string manipulation
conditional tags not working - struts2