<%
@ page contentType
=
"
text/html; charset=UTF-8
"
%>
<% @ taglib prefix = " s " uri = " /struts-tags " %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
< html >
< head >
< title > Condition Flow </ title >
</ head >
< body >
< h3 > Condition Flow </ h3 >
<!--
这里有点小技巧:
本来可以用#parameters.name[0]来获得,请求中name的值。但是,在我实现include例子时,
无论我用param标志给name赋任何值,#parameters里面不会含有任何值,所以#parameters.name也为空值。
其原因为:
当使用include标志时,被包含的页面(included)里#parameters拿到的是包含页面里的请求参数。
因此,这里必须手工调用request.getParameter("name")。
-->
< s:set name ="name" value ="<%= " '" + request.getParameter("name") + "'" % > " />
< s:if test ="#name == 'Max'" >
Max's file here
</ s:if >
< s:elseif test ="#name == 'Scott'" >
Scott's file here
</ s:elseif >
< s:else >
Other's file here
</ s:else >
</ body >
</ html >
<% @ taglib prefix = " s " uri = " /struts-tags " %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
< html >
< head >
< title > Condition Flow </ title >
</ head >
< body >
< h3 > Condition Flow </ h3 >
<!--
这里有点小技巧:
本来可以用#parameters.name[0]来获得,请求中name的值。但是,在我实现include例子时,
无论我用param标志给name赋任何值,#parameters里面不会含有任何值,所以#parameters.name也为空值。
其原因为:
当使用include标志时,被包含的页面(included)里#parameters拿到的是包含页面里的请求参数。
因此,这里必须手工调用request.getParameter("name")。
-->
< s:set name ="name" value ="<%= " '" + request.getParameter("name") + "'" % > " />
< s:if test ="#name == 'Max'" >
Max's file here
</ s:if >
< s:elseif test ="#name == 'Scott'" >
Scott's file here
</ s:elseif >
< s:else >
Other's file here
</ s:else >
</ body >
</ html >