Search code examples
javainputhidden-fieldstripes

Hidden field value in Stripes (object instead of numeric value)


I have this field in my JSP file:

<s:hidden name="testResult.bottle" value="${testResultsActionBean.testResult.bottle.id}" />

and I get this:

<input name="testResult.bottle" value="package.dto.BottleDto@e8" type="hidden" />

But this line of code returns ID, which I need as value in the hidden input:

<c:out value="${testResultsActionBean.testResult.bottle.id}"></c:out>

How can I get ID as value in input?

Thanks for any advice.


Solution

  • Stripes always prefers the value from the action bean over anything you put in the value attribute. (Even if the value in the action bean is null)

    Use this:

    <s:hidden name="testResult.bottle.id"/>