htmlstrutsstruts-html

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


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.


Solution

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