Announcement Announcement Module
Collapse
No announcement yet.
Whats the meanin of....? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Whats the meanin of....?

    Hi all

    I started with spring few days ago....I have a lot of questions but one of them is killing me....

    In app sample found on Inet i can read in a JSP the following code:
    Code:
    <table border="0" width="100%">
                             <tr>
                                  <td width="33%" align="right">Username: </td>
                                  <td width="66%" align="left">
                                       <spring:bind path="credentials.username">
                                       <input type="text" 
                                              name="username" 
                                              value="<core:out value="${status.value}"/>"/>          
                                       </spring:bind>
                                  </td>
                   
                             </tr>
                             <tr>
                                  <td colspan="2" align="center">
                                       <spring:hasBindErrors name="credentials">
                                       <font color="red"><core:out value="${status.errorMessage}"/></font>
                                       </spring:hasBindErrors>
                                  </td>
                             </tr>
    Whats the meaning of
    Code:
    value="<core:out value="${status.value}"/>"
    and why is assignet to value attibute?

  • #2
    Hi

    First:
    Code:
    value="<core:out value="${status.value}"/>"
    may be changed to:
    Code:
    value="${status.value}"
    for about 7 years (since JSP 2.0).

    Second - here's short explanation:
    1. <spring:bind path="credentials.username"> creates request-scope "status" variable of org.springframework.web.servlet.support.BindStatus class
    2. this variable lets you access bound property's (in this case: "credentials.username") value, binding errors and a value in case of errors - i.e. if the value from input field cannot be bound to bean's property, a HTML form on redisplay should show this invalid value
    3. "status.value" is translated into org.springframework.web.servlet.support.BindStatus .getValue() invocation which puts the value of bean's property ("credentials.username") in HTML input's element "value" attribute

    I hope this explains a little

    regards
    Grzegorz Grzybek

    Comment


    • #3
      Thanks very much for your information Grzegorz.

      The last question is what's the value use?

      Regards

      Comment

      Working...
      X