Nick H
Nick H

Reputation: 11535

Bind values in JSP without converting to string?

UPDATE: looks like spring:bind does work for some collections - it might be a problem with my model, causing it not to recognise certain collections. When I've got to the bottom of this I'll update my question and/or provide an answer.


The spring:bind tag is useful for accessing values in order to print them on the page or as a form field value, e.g.

<spring:bind path="filename">
  <c:out value="${status.value}" />
</spring:bind>

status.value is always a String, converted using whatever PropertyEditor is detected. But this is unhelpful if I want to access a property that's a List so that I can loop over it. I can access the variable directly in JSP but then I have to know the name of the command, and I can't take advantage of things like spring:nestedPath.

Can spring:bind provide access to the actual original value rather than the converted String, or is there another tag that can do this?

I'm using Spring 3.1.

Upvotes: 2

Views: 1425

Answers (1)

Peter Szanto
Peter Szanto

Reputation: 7722

you can access the original object by

${status.actualValue}

Upvotes: 3

Related Questions