<%@ page language= "java " %>
<%@ taglib uri= "/WEB-INF/struts-bean.tld " prefix= "bean " %>
<%@ taglib uri= "/WEB-INF/struts-html.tld " prefix= "html " %>
<%@ taglib uri= "/WEB-INF/struts-logic.tld " prefix= "logic " %>
<%@ taglib uri= "/WEB-INF/struts-nested.tld " prefix= "nested " %>
<html>
<head>
<title> Employee List </title>
</head>
<body>
<%
String name= "chen ";
request.setAttribute( "myName ",name);
%>
<logic:notPresent name= "myName " scope= "request ">
aaaaaaaaaa
</logic:notPresent>
<logic:present name= "myName " scope= "request ">
bbbbbbbbbbb
</logic:present>
</body>
</html>
为什么输出页面时, aaaaaaaaaaaaaaaa和bbbbbb都有输出,还有,用其它的Struts标签时,好像都没有效果。为什么呢?
------解决方案--------------------
你的这些tld文件路径不对吧~
<%@ taglib uri= "/WEB-INF/struts-bean.tld " prefix= "bean " %>
<%@ taglib uri= "/WEB-INF/struts-html.tld " prefix= "html " %>
<%@ taglib uri= "/WEB-INF/struts-logic.tld " prefix= "logic " %>
<%@ taglib uri= "/WEB-INF/struts-nested.tld " prefix= "nested " %>
你的原代码我执行都是正常的~
是你的tld没起到作用,可能你的tld路径不对吧