• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Internal Server Error page

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);"

?

tks.
 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would it be the first option(sendError) because it says "generated an error page" ?

Tks.
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Regards,
Saurabh
 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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()"

Tks.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic