The target of this post is to realize:
JSP + Servlet + Service + DAO + JDBC (Oracle) + SP
First, we need to create a Dynamic Web Project:
File => New => Project...(The second one) => Web => Dynamic Web Project => Next
After clicking on Next:
Now we create one jsp file called "hello.jsp":
Right click on WebContent => New => JSP
Finish.
JSP Code:
01 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
02 pageEncoding="ISO-8859-1"%>
03 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
04 <html>
05 <head>
06 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
07 <title>Insert title here</title>
08 </head>
09 <body>
10 <h2><font color="blue">Sample01: JSP + Servlet + Service + DAO + JDBC + SP</font></h2>
11 <form action = "HelloServlet" method="get">
12 <table>
13 <tr>
14 <td>Name :</td>
15 <td><input type="text" name="name" /></td>
16 </tr>
17 <tr>
18 <td>Age :</td>
19 <td><input type="text" name="age" /></td>
20 </tr>
21 <tr>
22 <td></td>
23 <td>
24 <input type="reset" value="Clear" />
25 <input type="submit" value="Submit" />
26 </td>
27 </tr>
28 </table>
29 </form>
30 </body>
31 </html>
Right click on WebContent => New => JSP
Finish.
JSP Code:
01 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
02 pageEncoding="ISO-8859-1"%>
03 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
04 <html>
05 <head>
06 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
07 <title>Insert title here</title>
08 </head>
09 <body>
10 <h2><font color="blue">Sample01: JSP + Servlet + Service + DAO + JDBC + SP</font></h2>
11 <form action = "HelloServlet" method="get">
12 <table>
13 <tr>
14 <td>Name :</td>
15 <td><input type="text" name="name" /></td>
16 </tr>
17 <tr>
18 <td>Age :</td>
19 <td><input type="text" name="age" /></td>
20 </tr>
21 <tr>
22 <td></td>
23 <td>
24 <input type="reset" value="Clear" />
25 <input type="submit" value="Submit" />
26 </td>
27 </tr>
28 </table>
29 </form>
30 </body>
31 </html>
To be continued...
No comments:
Post a Comment