import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Servlet implementation class Tes */ @WebServlet("/Tes") public class Tes extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Tes() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub HttpSession sess = request.getSession(true); int id = 5; sess.setAttribute("id", id); //response.sendRedirect("det.html"); PrintWriter outid = response.getWriter(); outid.println("<html>" +"<head>" +"<script language='javascript'>" +"var current = false;" +"function onChange()" +"{" +"document.write('1')" +"var rad = document.getElementById('radIn').checked;" +"if(rad == current)" +"return;" +"current = rad;" +"var array = rad ? ['in1','in2','in3','in4','in5'] :" +"['out1','out2','out3','out4','out5'];" +"var sel = document.getElementById('dropDown');" +"sel.innerHTML = '';" +"var opt;" +"document.write('3')" +"for each(var k in array)" +"{" //alert(k + ' asdsd'); +"opt = document.createElement('option');" +"opt.innerHTML = k;" +"sel.appendChild(opt);" +"}" +"}" +"</script>" +"</head>" +"<body >" +"<input type='radio' value='in' name='campus' />" +"<label for='radIn'>In Campus</label>" +"<br />" +"document.write('7')" +"<input type='radio' value='out' name='campus' />" +"<label for='radOut'>Out Campus</label>" +"<br />" +"<select id='dropDown'/>" +"document.write('9')" +"</body>" +"</html>"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)