Announcement Announcement Module
No announcement yet.
Reusable Input Fields with Bind Tag Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reusable Input Fields with Bind Tag

    I am using a servlet 2.3/jsp1.2 container and I want to create reusable fields i.e. text, checkbox, etc... One of the reason I am doing this is that I want to inject JS functions to all fields. For this to be truly generic, the path attribute should be dynamic. Can I do this?

    <!-- input.jsp -->
    <spring:bind path="${name}">
    <input type="text" name="${status.expression}" value="${status.value}" onfocus="callSomeJsFunction();"/>

    <!-- Some sample JSP -->
    <tiles:insert page="/WEB-INF/jsp/templates/input.jsp">
    <tilesut name="id" value="someId"/>
    <tilesut name="name" value="pathAttributeNameString"/>

    Has anyone tried anything like that?

  • #2
    Without having tried this explicitely, I would guess it will work as expected. The path attribute of the spring:bind supports EL and should use the dynamic value (as expressed in So give a try like this.