Discover java servlet jsp cookbook, include the articles, news, trends, analysis and practical advice about java servlet jsp cookbook on alibabacloud.com
Sample login verification code generated by JSP + Servlet, servlet Verification Code
A four-digit verification code is randomly generated, including Chinese characters, numbers, and uppercase/lowercase letters.
1. Servlet class
Package servlet; import
absolute: When a string is running in memory, it is represented as Unicode code. When it is saved to a file or other media, UTF is used. This conversion process is completed by writeutf and readutf.
Well, the basic discussion is almost done. Let's start with the topic below.
Think of this problem as a black box first. First look at the first-level representation of the black box:
Input (charseta)-> process (UNICODE)-> output (charsetb)
Simple: This is an IPO model, that is, input, proces
JspThe JSP eventually needs to be converted to Servelt and compiled, and is actually a compiled servlet during the requestJSP specializes in generating a large number of organized pages of structured HTML or other character data. Servlets excel at raw data, build data-rich pages, and perform tasks with little or no output (redirection)1.jsp is converted to
Difference between Servlet and JSP: difference between ServletJSP1. Basic Concepts 1.1 Servlet
Servlet is a server-side Java application that has the characteristics of being independent from the platform and protocol and can generate dynamic Web pages. It serves as the inte
the second-level representation:
Sourcefile (JSP, Java)-> class-> output
In this figure, we can see that the input is the JSP and Java source files. During the processing, the class file is used as the carrier and then output. Further refined to three levels:
JSP-> Tem
Javax. servlet. jsp cannot be resolved to a type, javax. servlet
After importing a project in MyEclipse to Eclipse Luna, an inexplicable error occurs. Note: Eclipse Luna is newly installed.
Error Description: js referenced on the jsp page reports an error. When you move the cursor over it, the prompt is javax.
servlet. But if you reorganize your application, what if the directory changes? If you use the ing method, there will be great flexibility. If you change the application directory, you only need to modify it in the ing. Besides, based on security considerations, do you always want users to know the directories on your servers? Therefore, the ing mechanism allows users to access a virtual name, which improves security.
Let's take a look at the overall
Combing Servlet and JSP (1), servletjsp
I had a JSP course in the first semester of my sophomore year, but I had a small JSP project before the start of school, so I didn't listen to the course for one semester until the final exam score came out, I can only recall the amount of JS
function and information processing needs. This is what was mentioned earlier by writing a Java class according to the servlet specification, thus writing a servlet.As for the JSP (Javaservlet Page), it can be seen that it is actually inherited from the servlet. It's just that it adds/modifies some methods in the
When Js|servlet started writing JSP, it was always disturbed by JSP's error messages, without a beginner who knows a little bit about the relationship between JSP and the servlet, all you see is a stack of messages, even exceptions, that include the details of the error messages, and But for beginners it is unfriendly
The main content I discussed earlier is servlet. In fact, my intention is to only discuss servlet. However, since JSP is an indispensable part of Java Web development, there is no harm in learning more. In the previous content, we found that when using Servlet to generate a
The full name of 1.JSP is Java Server Pages, the Chinese name is Java Servers page, it is a simplified servlet design, JSP technology is somewhat similar to ASP technology, it is in the traditional Web page HTML (Standard Universal Markup Language subset) file (*.htm,*. HTML
We discussed servlet in servlet parsing (2 ).The servlet interface in the UML class diagram. In this article, we will continue to discuss servletrequest, servletresponse, and servletconfig. In addition, there are servlet exceptions and servlet context.
Servletrequest and ser
Servlet Study Notes (7) -- JSP Overview1. servlet has two defects: ① All HTML tags must be included in Java strings, which makes sending HTTP responses very complicated; ② All text and HTML tags must be hardcoded, even if you make minor changes to the presentation layer, You need to recompile it.2. Note: (1)
Js|servlet| variable | script
12.1 jsp SCRIPT elementJSP script elements are used to insert Java code, which appears in the servlet generated by the current JSP page. Script elements are available in three different formats:
Expression format Scriptlet format Declaration Fo
) 0xa1}; New String (BA, "gb2312");
The result is "Ah," and the hex value is "\ufffd\u554a". 0x8140 is a GBK character, the GB2312 conversion table does not have the corresponding value, take \ufffd. (Note: When this Unicode is displayed, because there is no corresponding local character, the previous case is also displayed as a "?".)
In the actual programming, the Jsp/servlet program gets the wrong Chines
Method tutorial for implementing Single-thread mode of jsp or servlet, servlet single-Thread
For JSP pages, set the following (the page command is equivalent to the java this pointer ):
The default value is true, which is the multithreading mode.
For Servlets, you can
The Js|servlet JSP action controls the behavior of the servlet engine using markup from the XML syntax format. Using JSP actions, you can dynamically insert files, reuse JavaBean components, redirect users to another page, and generate HTML code for Java plug-ins.
| false: whether the attribute is encoded at the position used by the tag.◆ True | false: whether the attribute value can be specified using an expression.
Iii. Tag Processor
The tag processor is a Java class that executes custom tag behaviors through a series of predefined methods called by JSP containers.
The tag processor implements the behavior of tags. The tag processor is a
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.