Li Wu:
Good study and thinking, honouring teachers save Thanksgiving. Leaf See root three return to one, rivers the same oneness.
Meekness Conscience Lord, willing to do without regrets to the most bitter. Reading exercise strong body and mind, Prudential advised and the line and cherish.
Javaee:7
javase:1.8
jstl:1.2.2
Server:tomcat 8.5
Browser:chrome/firefox
Os:windows7 x64
Ide:myeclipse
Project structure
Xml
<?xml version= "1.0" encoding= "UTF-8"? ><web-app xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee/http Xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd "id=" webapp_id "version=" 3.1 "> <display-name>day11</ display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file& Gt;index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file> Default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file> default.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>addservlet</ Servlet-name> <servlet-class>com.jizuiku.servlet.addServlet</servlet-class> </servlet> < Servlet-mapping> <servlet-name>addServlet</servlet-name> <url-pattern>/addserVlet</url-pattern> </servlet-mapping> </web-app>
Addservlet.java
Package Com.jizuiku.servlet;import Java.io.ioexception;import Javax.servlet.servletexception;import Javax.servlet.http.httpservlet;import Javax.servlet.http.httpservletrequest;import javax.servlet.http.httpservletresponse;/** * * * @author Blog Park-to the most bitter * @version V2017.11.20 */public class Addservlet extends HttpServlet {@Overrideprotected void doget (HttpServletRequest request, httpservletresponse response ) throws Servletexception, IOException {//TODO auto-generated method stub} @Overrideprotected void DoPost ( HttpServletRequest request, HttpServletResponse response) throws Servletexception, IOException {//TODO auto-generated Method stub//Gets the argument string numstr = Request.getparameter ("num");//Convert to hexadecimal String numhexstr = integer.tohexstring ( Integer.parseint (NUMSTR));//Save the result in the Request field Request.setattribute ("result", numhexstr);// Convert to Result.jsprequest.getRequestDispatcher ("/adddemo/result.jsp"). Forward (request, response);;}
Form.jsp
<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%><%string path = Request.getcontextpath () ; String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";%> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >result.jsp
<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%><%string path = Request.getcontextpath () ; String basepath = request.getscheme () + "://" + request.getservername () + ":" + request.getserverport () + path + "/";%>& lt;! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >Browser testing
Learning resources: Itcast and Itheima Video library. If you have public resources, can share to me, with your resources to learn also can.
Blog post is to watch the video, into thinking written. It's good that the teacher speaks well. Blog bad, is to give the most bitter not serious.
A simple example of Javaweb Foundation Jsp+servlet Division of Labor