I am using the following code in my Servlet to set the Attribute confirmMsg :
req.setAttribute("confirmMsg", "Update Values");
This I’m forwarding to the JSP
RequestDispatcher rd = req.getRequestDispatcher("displayDetails.jsp");
rd.forward(req, resp);
In my JSP, I need to display the message when the page loads.
<body onload = "showConfirmMsg();">
// .....
</body>
What should I do in the following function, so as to show the message onload itself?
function showConfirmMsg() {
// Code to show the alert box onload
}
Using jQuery, you can do something like:
<body onload="">isn’t very clean 🙂