I have a JSP page containing a data Table. I want to pass the content of the first column of a row ,when clicked, to another jsp page. I am working with spring framework. I have tried to achieve it,but with some problem. The problem is : When I am retrieving the parameter in another jsp page, i get some content,but the contents after the first blank space are skipped.
Here is the code I have tried: source jsp page:
$(document).ready(function(){
$("#mytable tbody tr").click(function(){
var aPos = $('#mytable').dataTable().fnGetPosition(this);
var aData = $('#mytable').dataTable().fnGetData(aPos);
pass_on=aData[0];
window.location.href = "/test/integrate"+"?"+"group="+pass_on;
});
});
the controller:
@RequestMapping(value="/test/integrate", method = RequestMethod.GET)
public String pass_parameter_by_type(ModelMap model,HttpServletRequest request,HttpServletResponse response) {
return "destination";
}
the destination jsp page:
<body>
<input type="button" id="sub_but">
<input type="hidden" value=<%=request.getParameter("group") %> id="group_parameter">
$("#sub_but").click(function(){
alert($("#group_parameter").val());
});
</body>
if the value passed is "cool guy", then in url it shows test/integrate?group=cool guy. but in alert it shows only "cool". Please help.