Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sendRedirect Error

0 views
Skip to first unread message

baiju

unread,
Feb 6, 2002, 6:18:16 AM2/6/02
to
hey all

I have a submit which takes to the same page and after validation i am
trying to redirect to different pages ..

I have made sure that i have a return after responde.sendRedirect("").Still
i get this error ..


java.lang.IllegalStateException: response already committed
at
weblogic.servlet.internal.ServletResponseImpl.sendRedirect(ServletResponseIm
pl.java:495)
at jsp_servlet._jive.__post._jspService(__post.java:776)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)

Could any one suggest whats wrong ?

cheers, baiju


Cameron Purdy

unread,
Feb 6, 2002, 1:10:31 PM2/6/02
to
It's really simple: Don't send anything back via the response before you do
the redirect.

Don't submit to JSPs -- that's another golden rule for avoiding this entire
class of problems. Use Servlets to handle the "do" portion and JSPs to
handle the "show". Always use URLs that go to Servlets -- never to JSPs.

Peace,

--
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/

" baiju" <baiju....@jenterprise.de> wrote in message
news:3c61...@newsgroups.bea.com...

Alex Worden

unread,
Feb 6, 2002, 1:43:43 PM2/6/02
to
I have to disagree - there's nothing wrong with fielding submits from a JSP.
Just put the logic at the beginning if you're going to forward or redirect
anywhere. WLS uses a default buffer size of 4k (or is it 8K)... either way,
that's plenty of buffer space in which to decide that you don't want to
serve this JSP page.

"Cameron Purdy" <cpu...@tangosol.com> wrote in message
news:3c6170d2$1...@newsgroups.bea.com...

Cameron Purdy

unread,
Feb 6, 2002, 2:14:54 PM2/6/02
to
Hi Alex,

> I have to disagree - there's nothing wrong with fielding submits from a
JSP.
> Just put the logic at the beginning if you're going to forward or redirect
> anywhere. WLS uses a default buffer size of 4k (or is it 8K)... either
way,
> that's plenty of buffer space in which to decide that you don't want to
> serve this JSP page.

Code doesn't typically belong in a JSP. That is my personal opinion, and I
guarantee it is worth at least as much as you paid for it (nothing in this
case, but you could still send me some money if you would like ;-).

I've had very good results with the MVC-style pattern using the Servlet to
handle incoming requests and JSPs formatting the results. With custom tags,
we've always been able to avoid any requirements for code in JSPs, but it
does have more up-front effort for design and implementation.

Peace,

--
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/

"Alex Worden" <al...@bea.com> wrote in message

Alex Worden

unread,
Feb 6, 2002, 8:27:42 PM2/6/02
to
I agree, It's certainly easier to do code-intensive servlets in ... ahem...
servlets if you see what I mean.

"Cameron Purdy" <cpu...@tangosol.com> wrote in message

news:3c617fe8$1...@newsgroups.bea.com...

0 new messages