scriptlet - Scripplets not working inside a javascript function -
friends writing code on jsp have use button call class , use method.however when tried same received unexpected output.i tried search reason , came across various related questions still struck don want use el or jstl.so when calling javascript function on button click working put java code lets response.sendredirect("/abc.jsp") page getting redirected before click button.please struck , not able solution.below working fine.but when add java code.it performed without click event.
</head> <body> <button id="dounzip" type="submit" name="unzip">unzip</button> <script> document.getelementbyid('dounzip').onclick=function (){ alert("welocome"); }; </script> </body>
now below not working
<body> <button id="dounzip" type="submit" name="unzip">unzip</button> <script> document.getelementbyid('dounzip').onclick=function (){ <% response.sendredirect("/index.jsp"); %> }; </script> </body>
Comments
Post a Comment