-1

How can i create a popup(alert) message when a user enters a correct value or an incorrect value by clicking on the "Go" button . i am not sure how to connect the "Go" button with the java code .

please help

<%@ page import="java.io.*,java.util.*" %>
<html>
 <body>

<% 
 int a =6;
 int b = 8; 
%>

<FORM METHOD=POST ACTION="main.jsp">
 <%=a%>+<%=b%> =  <INPUT TYPE=TEXT NAME=num SIZE=20>
 <P><INPUT TYPE=SUBMIT value="Go"></p>
 <P><INPUT TYPE=SUBMIT value="Continue" disabled="disabled" ></p>
 </body>
 </html>
toky
  • 119
  • 1
  • 5
  • 15

1 Answers1

1

Once you're done removing all the scriptlets from your code...

You can make an alert appear when the button is clicked by doing something like this:

<input type="submit" value="Go" onclick="function(){ alert('hello, world'); }">

You probably won't get many responses because using scriptlets with jsp is extremely frowned upon.

jahroy
  • 22,322
  • 9
  • 59
  • 108