填充来自的字段标签

发布于 2024-09-06 05:31:44 字数 220 浏览 5 评论 0原文

我想从会话 bean 填充一个字段。

我尝试过这样做:

`<html:text
    property="docId"
    value="<bean:write name="queryResponseBean" property="queryResults" />" />`

但没有成功。

谢谢。

I want to populate a field from a session bean.

I attempted this:

`<html:text
    property="docId"
    value="<bean:write name="queryResponseBean" property="queryResults" />" />`

but to no avail.

thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

极度宠爱 2024-09-13 05:31:44

struts html:text 标签的“value”属性将是字符串或 RT Expr(脚本),因此像上面使用的那样的嵌套表达式将不起作用。相反,“queryResults”属性的值必须设置为一个 bean,然后使用脚本语言插入到“value”属性中。

它看起来像这样

<bean:define id="textVal" name="queryResponseBean" property="queryResults"/>
<html:text property="docId" value="<%=textVal%>"/>

The "value" attribute of the struts html:text tag will either except a string or a RT Expr (scriplet), therefore a nested expression like the one used above won't work. Instead, the value of the "queryResults" property will have to be set to a bean and then inserted into the "value" attribute using scripting language.

It will look something like this

<bean:define id="textVal" name="queryResponseBean" property="queryResults"/>
<html:text property="docId" value="<%=textVal%>"/>
此生挚爱伱 2024-09-13 05:31:44

RT Expr 只允许出现在 struts html:text 标签的 value 属性中,因此避免使用嵌套表达式或 JSP 表达式语言。

A RT Expr is only allowed in the value attribute of the struts html:text tag, so avoid using nested expressions or JSP expression language.

七秒鱼° 2024-09-13 05:31:44

您可以直接赋值,不要使用 value='' 属性:

html:text property="docId" property="queryResults" />

其中 docId 必须是 BeanClass 并且属性 (queryResults ) 必须是 BeanClass 内的字段。

You can assign a value directly, don't use the value='' attribute:

html:text property="docId" property="queryResults" />

where docId must be a BeanClass and the property (queryResults) must be a field inside the BeanClass.

橙味迷妹 2024-09-13 05:31:44

尝试使用

<html:text 
    property="docId" 
    value="<bean:write name='${queryResponseBean}' property='queryResults' />" />

Try Using

<html:text 
    property="docId" 
    value="<bean:write name='${queryResponseBean}' property='queryResults' />" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文