This is a pain, but, you can do it using HttpServletRequest 
getContextPath() to always ensure the corrent context path is there. i.e.:

response.sendRedirect(request.getContext()+"/web/" + nextPage);

Now, the shameless plug. Keep an eye on http://www.jspbook.com. Kevin 
Jones and I have been working hard to put out a good, bleeding-edge book 
on JSP 2.0 and Servlets 2.4(it will be out soon but after the specs are 
final of course ;). This issue gets a direct mention :)

Cheers,

Jayson Falkner
[EMAIL PROTECTED]

charlie arehart wrote:
> Dave, did you ever find an answer to this?  I'd be curious about it myself
> 
> /charlie
> 
> PS Can't do any testing to offer answers due a recent crash I'm in the midst
> of recovering from.
> 
> 
>>-----Original Message-----
>>From: Dave Jones [mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, July 24, 2002 3:02 PM
>>To: JRun-Talk
>>Subject: sendRedirect + relative path = bug?
>>
>>
>>In another in the series of travails in converting an app from
>>Tomcat to JRun, I've run into what seems to be a bug in JRun's
>>implementation of sendRedirect.
>>
>>For example, the following statement:
>>
>>response.sendRedirect("../web/" + nextPage);
>>
>>throws the error:
>>
>>404 Not found
>>http://hostname/servlet/../web/Dispatch.jsp?page=ProspectMaint.jsp
>>&reset=true
>>
>>This works fine in Tomcat, but it seems pretty clear JRun is not
>>resolving the relative path.
>>
>>Changing the statement to use an absolute path (e.g. "/web/")
>>works, but since the absolute path resolves to the server root
>>rather than context root, I prefer to use relative addressing so
>>that I can easily move the app between development, staging and
>>production environments.
>>
>>Is this a bug or are things done differently in the JRun world?
>>
>>TIA,
>>Dave Jones
>>NetEffect
>>
>>
> 
> 
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to