gpt4 book ai didi

Struts html html :text does not close input type ="text" tags

转载 作者:行者123 更新时间:2023-12-01 11:10:30 24 4
gpt4 key购买 nike

我使用 struts-html 生成表单字段。

例如:

<%@ taglib prefix="html" uri="/WEB-INF/taglibs/struts-html.tld" %>

<html:text property="email" styleId="email" size="44"/>

生成:

<input type="text" name="email" size="44" value="" id="email"> 

如上所示生成的输入标签没有关闭。这导致我的 html 无效。

struts-html.tld 包括:

<tlibversion>1.2</tlibversion>
<jspversion>1.1</jspversion>
<shortname>html</shortname>
<uri>http://struts.apache.org/tags-html</uri>

有谁知道为什么生成的输入没有关闭?有更新的版本吗?哪里可以下载?

我尝试使用:

<html:html xhtml="true">

呈现为:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> 

但是,我的输入标签一直呈现未关闭状态。


解决方案:

使用标签:

<html:xhtml/>

注意:如果您像我一样使用 Tiles,请直接在包含的 jsp 中使用它。它不是从您的基本模板文件继承的。

注意:在 xhtml 模式下,您不能在 html:form 标记内使用 sytleId。这不是问题,因为 id 属性是自动生成的,用于存储您的 bean 的名称。

最佳答案

你能不能只用 <html:xhtml/>

Using this tag in a page tells all other html taglib tags to render themselves as XHTML 1.0

或者你可以使用 <html:html xhtml="true"> .

关于Struts html html :text does not close input type ="text" tags,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/446376/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com