JSP format file is a dynamic web page technical standard, it is a dynamic web page written in Java languageProgramFiles mainly appear in the Process of website development. However, some users may accidentally download JSP files, such as jb51..
1. Add jstl support to the following code on the jsp page
Copy codeThe Code is as follows:
2. If the jsp page reports the following exception
Org. apache. jasper. JasperException: java. lang. ClassNotFoundException: org. apache. jsp. Customer.
1. Compile a tag processor class that implements the tag Interface
Copy codeThe Code is as follows: package cn. itcast. web. tag;
Import java. io. IOException;
Import javax. servlet. http. HttpServletRequest;Import javax. servlet. jsp. JspException;
When I passed parameters in Chinese today, I was unable to pass the live encoding, so I thought of using escape.Request. getParameter could not receive the parameter, so he thought about how to receive the parameter.Tested and approved
Copy codeThe
If the page in jsp: include is garbled, you must add the
Request. setCharacterEncoding ('utf-8 "); // or the specified encoding (GBK or other)
%>
As shown below:
Copy codeCode: jsp-include.jsp
jsp include test page
Request.
There are five types of JSP compiler guidance and Directive elements. after JSP1.0, most of the JSP files are contained in a single tag ending. the new JSP1.1 specification has been published, and it is also compatible with XML.
The compiler guide
At present, both blog forums and enterprise offices cannot do without sharing resources. By uploading files, we can share them with you to achieve extensive communication and communication among the masses. We can gain more knowledge and experience
Define entities in jspBean obtain the bean property value and output the value to the page;
EL expression:$ {Object name}When an el expression is used to retrieve data, it usually uses a. sign or a. Sign. []
PageContext. findAttribute ("data"); //
Copy codeThe Code is as follows:
Java. awt. image. *, java. util. *, javax. imageio. * "%>Color getRandColor (int fc, int bc) {// obtain a random Color from a given rangeRandom random = new Random ();If (fc> 255) fc = 255;If (bc> 255) bc = 255;Int r
Disable cache settings on jsp pages
1. The client cache should include the following content in :Or
2. Disable caching on the dynamic web page of the server. Add a script similar to the following:Response. setHeader ("Pragma", "No-cache
JSP built-in Object request object
The request information of the client is encapsulated in the request object, so that the client can understand the customer's requirements and then respond. It is an instance of the HttpServletRequest class.
Serial
Some examples are shown on the Internet. For a simple three-level linkage, Struts, Hibernate, and other frameworks are added. This Ajax interaction does not know how it relates to these frameworks. Why is a small Demo so big.
Today, I made a dwr +
Page jumps can be achieved in two ways: forward and sendRedirect.
Forward: it can be used in JSP pages and implemented in Servlet.Use On the jsp page. For example, to jump to userlist. jsp, you can write:
Copy codeThe Code is as follows:
Use the
Jsp provides nine built-in objects. The following describes the nine built-in objects in jsp.
Built-in object type Scope Request javax. servlet. http. HttpServletRequest requestResponse javax. servlet. http. HttpServletResponse responsePageContext
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service