struts-1 - Struts html 标签不起作用

标签 struts-1

我只是尝试在带有 struts 提供的标签的 jsp 页面中包含一个文本框。但它表现得很典型。

在职的
<html:text property="name" value=""></html:text>
不工作
<html:text property="name"></html:text>所以,没有属性(property)'value' ,它不工作。
请帮帮我。

笔记:
使用 tomcat 6.0
bean,逻辑运行良好,在 html 中,它们中的大多数都在运行。 radio、textarea、text 是一些导致问题的原因。
JSP文件
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %><%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %><%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %><%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Registration Form</title></head><body><html:text property="name"></html:text></body></html>

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 14

11: <title>Registration Form</title>
12: </head>
13: <body>
14: <html:text property="name"></html:text>
15: </body>
16: </html>


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause 

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause 

javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope
    org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:864)
    org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:126)
    org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(BaseFieldTag.java:102)
    org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:80)
    org.apache.jsp.index_jsp._jspx_meth_html_005ftext_005f0(index_jsp.java:96)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.18

最佳答案

<html:text>标签应该包含在 <html:form> 内标签,它定义了 Action ,从而定义了 <html:text> 的 ActionForm 实例。得到它的值(value)。

关于struts-1 - Struts html 标签不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14083862/

相关文章:

java - org.apache.jasper.JasperException : javax. servlet.ServletException : javax. servlet.jsp.JspException:无法在名称airline_name下找到bean

java - 在 Struts 1 中一起使用验证方法和验证 xml

java - <c :if test ='${empty Validated}' ><jsp:forward page ="/do/Index"/></c:if> not forwarding properly in Spring Boot

java - 集成 Struts Core 1.3.10 后 - 本地主机上的 Tomcat 8.0.21 服务器无法启动

java - LifeTime Action 类 Struts 1.3.10

java - 如何通过编程设置下一个要执行的Action的FormBean?

java - 迁移到 Tomcat7 后,BeanUtils.populate 在 struts 中抛出 NullPointerException

javascript - 使用html :select tag as replacement for id in javascript document. getElementById 'property'的[''属性]

forms - 支柱 1 : Put values of a jsp into form that uses a java List

java - 从 Struts1 迁移到 Struts2