Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

<s:if> in Struts2

red phoenix

2006-12-18


I put a String into a session,and I use <s:if> to determine the session if
it is exist,if exist,show OK,if not exist,it shows error,but when I run
it,it shows error,I don't know why don't show OK? How to correct to show OK?
my code is follows:
<%@(protected)" %>
<%@(protected)" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<%
request.setAttribute("tt",new String("1"));
%>
<body>
<s:if test="Session.tt?exists">
OK
</s:if>
<s:else>
Error
</s:else>
</body>
</html>
©2008 junlu.com - Jax Systems, LLC, U.S.A.