Alibabacloud.com offers a wide variety of articles about head first servlets and jsp pdf, easily find your head first servlets and jsp pdf information here online.
is used here, that's not good.
Target JSP to which the request was forwarded (HANDLEIT.JSP)Why the first request did not print out the "Welcome to Out page!" This sentence before jumping to judge the text?Because, using the Jsp:forward standard action, the buffer is emptied before forwarding, that is, all content that is written to the response before forwarding will be cleared out.If there is a good person, in the "Welcome to Out page!" After th
good to put servlets, declarations, and expressions in a JSP:1) Web page designers should not be required to understand Java2) Java code in JSP is difficult to modify and maintainThe user of EL (Expression Language) provides an easier way to invoke Java code, but the code itself is placed in place.The code might be in a normal Java class, perhaps a JavaBean, a c
elements 6 true7 Scripting-invalid>8 Jsp-property-group>9 Jsp-config>Ten Web-app>Ignore El in JSP:method One : Specify in Web. xml:1 Web-app>2 Jsp-config>3 Jsp-property-group>4 Url-pattern>*.jspUrl-pattern>5 el-ignored> //This flag indicates that the EL is ig
"Head First Servlets JSP" (Chinese version) Bb,ks BB, Su Yu, Lin Jian, China Power PressData interactionWeb browsers and Web servers: Interact with HTML data through the HTTP protocol.What exactly is MIME type?To an HTTP response:The value of the Content-type (content Type) response header is called the MIME type.The MIME type tells the browser what type of dat
particular protocol to handle the secure transmission. (The HTTPS protocol on top of SSL is practically always used.) )Data protection has some overhead and does not encrypt every request and response in your app, so use--conservatively and declaratively--to achieve data confidentiality and integrity:Data protection
Unauthenticated customer requests a restricted resource without a transmission guarantee
An unauthenticated customer requests a restricted resource, which is guaranteed
implementation and pass it through the Chain.dofilter () call to the servlet. And this custom implementation must also include a custom output stream, as this is our goal, and the filter can get this output after the servlet writes the output and before the output is returned to the customer.
Disadvantage: Complex httpservletresponse interfaces need to be implemented, but usually not.
To achieve their own httpservletresponse too responsible, how to do? --servlet Packaging DeviceCr
(ServletContext, HttpS ... ) is exactly the same as the property APIFor enumeration, see Java-enumeration Summary by IAMTJW5, the bad side of the property. •. ```.. ``.. `.`.`...`..
Context properties are not thread safe! A context property may be changed and accessed by multiple servlets at the same time. The bad solution is to add synchronized to doget (or other methods), which does not solve the problem because synchronized can only preve
example
The life cycle of a simple tag processorCustomize a simple tag with attributes (like C:foreach? )Stop page Processing--skippageexceptionStop page processing, not just throwing exceptions, but expecting the first part of the page to be processed as a response, but not the latter part of the process for some reason.The page information after the visible tag (back in the page ...) has no output!What happens if a tag is called from a contained page?Skippageexception just stops calling
("); org.apache.jasper.runtime.JspRuntimeLibrary.include (Request, response, "footer.jsp", out, false ); Out.write ( "\ n"); Out.write ("\ n"); Out.write ("The bold distinction is the conversion code for the include directive and the include action.Param actionModify the index.jsp code above:Modify Footer.jspEffectFoward ActionGarbled problem is not resolved, can only input Chinese. (Request.getparameter ("UserName")null) {% > page= "handleit.jsp"/> %}% > handl
client. Resp),doPost (httpservletrequest req, HttpServletResponse resp) such as
The servlet responds to the customer by responding to the object, and the container returns the response to the customer.
The service () thread ends, retains or cleans up the responding object, and the customer gets a response.
3. Mark Tomcat Official document Servlet API documentation4, HttpServlet inheritance tree, interface
Java.lang.Object
Javax.servlet.GenericServletJavax.servlet.http
custom tag, then now a little bit to see how the tag's support code is written.
The Java class that completes the tagging work Foo.AdvisorTagHandler.javaThis simple markup processor extends the Simpletagsupport and implements two key methods: Dotag () and Setuser ().Dotag () is the way to do the work, and SetUser () is the method that accepts the value of the property. Details are as follows:
El function vs Tag processor
Are all Java classes
Need to be pla
Let other components take over all requests; Partial takeover requestSome questions--The Intercept point is useful.1. Let other components take over all requests. PackageCom.example.web;ImportCom.example.model.BeerExpert;Importjavax.servlet.*;Importjavax.servlet.http.*;ImportJava.io.*;ImportJava.util.*; Public classBeerselectextendsHttpServlet {@Overrideprotected voidDoPost (httpservletrequest req, HttpServletResponse resp)throwsservletexception, IOException {String C= Req.getparameter ("Color")
Declaring a generic error pageThis applies to all resources in the Web app, not just the JSP
A more explicit exception error declaration
Declaring error page based on HTTP status code
Configuring servlet initialization in DDThe servlet is initialized by default when the first request arrives, and you can set the Load-on-startup element if you want to load the servlet when the deployment or server restarts.If multiple elements ar
1, El's English is expression Language, translated into Chinese is "expression language." This is a scripting language for front-end programmers, and El does not have a "big difference" compared to Java expressions, and it seems somewhat "superfluous" to the backend programmer.2, however, We can not force every front-end programmer to learn Java,el compared to java, the cost of learning is lower and easier to understand.3, in the previous written code practice test, first put scriptlet to ban, (
is not serializable? For migration, the Property object class needs to be httpsessionactivationlistener and the activation/deactivation callback method is used to solve the problem.
Listener Example
Session counterThis listener allows you to track the number of active sessions in this web app:To configure listeners in DD:Attention:
Attribute Supervisor ListenerThis listener can be traced every time a property is added to a session, a property is deleted, or a property is repla
type first, and then change to another type to continue writing.6. Why should I return a file through a servlet instead of returning it directly? The reason is that you want to perform some logic before and after returning a specific type of file, such as determining whether the user has permission to download the file.7, some things to remember, about the output, there are only two choices: characters or bytes.Output streams that can be returned via resp ... /* Omit parameter */ // can
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.