Found 4336 Articles for Java 8

What is the out implicit object in JSP?

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

405 Views

The out implicit object is an instance of a javax.servlet.jsp.JspWriter object and is used to send content in a response.The initial JspWriter object is instantiated differently depending on whether the page is buffered or not. Buffering can be easily turned off by using the buffered = 'false' attribute of the page directive.The JspWriter object contains most of the same methods as the java.io.PrintWriter class. However, JspWriter has some additional methods designed to deal with buffering. Unlike the PrintWriter object, JspWriter throws IOExceptions.Following table lists out the important methods that we will use to write boolean char, int, double, object, String, ... Read More

What is a response object in JSP?

Ankith Reddy
Updated on 30-Jul-2019 22:30:25

994 Views

The response object is an instance of a javax.servlet.http.HttpServletResponse object. Just as the server creates the request object, it also creates an object to represent the response to the client.The response object also defines the interfaces that deal with creating new HTTP headers. Through this object, the JSP programmer can add new cookies or date stamps, HTTP status codes etc.The response object methods can be used to set HTTP response header in your servlet program. This object represents the server response.Following example would use setIntHeader() method to set Refresh header to simulate a digital clock −       ... Read More

Can somebody explain the HTTP headers in simpler terms in JSP context?

George John
Updated on 30-Jul-2019 22:30:25

120 Views

When a Web server responds to an HTTP request, the response typically consists of a status line, some response headers, a blank line, and the document. A typical response looks like this −HTTP/1.1 200 OK Content-Type: text/html Header2: ... ... HeaderN: ... (Blank Line) ... ... The status line consists of the HTTP version (HTTP/1.1 in the example), a status code (200 in the example), and a very short message corresponding to the status code (OK in the example).Following is ... Read More

How to write a while loop in a JSP page?

Samual Sam
Updated on 30-Jul-2019 22:30:25

1K+ Views

Following is the while loop example −           WHILE LOOP Example                           JSP Tutorial                           The above code will generate the following result −JSP Tutorial JSP Tutorial JSP Tutorial

Which methods can be used to read HTTP header in your JSP program.

Chandu yadav
Updated on 30-Jul-2019 22:30:25

308 Views

The request object provides methods to get HTTP header information including form data, cookies, HTTP methods, etc.Following table lists out the important methods that can be used to read HTTP header in your JSP program. These methods are available with HttpServletRequest object which represents client request to webserver.Sr.No.Method & Description1Cookie[] getCookies()Returns an array containing all of the Cookie objects the client sent with this request.2Enumeration getAttributeNames()Returns an Enumeration containing the names of the attributes available to this request.3Enumeration getHeaderNames()Returns an enumeration of all the header names this request contains.4Enumeration getParameterNames()Returns an enumeration of String objects containing the names of the ... Read More

How to write a for loop in a JSP page?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

6K+ Views

Following is the for loop example − FOR LOOP Example JSP Tutorial The above code will generate the following result −JSP Tutorial JSP Tutorial JSP Tutorial

How can you read a request header information in JSP?

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

384 Views

Following is the example which uses getHeaderNames() method of HttpServletRequest to read the HTTP header information. This method returns an Enumeration that contains the header information associated with the current HTTP request.Once we have an Enumeration, we can loop down the Enumeration in the standard manner. We will use the hasMoreElements() method to determine when to stop and the nextElement() method to get the name of each parameter name.           HTTP Header Request Example                        HTTP Header Request Example                                      Header Name                Header Value(s)                                            

What is a request object in JSP?

Ankith Reddy
Updated on 30-Jul-2019 22:30:25

883 Views

The request object is an instance of a javax.servlet.http.HttpServletRequest object. Each time a client requests a page, the JSP engine creates a new object to represent that request.The request object provides methods to get HTTP header information including form data, cookies, HTTP methods, etc.Following is the example which uses getHeaderNames() method of HttpServletRequest to read the HTTP header information. This method returns an Enumeration that contains the header information associated with the current HTTP request.Once we have an Enumeration, we can loop down the Enumeration in the standard manner. We will use the hasMoreElements() method to determine when to stop ... Read More

What are JSP literals?

Samual Sam
Updated on 30-Jul-2019 22:30:25

548 Views

The JSP expression language defines the following literals −Boolean − true and falseInteger − as in JavaFloating point − as in JavaString − with single and double quotes; " is escaped as \", ' is escaped as \', and \ is escaped as \.Null − null

What implicit objects are supported by JSP?

George John
Updated on 30-Jul-2019 22:30:25

119 Views

Following table lists out the nine Implicit Objects that JSP supports −Sr.No.Object & Description1requestThis is the HttpServletRequest object associated with the request.2responseThis is the HttpServletResponse object associated with the response to the client.3outThis is the PrintWriter object used to send output to the client.4sessionThis is the HttpSession object associated with the request.5applicationThis is the ServletContext object associated with the application context.6configThis is the ServletConfig object associated with the page.7pageContextThis encapsulates use of server-specific features like higher performance JspWriters.8pageThis is simply a synonym for this, and is used to call the methods defined by the translated servlet class.9ExceptionThe Exception object allows ... Read More

Advertisements