You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by red phoenix <ro...@gmail.com> on 2006/12/19 02:30:14 UTC

in Struts2

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:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!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>