各位大大 我线承认自己是菜鸟
下面说正事
我在一个Action里面 arg2.setAttribute("errorinfo",p);
我想在JSP里面判断 errorinfo 是否存在
是用 present 标签吗
里面有急个属性 cookie header pramater name property scope role user
我试了都不行
不知道用什么了
谁给解释下
谢谢
下面说正事
我在一个Action里面 arg2.setAttribute("errorinfo",p);
我想在JSP里面判断 errorinfo 是否存在
是用 present 标签吗
里面有急个属性 cookie header pramater name property scope role user
我试了都不行
不知道用什么了
谁给解释下
谢谢
在jsp中<%String info=request.getAttribute("errorinfo")%>
然后判断info是否为空应该就行。
但是我们现在在学strucs
所以想用标签实现
不过你要支持EL表达式
<bean:present name="errorinfo">
<bean:write name="errorinfo"/>
</bean:present>一般都这样写的...
<c:when test="${not empty requestScope.errorinfo}">
存在
</c:when>
<c:otherwise>不存在</c:otherwise>
</c:choose>如果你要用struts自带的标签库也行,肯定有相应的,不管是1还是2
errorinfo = request.getAttribute("errorinfo");//说明存在,进行赋值
}else{
errorinfo = null;//不存在,置空
}
no data
</c:if><c:if test="${not empty errorinfo}">
<c:foreach items="${errorinfo}" var="err">
${err.name}
...
</c:foreach>
</c:if>