*
The moose likes Spring and the fly likes DropDown selected value to be transfered to action in spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "DropDown selected value to be transfered to action in spring" Watch "DropDown selected value to be transfered to action in spring" New topic
Author

DropDown selected value to be transfered to action in spring

nitish kochar
Greenhorn

Joined: Nov 21, 2012
Posts: 10
JSP:

<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());
}
}

From jsp i need to transfer the value selected in drop down when a user click on search button which is submitting the form.

Note: DPSController is the action class which is printing the status selected value.

Any idea please?

Ayan mallick
Ranch Hand

Joined: Nov 17, 2012
Posts: 45
Hi

I think we need PropertyEditorSupport class to be extended in order to active init binding.
please have a look at this.

Thanks

Ayan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DropDown selected value to be transfered to action in spring