关于 jsp tags 的问题

coolsunwind 2005-10-26 02:18:02
在 doStartTag()的方法中。
RequestUtils.lookup(pageContext, getName(), getScope());的返回值是null。
请问原因是什么,如何解决!
...全文
83 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
coolsunwind 2005-10-26
  • 打赏
  • 举报
回复
jsp 的代码是

<%@ taglib uri="/WEB-INF/tlds/jamp2-authority.tld" prefix="jamp2authority" %>


<jamp2authority:authorityTrueThen action="MNUMHC" name="authority" scope="request">
<SPAN CLASS="MENU_LINK"><A href="manhourMenuDisplay.do" onclick="return CheckSubmit();">管理</A></SPAN>
</jamp2authority:authorityTrueThen>
<------------------------------------------->
tld文件的代码是:

<tag>
<name>authorityTrueThen</name>
<tagclass>jamp2.web.taglib.authority.AuthorityTrueThenTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>action</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

<-------------------------------------------------------->

AuthorityTrueThenTag类的代码是

public int doStartTag() throws JspException{
TreeMap authState = new TreeMap();
try{

authState = (TreeMap)RequestUtils.lookup(pageContext, getName(), getScope()); //这个为空!!
Object state = authState.get(getAction());


if(state == null){
return (SKIP_BODY);
}
} catch(Exception e){
ResponseUtils.write(pageContext, e.getMessage());
}
return (EVAL_PAGE);
}
coolsunwind 2005-10-26
  • 打赏
  • 举报
回复
AuthorityTrueThenTag
TreeMap authState = new TreeMap();
try{
authState = (TreeMap)RequestUtils.lookup(pageContext, getName(), getScope());
Object state state = authState.get(getAction());

if(state == null){
return (SKIP_BODY);
}
} catch(Exception e){
ResponseUtils.write(pageContext, e.getMessage());
}
return (EVAL_PAGE);


jsp

<jamp2authority:authorityTrueThen action="MNUMHC" name="authority" scope="request">
<SPAN CLASS="MENU_LINK"><A href="manhourMenuDisplay.do" onclick="return CheckSubmit();">管理</A></SPAN>
</jamp2authority:authorityTrueThen>
<jamp2authority:authorityFalseThen action="MNUMHC" name="authority" scope="request">
管理
</jamp2authority:authorityFalseThen>


liwei_0223 2005-10-26
  • 打赏
  • 举报
回复
贴源代码,你这问的云山雾罩的,谁知道怎么回答!

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧