Organizational Research By

Surprising Reserch Topic

how to update user details by jsp form in spring security java config using -'hibernate,jsp,spring-security,spring-java-config'

how to update user details by jsp form in spring security java config  using -'hibernate,jsp,spring-security,spring-java-config'

I'm trying to edit and update the information of user like username,phone number,address and emailId in spring security hibernate. I'm editing the information in a form and trying to update by submitting the form.I'm new to spring security, so can you help me to submit the updated form and save?

@RequestMapping(value={"/update"}, method = RequestMethod.POST)
    public String update(@Valid User user,BindingResult result,ModelMap model){
        return "prefs";

void updateUser(User user);

public void updateUser(User user) {
    Session session = getSession();


   <form method="POST" name="editProfile" action="update">
    <div class="margin-top-10  form-group">
      <input class="form-control input-lg" name="name" id="name" placeholder="Contact Name" size="25" type="text" value="${user.getName()}">
      <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
    <div class="margin-top-10  form-group">
      <input class="form-control input-lg" name="contactNumber" id="contactNumber" placeholder="Phone Number" size="25" type="text" value="${user.getContactNumber()}">
    <div class="margin-top-10  form-group">
      <input class="form-control input-lg" name="emailId" id="emailId" placeholder="Email" size="25" type="text" value="${user.getEmailId()}">
    <div class="margin-top-10  form-group">
     <input class="form-control input-lg" name="address" id="address" placeholder="Address" type="text" value="${user.getAddress()}">
    <div class="margin-top-10  form-group">
      <input class="form-control input-lg" name="password" id="password" placeholder="Password" size="25" type="hidden" value="${user.getPassword()}">
    <div class="margin-top-10 form-actions form-group">
      <button type="submit" class="btn btn-default btn-primary" id="updateUser">Update Settings</button>


asked Sep 7, 2015 by rajesh
0 votes

Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.