JSP page
<%@ Page Language="Java"Import="java.util.*"pageencoding="GB18030"%><%StringPath=Request.getcontextpath ();StringBasePath=Request.getscheme ()+"://"+Request.getservername ()+":"+Request.getserverport ()+Path+"/";%><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"><HTML> <Head><%-- <Base href="<%=basePath%>"> --%> <title>My JSP ' index.jsp ' starting page</title> <Metahttp-equiv= "Pragma"content= "No-cache"> <Metahttp-equiv= "Cache-control"content= "No-cache"> <Metahttp-equiv= "Expires"content= "0"> <Metahttp-equiv= "keywords"content= "Keyword1,keyword2,keyword3"> <Metahttp-equiv= "description"content= "This is my page"> <!--<link rel= "stylesheet" type= "Text/css " href= "Styles.css" > - </Head> <Body> <ahref= "Servlet/jstlelservlet">Test El Expression</a><BR> </Body></HTML>
Then go to Web. Xml to find:
<?XML version= "1.0" encoding= "UTF-8"?><Web-appversion= "2.4"xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <servlet> <Servlet-name>Jstlelservlet</Servlet-name> <Servlet-class>Com.bjpowernode.jstl.JstlElServlet</Servlet-class> </servlet> <servlet-mapping> <Servlet-name>Jstlelservlet</Servlet-name> <Url-pattern>/servlet/jstlelservlet</Url-pattern> </servlet-mapping> </Web-app>
Then find the Java class:
PackageCom.bjpowernode.jstl;Importjava.io.IOException;Importjavax.servlet.ServletException;ImportJavax.servlet.http.HttpServlet;Importjavax.servlet.http.HttpServletRequest;ImportJavax.servlet.http.HttpServletResponse; Public classJstlelservletextendsHttpServlet {@Overrideprotected voiddoget (httpservletrequest request, httpservletresponse response)throwsservletexception, IOException {request.setattribute ("Hello", "Hello World"); Request.getrequestdispatcher ("/web-inf/jstl_el.jsp"). Forward (request, response); }}
Jump to jstl_jsp page
<%@ Page Language="Java"ContentType="text/html; charset=gb18030"pageencoding="GB18030"%><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=gb18030"><title>Insert Title here</title></Head><Body> <H1>Test El Expression</H1> <HR> <Li>Normal string</Li><BR>hell0 (JSP footsteps):<%=Request.getattribute ("Hello") %><BR></Body></HTML>
Summary: Try to make those who despise you, abandon you regret!
[drp]-index.jsp page to another page servlet how to configure