Populate <html:text> field from a <bean:write> tag

I want to populate a field from a session bean.

I attempted this:

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

but to no avail.



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%>"/>

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.

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.

Try Using

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

Need Your Help

How to use code libraries from github?

java json eclipse git jar

I need some tools to read JSON from a URL. However, when I tried to use the JSONObject class, it was unavailable. I looked it up and it was suggested that I should download the required library : h...

Difference between creating my asp.net MVC web application ,under the IIS Default web site, or create it as a new web site

asp.net asp.net-mvc-4 deployment iis-7

I have published my asp.net MVC web application under the “Default web site” inside IIS. I actually added two versions of my web application:-