Results 1 to 4 of 4

Thread: password field in jsp does not bind with the command object

  1. #1
    Join Date
    Sep 2009
    Posts
    2

    Unhappy password field in jsp does not bind with the command object

    Hi,
    My command object has a User object which has a password field but it does not bind to the jsp.
    JSP fragment:
    <tr>
    <td align="right" width="20%">Password:</td>
    <td width="20%"><formassword path="password" /></td>
    <td width="60%"><form:errors path="password"
    cssClass="error" /></td>
    </tr>
    If the user object has password 'abcxyz', I do not see '*******' in my password field in the jsp. Other fields show up just fine.

    Why does this happen and how can I fix this ?

    Thanks in advance,
    KCN

  2. #2

    Default

    if you are talking about posting the form and viewing the property on the model which is user in your case, you should be able to set a breakpoint and verify this serverside, if it is coming through blank then I would I check spelling and getters and setters on your password field.

    If you are talking about posting back to the form for something like an error case, I don't believe there is a way to make the password field retain the password previously entered. I could be wrong, but I'm not sure you can actually bind data to the password field on load like you can any other field.

  3. #3
    Join Date
    Sep 2009
    Posts
    2

    Question

    Thanks for the reply.
    I am not talking about posting the form. It is when the form first gets displayed, then the password textbox does not get populated with the User.password field. Where User.id etc show up just fine.

  4. #4
    Join Date
    Jun 2007
    Location
    Vienna, Austria
    Posts
    68

    Default

    By default the password value is not shown. You will have to use the attribute showPassword like
    Code:
    <form:password path="password" showPassword="true" />
    See Spring reference 13.9.6. The password tag

    Martin

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •