javascript not working in servlet.Please help.

Discussion in 'Java' started by adiraju_anuradha, Nov 8, 2012.

  1. adiraju_anuradha

    adiraju_anuradha

    Joined:
    Mar 14, 2012
    Messages:
    2
    import java.io.*;

    import javax.servlet.*;

    import javax.servlet.http.*;

    import java.lang.*;



    public class HiddenDropDown extends HttpServlet{

    public void service(HttpServletRequest req,HttpServletResponse res) throws IOException{



    PrintWriter out = res.getWriter();




    String theplace = req.getParameter("place");

    String user2 = req.getParameter("usernamehidden");







    out.println("username: "+user2);

    out.println("place: "+theplace);






    res.setContentType("text/html");


    out.println("<head>");

    out.println("script language=\"javascript\"");

    out.println("$(document.ready(MyFunction(){$('#SelectHidden').append($(\"<option>\"+$('#userplacehidden').val()+\"</option>\");return false;})");



    out.println("</script>");

    out.println("</head>");


    out.println("<form action=\"/Hostel/hve\">");

    out.println("<input type=\"hidden\" name=\"userplacehidden\" value=\"" +theplace+" \"/>");

    //out.println("<input type=\"hidden\" name=\"usernamehidden\" value=\"" +user2+" \"/>");

    out.println("<select id=\"SelectHidden\" name=\"SelectHiddenThing\">");

    out.println("<option onClick=\"MyFunction();\"> enter here </option>");

    out.println("<select/>");

    out.println("<input type=\"submit\" value=\"Back\">");

    out.println("</form>");

    }
    }
    adiraju_anuradha, Nov 8, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. circuit_breaker
    Replies:
    2
    Views:
    1,989
    Jack Jia
    Apr 4, 2004
  2. Doug McCann
    Replies:
    1
    Views:
    993
    William Brogden
    Aug 5, 2004
  3. KK
    Replies:
    2
    Views:
    528
    Big Brian
    Oct 14, 2003
  4. cormacdebarra@gmail.com

    Servlet error ...package Javax.servlet does not exist

    cormacdebarra@gmail.com, Nov 10, 2006, in forum: Java
    Replies:
    4
    Views:
    13,236
    Simon Brooke
    Nov 11, 2006
  5. Jitender
    Replies:
    2
    Views:
    667
Loading...

Share This Page