java ee - DropDown selected value to be transfered in spring -


from jsp need transfer value selected in drop down when user click on search button submitting form.

    <form:form modelattribute="firstvo" method="post">       <form:select path="secondvo.status"      id="status" >      <form : option value="all" label="all" />      <form : option value="new" label="new" />      </form:select>       <input type="button" name="search" value="search" onclick="filterdata();" />       </form:form>       function filterdata(){       document.forms[0].action    =   path+"/filter.do";      document.forms[0].submit();      }      -------------------------------------------------       public class firstvo {       private secondvo secondvo;      }        public class secondvo {       private string status;      }       public class dpscontroller {       @requestmapping(value = "/filter.do")      public modelandview filterdashboard(httpservletrequest request, @modelattribute secondvo secondvo) {      system.out.println("secondvo.getstatus:"+secondvo.getstatus());      }      }  

note: dpscontroller action class printing status selected value.

any idea please?  

your model attribute firstvo , not secondvo. changing filterdashboard signature shown below should work.

change

   @requestmapping(value = "/filter.do")          public modelandview filterdashboard(httpservletrequest request, @modelattribute secondvo secondvo) {          system.out.println("secondvo.getstatus:"+secondvo.getstatus());      }  

to

@requestmapping(value = "/filter.do")      public modelandview filterdashboard(httpservletrequest request, @modelattribute firstvo firstvo) {     system.out.println("firstvo.getsecondvo().getstatus:"+firstvo.getsecondvo().getstatus());      }  

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -