Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DropDown selected value to be transfered to action in spring

 
nitish kochar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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

Thanks

Ayan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic