I am creating a web application which is based on Spring mvc framework.This application contains four radio buttons.My requirement is to pass the selection of radio buttons to controller that part is done.Now,once the selection is passed to controller then I don't know how to retain the selection of the radio on JSP.Because When I am returning the name of jsp as index.jsp then page is getting reloaded with intial values of no selection in radio button
<form id=envselection action=${pageContext.request.contextPath}/env method=post>
<input type=radio name=env id=radioSelection value=QA 71 onclick=submitForm()>
<input type=radio name=env id=radioSelection value=QA 72 onclick=submitForm()>
<input type=radio name=env id=radioSelection value=QA 73 onclick=submitForm()>
<input type=radio name=env id=radioSelection value=QA 74 onclick=submitForm()>
</form>
Javascript
<script>
function submitForm() {
document.getElementById(envselection).submit();
}
</script>
Controller part
@RequestMapping(value = /env, method = RequestMethod.POST)
public String env(HttpServletRequest request){
logger.info(parameter is +request.getParameter(env));
return index;
}
Is there any other way of setting the selected value of radio button for java use and retaining the selection of radio button on JSP also.
Thanks in advance