Results 1 to 4 of 4

Thread: ModelAttribute problem

Threaded View

  1. #1
    Join Date
    Aug 2008
    Posts
    105

    Default ModelAttribute problem

    Hi,
    I have a problem with the @ModelAttribute and @SessionAttributes usages.
    Basically, I have a JSP with a form and a controller with the related form backing bean and I want to modify the value in the form, refresh the page (with Javascript) and show the new value in the same page.

    The problem is that the value of the form backing bean does not change if I modify the value in the form and I refresh the page (I have always the first value)...

    This is my controller:
    Code:
    @Controller
    @SessionAttributes(value = {"value"})
    public class FindValuesForm {
    
    private final ValueDto value;
    
    public FindValuesForm(){
      this.value = new ValueDto();
    }
    
    ...
    @RequestMapping(value = "/find.do", method = RequestMethod.GET)
    public String setupForm(ModelMap model){
      ...
      model.addAttribute("value", this.value);
      return "find";
    }
    
    @RequestMapping(value = "/find.do", method = RequestMethod.POST)
    public String processSubmit(
    @ModelAttribute("value") ValueDto value, BindingResult result,  ModelMap model) {
      ...
    // Use the value object
    }
    And my JSP looks like:

    Code:
    <form:form name="form1" modelAttribute="value">
     ...
      <c:out value="value: ${value.id_value}"/>
    </form:form>
    I don't know how to solve this problem...
    Any idea?
    Thanks!

    BYE
    Last edited by andrew007; Dec 29th, 2008 at 11:56 AM.

Posting Permissions

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