1

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.

komidore64
  • 55
  • 1
  • 1
  • 8

4 Answers4

3

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%>"/>
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
Salman Paracha
  • 1,697
  • 2
  • 16
  • 27
1

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.

Chris
  • 3,113
  • 26
  • 33
Manish
  • 11
  • 1
1

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.

user754106
  • 11
  • 2
0

Try Using

<html:text 
    property="docId" 
    value="<bean:write name='${queryResponseBean}' property='queryResults' />" />
Rakesh Goyal
  • 3,117
  • 8
  • 39
  • 69