Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  2. pageEncoding="ISO-8859-1"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  7. <title>A sample to connect to DB</title>
  8. </head>
  9.  
  10. <!-- This is the beginning of the actual script -->
  11.  
  12.  
  13. <body>
  14. <%@ page import="java.io.*" %>
  15. <%@ page import="db.*" %>
  16.  
  17. <h1> Customer Order Form</h1>
  18.  
  19. <form action="index.jsp" method="get">
  20.  
  21. Favorite Sports: <input id="sports" name="sports" type="text"/><br/>
  22. <input type="submit" Value="Submit" ></input>
  23. </form>
  24. <%
  25. String sports=request.getParameter("sports");
  26.  
  27. if (sports!= null&&!sports.trim().equals("")){
  28. DBentry DBentry=new DBentry();
  29. boolean flag=DBentry.entry(sports);
  30. if(flag) {%><script type="text/javascript">alert("Entry Success");</script><%
  31. }
  32. else { %><script type="text/javascript">alert("Entry Failure");</script><% }
  33. }
  34.  
  35. %>
  36.  
  37. </body>
  38. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement