wood burning stoves 2.0
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Internal Server Error page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Internal Server Error page" Watch "Internal Server Error page" New topic

Internal Server Error page

Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
Wich code inside the catch block is supposed to trigger the display of a container generated HTTP Internal Server Error page ?

"response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)" or
"throw new ServletException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);"



SCJP | SCWCD | SCBCD | SCWSD 5 | SCEA (I) 1.4 | SCEA 5 | IBM SOA 669
Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
Would it be the first option(sendError) because it says "generated an error page" ?

Saurabh Chaubey
Ranch Hand

Joined: Oct 16, 2005
Posts: 101
Hi Felipe,
I think the first option will give the desired output for error500.
Reagarding the second option there is no constructor for ServletException which takes int as the first argument. The valid costructors are as follows:

public javax.servlet.ServletException();
public javax.servlet.ServletException(java.lang.String);
public javax.servlet.ServletException(java.lang.String,java.lang.Throwable);

public javax.servlet.ServletException(java.lang.Throwable);

So, the first option is correct.

Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
Hum, you�re dead right Saurabh , there is no constructor like that.
I dind�t get that.

Anyway, if we had somethig like this: "throw new ServletException("String")", i�m also think that the correct answer would be the "sendError()"

I agree. Here's the link: http://aspose.com/file-tools
subject: Internal Server Error page
It's not a secret anymore!