are you sure the response hasn't been committed? if it has, i'd expect you to see an exception somewhere in the logs when you call redirect.

if it's already been committed, there's no much you can do about it.

how about putting another servlet in front of the roller action (?) servlet? then you can be assured that the response is clean at the time you inspect the session. probably not an ideal solution but all i can think of right now.

On Nov 30, 2007, at 1:49 PM, Prabhu Patil wrote:

Dave,

I already tried the pageContext and getResponse() method of it. It did
not work. Roller just painted the current page, but did not redirect to
another page that I was hoping to see. Below are code snippets.

this.pageContext = (PageContext)params.get("pageContext");
this.resp = (HttpServletResponse)pageContext.getResponse();
....

resp.sendRedirect(redirectURL);

Another approach of writing to response also gave the same result. Below
is the code snippet:

pageContext.getOut().println("<script
type=\"text/javascript\">document.location.href='"
                                                + redirectURL +
"';</script>");

How can I achieve the Redirection to another URL based on a values of
session attribute? That's, in gist, what I'm trying to achieve.

Thanks,

-----Original Message-----
From: Dave [mailto:[EMAIL PROTECTED]
Sent: Friday, November 30, 2007 3:43 PM
To: [email protected]
Subject: Re: inserting java code in templates

Hmm... I'm not sure we support that.

Try "pageContext" which might give you a JSP PageContext from which
you can get the response.

You might run into problems if you write to the response. I have never
tried that.

- Dave



On Nov 30, 2007 4:19 PM, Prabhu Patil <[EMAIL PROTECTED]> wrote:
Dave,

Sorry, I need the Response object, not the request.

Thanks

-----Original Message-----
From: Dave [mailto:[EMAIL PROTECTED]
Sent: Friday, November 30, 2007 3:17 PM
To: [email protected]
Subject: Re: inserting java code in templates


On Nov 30, 2007 4:12 PM, Prabhu Patil <[EMAIL PROTECTED]> wrote:
I'm almost there, but for one last thing. I need the
HTTPServletResponse
object in the new Model object I wrote. What's the key to retrieve
response object from Roller's params Map?

The example I sent shows exactly how to do that:
   http://tinyurl.com/2pnpn3

The param name is "request"


Thanks so much.

Sure thing.

- Dave


Reply via email to