Java EE study notes --2

1.java_home is to facilitate the direct command line calls and various jdk package jar package. The compiler also easy to find jdk position, but now you can own scanned.

2.Java7 provides try-with-resources mechanism, which is similar in Python with statement, to achieve a resource definition java.lang.AutoCloseable interface in the back try parentheses, regardless of the try block is normal or abnormal end, this resource will be closed automatically. The part in parentheses try called try-with-resources block

After 3.servelet written, xml configuration in web.xml which
must be added to a map maping

<servlet>
    <servlet-name>testServlet</servlet-name>
    <servlet-class>com.java.code.class2.servlet.TestServlet</servlet-class>
</servlet>
    <servlet-mapping>
        <servlet-name>testServlet</servlet-name>
        <url-pattern>/testServletV1</url-pattern>
    </servlet-mapping>

Wherein consistent requires two servelet-name name name can easily play, it needs to be consistent
servlet-calss class is used to position location

In fact, you can also use the comment @WebServlet("/TestServlet3")
4.extend Httpse

Help us to do some of the package, such as the pass in the header value in coming out, better use of HTTP in some of the resources.

5.response getwritter are returned in the body inside
the client got the body

6.Javaserver Pages to write server-side page with java
container (tomcat) in order to write jsp, we need to support the servlet

<%
  这里面可以添加java语言
%>

There can be added to the java language

7.ctrl + o quickly override inherited methods
Alt + insert fast write get () set () method
8. The load driving few words deleted. No problem in jdbc, but can not receive messages on the servlet.
9.jsp mainly the dynamic html

Released five original articles · won praise 1 · views 110

Guess you like

Origin blog.csdn.net/For_user/article/details/104724088