Announcement Announcement Module
Collapse
No announcement yet.
Spring bind, using dynamic path Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring bind, using dynamic path

    Hi,

    I'm using the spring & form taglibs and I'd like to set the 'path' attribute at runtime.
    I want to use a same jsp fragment to bind on a object, lets say a 'user' but this object can be at diferent level in my object tree

    in a jsp I would have :
    <spring:bind path="user.firstName">

    in a second one :
    <spring:bind path="order.user.firstName">

    I'd like to extract the common form in a jsp fragment and pass a prefix from the calling jsp to have something like this :
    <spring:bind path="${pathPrefix}user.firstName">

    Apparently it doesn't work and I don't know if there's a way to perform this.

    Regards,

  • #2
    Hi sylbal,

    what exactly does not work? Do you get an exception or does just nothing happen?

    Comment


    • #3
      Hi,

      No exception, it's simply not doing anything. When inspecting the generated html code (id, name attributes), the value of $pathPrefix is not added at the begining of the constant string

      eg
      $pathPrefix = "order.", tested ok with c:out

      I expect to have < input id="order.user.firstName" ... /> but I get id="user.firstName"

      Comment


      • #4
        Looks to me as if pathPrefix is not set correct in the ModelAndView...

        Comment

        Working...
        X