Attribute name invalid for tag form according to TLD异常解决办法_gaigai_百度空间

Attribute name invalid for tag form according to TLD异常解决办法_gaigai_百度空间

Attribute name invalid for tag form according to TLD异常解决办法

在Eclipse中开发Struts应用程序时,当调用JSP时遇到Attribute name invalid for tag form according to TLD异常,解决办法是将JSP文件中<htm:form></html:form>修改为<form></form>.笔者试途添加JSTL类库,未能解决问题,也可能是Struts包中相关类库未添加.

一般出现这种问题,都是form表单的name属性作怪,因为在Html:FORM里面没有name属性,吧这个属性去掉就OK

确保引入标签库:<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>

<html:form name="loginForm" action="hello.jsp" method="post" onsubmit="return login(this)">

1 Struts标签<html:form>中有个属性name,设置这个属性,就会带来这样的错误。所以我建议大家尽量不要设置这个属性,设置了action后,name会自动生成一个action对应的actionform。
2 onsubmit是小写的,注意taglib是区分大小写的
下面的是错误的写法:
<html:form name="loginForm" action="hello.jsp" method="post" onSubmit="return login(this)">





原文地址:https://www.cnblogs.com/wang3680/p/d131eb6fea071f4a6b2cb2c61d010852.html