jsp.jsp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <html>
  2. <body>
  3. <script>
  4. var x = "abc";
  5. function y {
  6. }
  7. </script>
  8. <style>
  9. .class {
  10. background: #124356;
  11. }
  12. </style>
  13. <p>
  14. Today's date: <%= (new java.util.Date()).toLocaleString()%>
  15. </p>
  16. <%! int i = 0; %>
  17. <jsp:declaration>
  18. int j = 10;
  19. </jsp:declaration>
  20. <%-- This is JSP comment --%>
  21. <%@ directive attribute="value" %>
  22. <h2>Select Languages:</h2>
  23. <form ACTION="jspCheckBox.jsp">
  24. <input type="checkbox" name="id" value="Java"> Java<BR>
  25. <input type="checkbox" name="id" value=".NET"> .NET<BR>
  26. <input type="checkbox" name="id" value="PHP"> PHP<BR>
  27. <input type="checkbox" name="id" value="C/C++"> C/C++<BR>
  28. <input type="checkbox" name="id" value="PERL"> PERL <BR>
  29. <input type="submit" value="Submit">
  30. </form>
  31. <%
  32. String select[] = request.getParameterValues("id");
  33. if (select != null && select.length != 0) {
  34. out.println("You have selected: ");
  35. for (int i = 0; i < select.length; i++) {
  36. out.println(select[i]);
  37. }
  38. }
  39. %>
  40. </body>
  41. </html>