wood burning stoves 2.0*
The moose likes JSP and the fly likes java.lang.IllegalStateException in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "java.lang.IllegalStateException in Servlet" Watch "java.lang.IllegalStateException in Servlet" New topic
Author

java.lang.IllegalStateException in Servlet

Peyyety Avinash
Greenhorn

Joined: Mar 25, 2010
Posts: 19
My page2.jsp (view1)



My controller and request dispatcher servlet :


My page4.jsp (view2)


Heres the error:


Please help !
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you are trying to do operation on response which is committed already. I can see code redundancy in your servlet .

Logic:
1. get username , password and other details

2. create *a* Session , and set the details

3. at last forward[ *once *] to jsp page

P.S. Very bad Servlet!
Peyyety Avinash
Greenhorn

Joined: Mar 25, 2010
Posts: 19
thanks so much for getting back !
If this is not asking too much...can you please paste back
my code kicking out the unwanted code please !

I am bad at coding yaa and definitely that was a
bad bad servlet
Aman Goel
Greenhorn

Joined: Jan 14, 2010
Posts: 15
Your are forwarding the request before getting all the parameters....
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Since you are new, I am posting formatted code[Still you need to improve below code!]
but dont expect code! . javaranch is not a code mill

Peyyety Avinash
Greenhorn

Joined: Mar 25, 2010
Posts: 19
Thanks a lot !!
javaranch is not a code mill
I got the point dude.
and, I created unecessary session and dispatch objects...Now I
figured out you just need one.
Thanks ! I am done
Peyyety Avinash
Greenhorn

Joined: Mar 25, 2010
Posts: 19
I am getting directed from page2.jsp to page4.jsp (very fine, alright) after changing the controller servlet,
but all the attributes are printing null. None of the Attributes set to request object (of HttpRequest) are being fetched. why ?! please check my page4.jsp
Sony Agrawal
Ranch Hand

Joined: Oct 04, 2009
Posts: 143
Have you set the attributes in request or session...
Peyyety Avinash
Greenhorn

Joined: Mar 25, 2010
Posts: 19
Have you set the attributes in request or session...

Ya now i changed it to session and its working fine
Thanks !!!
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Peyyety Avinash wrote:Thanks !!!


You're welcome
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Peyyety Avinash wrote:hey ranchers help me out...im waiting to finish off my project assignment before 6

EaseUp. PatienceIsAVirtue.

Expecting immediate help from a forum is unreasonable.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

Plan ahead in the future. I removed your rude bump as a favor.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

But now my quote/reply doesn't make any sense.

(Even more than usual.)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

That's why I posted -- so people would know you weren't crazy.
Peyyety Avinash
Greenhorn

Joined: Mar 25, 2010
Posts: 19
Oh god ! I dint know that I walked into an Institution on the Internet. reminds me of school
(I owe an explaination to the esteemed moderators..I meant fellow ranchers, help me out !...we are all growing the java livestock on the java ranch aren't we..i dint exactly put down wat i meant though..so, sorry )
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

Good manners and good communication skills never go out of style.
 
Don't get me started about those stupid light bulbs.
 
subject: java.lang.IllegalStateException in Servlet