#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Singapore
    Posts
    0
    Rep Power
    0

    Question


    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?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    68
    Rep Power
    14
    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.


  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    NY
    Posts
    0
    Rep Power
    0

    Thumbs up


    eh?... swing in servlet?....
    first time hearing this.

    Swing is for GUI.. Servlet is a server-side tech...
    i know you can use a Servlet to create HTML tag
    or javascript and send it back to the client side..
    then the client side will do interpretation for
    the these 2 tags and send more requests to the server
    by looking at what items are requested inside the tags.
    e.g. an Applet

    you can use Swing in the Applet, but duno if all
    browsers are supporting it. The Applet can call
    a Servlet and communication with it...

    that's all i know, hope it helps.
    -hoi

IMN logo majestic logo threadwatch logo seochat tools logo