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

Html的input标签的value能取${对象.属性}值吗?
Html的input标签的value能取${对象.属性}值吗?
${fileInfo.description} 可以取值。

我想把这个值设置到 input下面。请问value该怎么写呢?直接写${fileInfo.description}

读不出来呢?

用Struts2 的标签可以。但是 

<s:textfield name="adminInfo.name" value="%{adminInfo.name}"></s:textfield> 如果加了个id字段,就又显示不出来了。

这个id是我一个验证框架里面用到的。所以还是想用html 的input 设置value值。

HTML code
<input type="text" id="fileType" name="fileInfo.description"
                                            style="width: 120px" value=""/>


------解决方案--------------------
<s:textfield name="adminInfo.name" value="%{adminInfo.name}"></s:textfield> 如果加了个id字段,就又显示不出来了。

加个ID怎么会不出来了?
<s:textfield name="adminInfo.name" value="%{adminInfo.name}" id="name"></s:textfield>
------解决方案--------------------
<input type="text" id="fileType" name="" style="width: 120px" value=${fileInfo.description}"/>
------解决方案--------------------
不好意思 少个引号
<input type="text" id="fileType" name="" style="width: 120px" value="${fileInfo.description}"/> 

------解决方案--------------------
<s:textfield name="description" value="%{fileInfo.description}" id="description"></s:textfield>
这样哪?


------解决方案--------------------
用property标签能输出不?
------解决方案--------------------
<input type="text" id="fileType" name="" style="width: 120px" value="${fileInfo.description}"/>
这个在JSTL和EL环境下一点问题都没有了。
------解决方案--------------------
探讨

用${fileInfo.description}
<s:property value="description"/>都是可以取值的。
很诡异呢~

引用:
用property标签能输出不?

------解决方案--------------------
<input type="text" value="${fileInfo.description}"/>
<input type="text" value="<s:property value="fileInfo.description"/>">