日期:2014-05-17  浏览次数:20725 次

Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope 问题
学习的时候,由于自己没在意,碰到了html标签和struts1标签混用出错的情况。

index.jsp
  <body>
    <a href="login2.do">登陆(struts标签)</a><br>
  </body>


struts-config.xml
<action path="/login2"
        forward="/login_use_struts_tag.jsp"
    ></action>
<action path="/loginusetag"
        type="com.tangjian.action.LoginAction"
        name="loginForm"
    >
    <forward name="success" path="/login_success.jsp"/>
    <forward name="error" path="/login_use_struts_tag.jsp"/>
</action>


login_use_struts_tag.jsp
<body>
	<h1>用户登陆-使用struts标签保持数据</h1>
	<hr>
	<form action="loginusetag.do" method="post">
		用户名:<html:text property="username"/><br>
		密&nbsp;&nbsp;码:<html:password property="password" value=""/><br>
		<input type="submit" value="提交">
	</form>
</body>


运行之后,报了如下错误:
严重: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope
	at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:935)
	at org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:121)
	at org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(BaseFieldTag.java:102)
	at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:81)
	at org.apache.jsp.login_005fuse_005fstruts_005ftag_jsp._jspx_meth_html_005ftext_005f0(login_005fuse_005fstruts_005ftag_jsp.java:100)
	at org.apache.jsp.login_005fuse_005fstruts_005ftag_jsp._jspService(login_005fuse_005fstruts_005ftag_jsp.java:68)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:461)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
	at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
	at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1023)
	at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:572)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:221)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.ap