Quote:
Originally posted by carolchua
Can I use JOptionPane.showConfirmDialog in my servlet? When I test on the live web server, a classnotfound error is found.
If not, how can I call the windows message box from my servlet? |
What type of windows dialog box?? you just want a box to pop up to tell them that their stuff was submitted or accepted? If thats the case, you would inbed some javascript to call the box.
this is a long javascript that pops up a little window if someone didnt enter at least 3 characters in a box or forgot to enter something in a text box... i am just too lazy to edit it for you right now... you can take out all the if statements and make it say what you want... I am not sure if you have any exp with JavaScript (it is new to me) but you have to call the script from an event like link click or button click... i will give example of it after this script
out.println("<SCRIPT LANGUAGE = \"JavaScript\">");
out.println("function oops(form1) {");
out.println(" if (form1.actDesc.value == '') {");
out.println(" alert('Please insert a description.');");
out.println(" return false;");
out.println(" } else if (form1.actType.selectedIndex == 0");
out.println(" && form1.actName.value == '') {");
out.println(" alert('Please insert an activity.');");
out.println(" return false;");
out.println(" } else if (form1.actType.selectedIndex == 0");
out.println(" && form1.actName.value.length < 3) {");
out.println(" alert('Activity must be at least 3 characters.');");
out.println(" return false;");
out.println(" }");
out.println(" form1.submit();");
out.println("}");
out.println("</SCRIPT>");
Then wherever you may call the script kinda like
out.println("<TD colspan=2 align=center><INPUT align=middle name=actSubmit type=button value=\"Submit This Activity\" onClick='oops(document.agentAct);'></P>");
hope this is kinda what you were looking for.