Announcement Announcement Module
Collapse
No announcement yet.
Issue with bindTag. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue with bindTag.

    1.This one works
    Code:
        <form method="POST">
            <table>
                <c&#58;forEach var="customerList" varStatus="status" items="$&#123;customerCollection.customerList&#125;">
                    <tr>
                        <td>
                            <spring&#58;bind path="customerCollection.customerList&#91;$&#123;status.index&#125;&#93;.firstName">
                                <input class="input-box" type="text" name="<c&#58;out value="$&#123;status.expression&#125;" />" length="30" maxlength="30"
                                value="<c&#58;out value="$&#123;status.value&#125;"/>"
                                />
                            </spring&#58;bind>
                        </td>
                    </tr>
                </c&#58;forEach>
            </table>
            <button type="submit" id="submit" class="button">
            <span>
            Submit
            </span>
            </button>
        </form>
    2. But this one does not
    Code:
        <form method="POST">
            <table>
                <c&#58;forEach var="customerList" varStatus="status" items="$&#123;customerCollection.customerList&#125;">
                    <tr>
                        <td>
                            <spring&#58;bind path="customerCollection.customerList&#91;$&#123;status.index&#125;&#93;.firstName">
                                <input class="input-box" type="text" name="<c&#58;out value="$&#123;status.expression&#125;" />" length="30" maxlength="30"
                                value="<c&#58;out value="$&#123;status.value&#125;"/>"
                                />
                            </spring&#58;bind>
                        </td>
                        <td>
                            <spring&#58;bind path="customerCollection.customerList&#91;$&#123;status.index&#125;&#93;.lastName">
                                <input class="input-box" type="text" name="<c&#58;out value="$&#123;status.expression&#125;" />" length="30" maxlength="30"
                                value="<c&#58;out value="$&#123;status.value&#125;"/>"
                                />
                            </spring&#58;bind>
                        </td>
                    </tr>
                </c&#58;forEach>
            </table>
            <button type="submit" id="submit" class="button">
            <span>
            Submit
            </span>
            </button>
        </form>
    This is the error I get, when I try to load the page for item 2.
    Code:
    org.apache.jasper.JasperException&#58; Invalid property 'customerList&#91;&#93;' of bean class &#91;example.domain.CustomerCollection&#93;&#58; Invalid index in property path 'customerList&#91;&#93;'; nested exception is java.lang.NumberFormatException&#58; For input string&#58; ""
    	org.apache.jasper.servlet.JspServletWrapper.service&#40;JspServletWrapper.java&#58;372&#41;
    	org.apache.jasper.servlet.JspServlet.serviceJspFile&#40;JspServlet.java&#58;292&#41;
    	org.apache.jasper.servlet.JspServlet.service&#40;JspServlet.java&#58;236&#41;
    	javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;810&#41;
    	org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel&#40;InternalResourceView.java&#58;97&#41;
    	org.springframework.web.servlet.view.AbstractView.render&#40;AbstractView.java&#58;247&#41;
    	org.springframework.web.servlet.DispatcherServlet.render&#40;DispatcherServlet.java&#58;839&#41;
    	org.springframework.web.servlet.DispatcherServlet.doDispatch&#40;DispatcherServlet.java&#58;616&#41;
    	org.springframework.web.servlet.DispatcherServlet.doService&#40;DispatcherServlet.java&#58;543&#41;
    	org.springframework.web.servlet.FrameworkServlet.serviceWrapper&#40;FrameworkServlet.java&#58;390&#41;
    	org.springframework.web.servlet.FrameworkServlet.doGet&#40;FrameworkServlet.java&#58;341&#41;
    	javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;697&#41;
    	javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;810&#41;
    	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter&#40;ReplyHeaderFilter.java&#58;75&#41;
    
    root cause
    
    org.springframework.beans.InvalidPropertyException&#58; Invalid property 'customerList&#91;&#93;' of bean class &#91;example.domain.CustomerCollection&#93;&#58; Invalid index in property path 'customerList&#91;&#93;'; nested exception is java.lang.NumberFormatException&#58; For input string&#58; ""
    	org.springframework.beans.BeanWrapperImpl.getPropertyValue&#40;BeanWrapperImpl.java&#58;667&#41;
    	org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper&#40;BeanWrapperImpl.java&#58;495&#41;
    	org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath&#40;BeanWrapperImpl.java&#58;473&#41;
    	org.springframework.beans.BeanWrapperImpl.getPropertyValue&#40;BeanWrapperImpl.java&#58;584&#41;
    	org.springframework.validation.BindException.getFieldValue&#40;BindException.java&#58;301&#41;
    	org.springframework.web.servlet.support.BindStatus.<init>&#40;BindStatus.java&#58;114&#41;
    	org.springframework.web.servlet.tags.BindStatus.<init>&#40;BindStatus.java&#58;38&#41;
    	org.springframework.web.servlet.tags.BindTag.doStartTagInternal&#40;BindTag.java&#58;105&#41;
    	org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag&#40;RequestContextAwareTag.java&#58;71&#41;
    	org.apache.jsp.WEB_002dINF.jsp.test_jsp._jspService&#40;test_jsp.java&#58;162&#41;
    	org.apache.jasper.runtime.HttpJspBase.service&#40;HttpJspBase.java&#58;94&#41;
    	javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;810&#41;
    	org.apache.jasper.servlet.JspServletWrapper.service&#40;JspServletWrapper.java&#58;324&#41;
    	org.apache.jasper.servlet.JspServlet.serviceJspFile&#40;JspServlet.java&#58;292&#41;
    	org.apache.jasper.servlet.JspServlet.service&#40;JspServlet.java&#58;236&#41;
    	javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;810&#41;
    	org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel&#40;InternalResourceView.java&#58;97&#41;
    	org.springframework.web.servlet.view.AbstractView.render&#40;AbstractView.java&#58;247&#41;
    	org.springframework.web.servlet.DispatcherServlet.render&#40;DispatcherServlet.java&#58;839&#41;
    	org.springframework.web.servlet.DispatcherServlet.doDispatch&#40;DispatcherServlet.java&#58;616&#41;
    	org.springframework.web.servlet.DispatcherServlet.doService&#40;DispatcherServlet.java&#58;543&#41;
    	org.springframework.web.servlet.FrameworkServlet.serviceWrapper&#40;FrameworkServlet.java&#58;390&#41;
    	org.springframework.web.servlet.FrameworkServlet.doGet&#40;FrameworkServlet.java&#58;341&#41;
    	javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;697&#41;
    	javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;810&#41;
    	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter&#40;ReplyHeaderFilter.java&#58;75&#41;
    
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
    Apache Tomcat/5.0.28
    This is what I am trying to do.
    I have an Object (CustomerCollection) --> which has customerList(java.util.List). This List is going to hold all the customer names that are going to be entered in Web UI. I have to use this approach because the command class cannot be a collection.

    If you look at the Item 2. Closely it has an additional <td></td> block for collecting the last name and associated sping binding.

    Just like to know what is wrong with this approach?

    Is this something to do with spring:bind tag?

    Thanks in advance!
    Arun

  • #2
    you have defined the varStatus with a name of "status" which is also used by the spring:bind tag

    Comment

    Working...
    X