• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IllegalStateException

 
Shini Akshi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to test some codes(of HFJS) relavant to IllegalStateException

try{
String c=request.getParameter("color");
BeerExpert b=new BeerExpert();
List l=b.getBrands(c);

request.setAttribute("styles",l);

RequestDispatcher v=request.getRequestDispatcher("result.jsp");
v.forward(request,response);
//response.sendRedirect("/result.jsp");
out.println("After forward");

}
catch(Exception e){
out.print("seems servlet exception "+e.getMessage());
}

This is the part of the code.
1.IlegalStaeException was not thrown
2.The page was forwarded without any error but "After forward" wasn't seen
3.Exception caught with null(I think e.getMessage()part returns null)

Please anybody help me to sort out this problem
 
Jan van Mansum
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this thread is helpful.
 
Shini Akshi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jan,
Thanks so much, I got this clarrified and really helpful for the SCWCD
 
Vepa Sritej
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Shini Akshi:
Hi Jan,
Thanks so much, I got this clarrified and really helpful for the SCWCD


Hi Shini,

could you please explain me the answer...
 
Shini Akshi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi tej,
Sorry for the big delay,
According to what I test, the container(I use Tomcat) doesn't throw IllegalStateExceptions.It must have been modified)
If write to the output stream before forwarding, that output stream message is shown without forwarding the page.
If we forwarding the page before writing to the page, the page is forwarded without writing to the output Stream

Shini
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic