javascript not working in servlet.Please help.

Joined
Mar 14, 2012
Messages
2
Reaction score
0
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>");

}
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top