Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
Servlets
« Previous
Next »
Which method is used to specify before any lines that uses the PintWriter?
Options
- setPageType()
- setContextType()
- setContentType()
- setResponseType()
CORRECT ANSWER : setContentType()
Discussion Board
setContentType()
setContentType()- provides the definition of an object to assist a servlet in sending a response to the client. The container of the servlet creates a ServletResponse object and passes it as an argument to the servlet's service method. ServletOutputStream is used to send the binary data in a MIME body response and it is returned by getOutputStream(). PrintWriter is used to send the character data and it is being returned by getWriter() method.
The character set for the MIME body response can be specified explicitly using the setCharacterEncoding(java.lang.String) and setContentType(java.lang.String) methods, or implicitly using the setLocale(java.util.Locale) method. Explicit specifications have higher prcedence over implicity specifications.
Rohit Sharma 11-27-2014 03:53 PM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
Java Beginner (11)
Java (39)
Java (40)
Java (22)
Java (30)
Java (25)
Java (20)
Java (20)
Core Java (20)
Core Java (10)
Core Java (72)
EJB (20)
JDBC (20)
Applet (20)
Struts (21)
Servlets (20)
Java Web Services (20)
Javascript (40)
J2EE (10)
jQuery (46)
Advertisement
▲