knaren_1975
asked on
JSP Struts and JavaScript
Hi,
I am feeling it is very simple but I not able to do it.
My problem is I have to show one alert box once the data has successfully stored in to the database
I am setting the saving status in the action class below like this.
try{
relationship.save();/* relationship is hibernate object */
statusOfEditContract="true ";
request.setAttribute("stat usOfEditCo ntract",st atusOfEdit Contract);
} catch(Exception e){
statusOfEditContract="fals e";
request.setAttribute("stat usOfEditCo ntract",st atusOfEdit Contract);
}
return mapping.findForward("showP hases");
}
The request object I am getting in JSP below like this
<html:form>
<!-- some code is there - ->
</html:form>
<body onLoad="saveContract()">
<%
if (request.getAttribute("sta tusOfEditC ontract"). equals("tr ue"))
{
%>
<script language="javascript">
function saveContract(){
alert("Your Commitment Request has been Submitted");
}
</script>
<%
}
%>
</body>
When I run this code I am able to see the alert box once data is successfully stored but I am seeing one small error at the status bar. Value is null or not object.
Please help me on this
Regards
Naren
I am feeling it is very simple but I not able to do it.
My problem is I have to show one alert box once the data has successfully stored in to the database
I am setting the saving status in the action class below like this.
try{
relationship.save();/* relationship is hibernate object */
statusOfEditContract="true
request.setAttribute("stat
} catch(Exception e){
statusOfEditContract="fals
request.setAttribute("stat
}
return mapping.findForward("showP
}
The request object I am getting in JSP below like this
<html:form>
<!-- some code is there - ->
</html:form>
<body onLoad="saveContract()">
<%
if (request.getAttribute("sta
{
%>
<script language="javascript">
function saveContract(){
alert("Your Commitment Request has been Submitted");
}
</script>
<%
}
%>
</body>
When I run this code I am able to see the alert box once data is successfully stored but I am seeing one small error at the status bar. Value is null or not object.
Please help me on this
Regards
Naren
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.