How a JSP Page Executed

Web server receives the request from client: as soon as it receives the request, • It loads and initializes the class file related to that jsp • The JSP handles zero or more client requests • The server removes the JSP class from memory JSP-Client Interaction Handling HTTP Clients: A JSP page handles client requests through its intrinsic objects. These objects contain the request info and can pass the response info to the client. We can use the session object to store user specific information. The application object can be used to store the application specific information. Requests and Responses: The client request information is available in a JSP page thru request object, which encapsulates the data from the client. HttpServletRequest Objects: The request object provides access to HTTP header data, such as any cookies found in the request and the HTTP method with which the request was made. The request object also allows you to obtain the arguments that the client sent as part of the request. To access client data: • The getParameter method returns the value of a named parameter. If your parameter could have more than one value, use getParameterValues instead. The getParameterValues method returns an array of values for the named parameter. (The method getParameterNames provides the names of the parameters.) • For HTTP GET requests, the getQueryString method returns a String of raw data from the client. You must parse this data yourself to obtain the parameters and values. • For HTTP POST, PUT, and DELETE requests, we can use out object to send output to the client. ________________________________________ Note: Use either a getParameter [Values] method or one of the methods that allow you to parse the data yourself. They can not be used together in a single request. ________________________________________ HttpServletResponse Objects: • The response object is used to send response to the client, which encapsulates the response to the client. • We can use out object or response object to send response back to client. HTTP Header Data: You can set HTTP header data before you access the response object. The response object provides methods to access the header data. For example, the setContentType method sets the content type. (This header is often the only one manually set.) Handling GET and POST Requests: A JSP page can handle both the requests sent thru either get or post methods. Threading Issues: JSPs are typically capable of serving multiple clients concurrently. If the methods in your JSP that do work for clients access a shared resource, then you can handle the concurrency by creating a JSP page that handles only one client request at a time. (You could also synchronize access to the resource, a general topic in the Java Programming Language that is note covered in this tutorial.)

ONLINE TRAINING

Dear friends we are happy to announce that we entered in corporate training. For the past two years we trained many students, Employees as per industrial requirements. Now we are started online training session for who dont have enough time and who dont want to waste time to come to institutes for learning. We are offering online sessions for Windows server 2003, windows server 2008, MCSE, .NET, Java. MS SQL Server and many more. For more details about course and fee structure please



Followers

Google Pagerank Powered by  MyPagerank.Net