Once in order to do a similar to Google, Baidu input prompt, grilled Baidu code (now the address http://www.baidu.com/js/bdsug.js? V = 1.0.3.0, format it again) After some research, we found that Baidu's message mechanism is concise and effective,
1. RequestDispatcher. forward ()Is used on the server. When forward () is used, the Servlet engine transmits the HTTP request from the current Servlet or JSP to another Servlet, JSP or common HTML file, that is, your form is submitted to. jsp, in.
The implementation of the verification code is divided into two parts: JSP page and Java Servlet:
JSP page:
loginForm.html
-->
login page with verification code
Username:
Password & nbsp; Code:
Verification Code:
Create an index in the application. jsp file. The file index_jsp.java and index_jsp.class will be generated under the tomcat work directory, that is, the java statement is embedded in the html language. on the server side, the class file will be
In essence, JSP nesting Java code into HTML, and then compiled and executed by JSP containers (Tomcat, Resin, Weblogic, etc, then, the corresponding HTML code is generated based on the running results of the dynamic code, which can be normally
Servlet Chinese garbled charactersInsert the following word into Servlet doPost and the jsp that calls Servlet.[Html]Request. setCharacterEncoding ("UTF-8 ");Response. setCharacterEncoding ("UTF-8 ");
[Html]Keep the code on both sides consistent.
The first file below is pageSupport mainly processing various parameters.
Package net. spring. service;Import java. util. List;Public class pageSupport {Int pagesize = 2; // number of entries per pageInt totalCount; // The total number of items.Int
Jsp elements include:
I. jsp page
1. CommentVisible comment html comment, visible in the browser, insecureJava comments are normal, invisible to the browser, and secure, but they violate the Java and html code separation principles. or Hide comment
1. Overview of custom JSP labels
A custom JSP tag is a type of JSP tag defined by the programmer. This tag encapsulates the information display logic in a separate Java class and describes its usage through an XML file. When you need to use similar
Nv. jsp uses javascript to display lower-level menus on the page "> My JSP 'nv. jsp 'starting page Main Menu dwr. configure the ajax class and bean to be used in the xml configuration file. ajax
The integration process with Struts2 is really easy. however, after implementation, the image cannot be uploaded. After the upload, "the file does not exist" is displayed, and some information is found online. After summary, this function is finally
1Jsp is a java server pages and servlet, both of which are developed by sun and can be used to develop dynamic web pages. Jsp is generally placed under the web template directory. Jsp inherits servlet.
2. Why can I directly use some requests?
Get reference of Map type request, session, application, actual type HttpServletRequest, HttpSession, and ServletContext:
First three: dependent on Containers
First three: IOC (only this type)
The following three: dependent on Containers
Third:
With the release of the CDI portlet integration library, we can use the huge advantages brought by CDI through the portlet Bridge in the JSF Portlet.
How to use it?
In addition to the usual Portlet bridge dependency, you also need:
Add the following
[Java]// I declare...Private String aBC = "abc ";
// I declare...Private String aBC = "abc"; Then I Alt + Shift + R and S (Generate Getter/Setter) so smoothly... andEclipseGenerate like this
[Java]Public String getaBC (){Return aBC;} Public void
Step 1. Create a new project named struts2hello web project under MyElipse; 2. Import the Jar package to copy the jar package of struts 2 to the WEB-INF/lib/directory; or in the project. add [html] and refresh the project. 3. Configure Filter to
Disable cache settings on jsp pages1. The client cache should include the following content in :Or2. Disable caching on the dynamic web page of the server. Add a script similar to the following:Response. setHeader ("Pragma", "No-cache ");Response.
By accident, I learned a piece of code when I first learned Java many years ago. Maybe I can't write it now. If the technology is so popular, it will move back if it is not in progress. It's still good to be young, with clear ideas and ample energy.
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