Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

IllegalStateException

 
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
 
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
 
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
 
Would anybody like some fudge? I made it an hour ago. And it goes well with a tiny ad ...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic