2010-07-15 62 views

回答

3

你不给许多细节上正是你正在尝试做的,但我假设你有一个字段

<input type="hidden" ... /> 

您想更改为类似

<input type="text" ... /> 

如果是这种情况,可以使用JQuery来修改字段的类型,甚至用隐藏字段的值创建一个新字段。也许这可以帮助你change type of input field with jQuery 如果你给我更多的细节,我可能会帮助更多。

编辑: Struts的hidden标签被呈现为<输入型=“隐藏” >元素(可以在浏览生成的HTML代码,看到自己),所以你的确可以使用jQuery来显示它。假设你的隐藏元素的ID是“hiddenElement”您可以使用

$("#hiddenElement").val() 

在JavaScript中获取其值并显示你想去的地方。你可以用JQuery做很多有趣的事情,所以你可以阅读文档以获得更多关于如何使用它的想法。

+0

此止跌,显示消息对使用Struts标签没有帮助。 – 2010-07-21 13:46:56

0

您可以随时更改此设置(在Struts中):

<html:hidden property="message"> 

<bean:write property="message" /> <!-- Creates the "message" as text --> 

OR

<html:text property="message"> <!-- Creates a text box that with a populated message --> 
0

(使用Struts 1.x中)

如果您希望你的隐藏的elemnt被显示仍然是访问您的表格,您可以用write属性(见struts documentation):

<html:hidden property="message" write="true"> 

这样一来,你的内容将是可见的,但是从你的形式仍然可以访问。