I want to retrieve the request scope attribute in javascript as follows. How can I achieve this?
function caseChanges(req) {
var innervalue= "${dashboardTicketSummary}"
alert("nand you are 1234");
alert(innervalue);
}
Assumin the javascript is included inline on the jsp page -- you're on the right track, you just need to make sure the attribute is set (typically by your controller class) on the HttpServletRequest object, ie:
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res)
{
DashboardTicketSummary dts = ...; // code to obtain ticket summary here
req.setAttribute("dashboardTicketSummary", dts);
// code to dispatch to your jsp page here
}
Of course there are many other more sophisticated way -- especially is you use popular MVC framework such as Spring