Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of basic knowledge of jsp

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the summary of the basic knowledge of jsp, which is very detailed and has a certain reference value. Interested friends must finish reading it!

Servlet knowledge and common errors and rules.

1. Desktop programs are essentially the same as WEB applications in the process-based on request and response.

2.http Protocol (Hypertext transfer Protocol)

1)。 Stateless: there is no connection between multiple requests for information.

2)。 Used for internet to send request and response messages

3)。 Use the port to receive and send messages, default to port 80.

Port: for memory buffer (multithreaded to receive data)

Windows: 0Murray 65535 port

0Murray 4096 is the system port.

3. What is Servlet?

Server let server Mini Program.

A program written by java that handles requests sent by the client and responds by the server to the client.

Servlet runs only on the server

4.Servlet details:

Import java.io.*

Import javax.servlet.*

Import javax.servlet.http.*

Import java.util.*

Public class MyServlet extends HttpServlet

{

Public void doGet (HttpServletRequest request,HttpServletResponse response)

Throws ServletException,IOException

{

Response.setContentType ("text/html;charset=gb2312")

Request.setCharacterEncoding ("gb2312")

Response.sendRedirect ("Login.jsp"); / / redirect method

Request.getParameter (""); / / read client data

/ / the following method is forwarding, which is different from redirection: data is not lost when forwarding.

ServletContext context=this.getServletContext ()

RequestDispatcher dispatcher=context.getRequestDispatcher

("/ welcome.jsp")

Dispatcher.forward (request,response)

. / / the following methods are included (relatively rarely used)

Dispatcher.include (request,response)

}

Public void doPost (HttpServletRequest request,HttpServletResponse response)

Throws ServletException,IOException

{

DoGet (request,response)

}

}

(2)。 Src= "Servlet?name=''" when parameters need to be passed to Servlet

5. When executing servlet, a download prompt occurs:

(1)。 Possibility 1: the text/html;charset=GBK middle semicolon is written as a comma.

(2)。 Possibility 2: configuration information error in XML.

(3)。 Possibility 3: when defining global variables, for example, CONTENT_TYPED is enclosed in double quotation marks for later use.

(4)。 Possibility 4: when you write the wrong characters in the text/html,charset above, you will also be prompted to download.

6 A 404 error occurred while executing servlet:

(1)。 Most of them are configuration errors in xml.

(2)。 There may be an url error in the servlet communication method.

(3)。 Action path when the form is submitted.

(4)。 The more retarded mistake is the wrong marking. Please check it carefully.

7. A 403 error occurred while executing servlet:

(1) an error occurred in the site under tomcat.

8. A 405 error occurred while executing servlet:

(1) when there is no post submission method in servlet.

ninety-five。 A 500th error occurred while executing servlet:

(1)。 Most of them are abnormal errors in servlet program code.

10. When executing, the data fetched is null. It is necessary to find the error prompt according to the actual situation.

11. A 500error message occurred while executing the jsp page.

Most of the jsp pages have compilation errors in the translation process! If it is a serious mistake, you can follow the prompt to go back and find it.

II. XML configuration

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report