By: aathishankaran Emailed: 1757 times Printed: 2444 times
Server Side Programming
A "request" in server-side processing refers to the transaction between a browser and the server. When someone clicks or enters a URL, the browser sends a "request" to the server for that URL, and shows the data returned. As a part of this "request", various data is available, including the file the browser wants from the server, and if the request is coming from pressing a SUBMIT button, the information the user has entered in the form fields.
The JSP "request" variable is used to obtain information from the request as sent by the browser. For instance, you can find out the name of the client's host (if available, otherwise the IP address will be returned.) Let us modify the code as shown:
System.out.println( "Evaluating date now" );
java.util.Date date = new java.util.Date();
Hello! The time is now
out.println( date );
out.println( "<BR>Your machine's address is " );
A similar variable is "response". This can be used to affect the response being sent to the browser. For instance, you can call response.sendRedirect( anotherUrl ); to send a response to the browser that it should load a different URL. This response will actually go all the way to the browser. The browser will then send a different request, to "anotherUrl". This is a little different from some other JSP mechanisms we will come across, for including another page or forwarding the browser to another page.
Be the first one to add a comment
Most Viewed Articles (in JSP )
Most Emailed Articles (in JSP)