In order not to clearly write Java code in JSP, JSP still recommends using JSP tags instead of some Java code. Below we will list two simple JSP tags for a look: Jump tag and additional parameter tag.
[Java]
<% @ Page language = "java" import = "java. util. *" pageEncoding = "UTF-8" contentType = "text/html; charset = UTF-8" %>
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Title> common JSP labels </title>
</Head>
<Body>
<% Int x = 10; %>
<Jsp: forward page = "/index. jsp"> <% -- jump tag -- %>
<Jsp: param value = "xxxx" name = "username"/> <% -- you can use this label to bring the previous value in the jump tag -- %>
<Jsp: param value = "<% = x %>" name = "username1"/> <% -- you can use this expression to include the past value -- %>
</Jsp: forward>
</Body>
</Html>
<% @ Page language = "java" import = "java. util. *" pageEncoding = "UTF-8" contentType = "text/html; charset = UTF-8" %>
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Title> common JSP labels </title>
</Head>
<Body>
<% Int x = 10; %>
<Jsp: forward page = "/index. jsp"> <% -- jump tag -- %>
<Jsp: param value = "xxxx" name = "username"/> <% -- you can use this label to bring the previous value in the jump tag -- %>
<Jsp: param value = "<% = x %>" name = "username1"/> <% -- you can use this expression to include the past value -- %>
</Jsp: forward>
</Body>
</Html>
For JSP ing, like Servlet ing, configure the XML document to complete the ing. Let's take a look at the code below.
[Java]
<Servlet>
<Servlet-name> xxx </servlet-name>
<Jsp-file>/1.jsp</jsp-file>
</Servlet>
<Servlet-mapping>
<Servlet-name> xxx </servlet-name>
<Url-pattern>/888.html </url-pattern>
</Servlet-mapping>
<Servlet>
<Servlet-name> xxx </servlet-name>
<Jsp-file>/1.jsp</jsp-file>
</Servlet>
<Servlet-mapping>
<Servlet-name> xxx </servlet-name>
<Url-pattern>/888.html </url-pattern>
</Servlet-mapping>
In this case, 888.htmlis equivalent to the 1.jspweb page. Actually, 888.html does not exist.
From technology is my lifelong pursuit