2009年5月13日星期三

struts框架 taglib 之logic:present和logic:notPresent

判定指定的http请求,cookie,header,安全角色,用户,javabean是否存在,根据判断结果来控制内容的输出,标签属性分别为:

cookie:指定的cookie是否存在

header:指定的http请求的header是否存在

role:判断当前通过权限的用户是否具有指定的安全角色.多个安全角色之间以逗号隔开

user:判断当前通过权限验证的用户是否拥有指定用户名

parameter:判断指定的请求参数(相当于getParameter==null)是否存在

name:判断指定的javaBean(属性,attribute)是否存在

scope:设置http请求范围,貌似只能是request或session(??未确定),设为session的时候,包括session,request范围的JavaBean,缺省下好像是session的

proerty:同时设置name与property,判定该名称的JavaBean的property指定的属性是否存在,并且是否为null

例如代码:

<%
request.setAttribute("nothing","nothing");
%>

forever love;


notPresent:标签例如:


String...................................................................................



Header判断:


Yep,we got a user-agent header.

没有评论: