Question 1) Sun Certified for J2EE Platform 1.4

Posted on
Like what you see? Share it.Share on Google+Share on LinkedInShare on FacebookShare on RedditTweet about this on TwitterEmail this to someone

Objective : The Structure and Deployment of Web Applications
SubObjective : * Using the HttpServletRequest interface, write code to retrieve HTML form parameters from the request, retrieve HTTP request header information, or retrieve cookies from the request

Single Answer Multiple Choice

 

You have created two different JavaScript files that will be executed depending on the type of browser used to access your Web application. You want to ensure that the appropriate JavaScript file is sent to the client’s browser. Which method call should you use to retrieve the browser type from the request header?

 

 

  1. request.getParameter()
  2. request.getInitParameter()
  3. request.getHeader(“User-Agent”)
  4. request.getHeader(“Browser-Type”)

 

 

 

Answer:
C. request.getHeader(“User-Agent”)

Tutorial:
You should use the request.getHeader(“User-Agent”) method call to retrieve the browser type from the request header. This method call returns the user agent that generated this request. The user agent may be a browser or another program. If it is a browser, the value will contain the name of the browser. If it is another program, the value will contain the name of the program as defined by the developer of the program.

 

The request.getParameter method is used to obtain parameter values from a form submitted by the end user.

 

The request.getInitParameter method is used to obtain initialization values from the deployment descriptor of a Web application.

 

The getHeader method cannot accept the parameter Browser-Type. There is no such standard header defined by any specification. However, it could be a custom header. In such a scenario, the getHeader method cannot contain the browser type information by convention.

 

These questions are derived from the Self-Test Software Practice Test for 310-081 – Sun Certified Web Component Developer for J2EE Platform 1.4 .

Like what you see? Share it.Share on Google+Share on LinkedInShare on FacebookShare on RedditTweet about this on TwitterEmail this to someone
cmadmin

ABOUT THE AUTHOR

Posted in Archive|

Comment: