Use RequestDispatcher object from ServletContext to have an absolute path, instead of getting it from HttpServletRequest.
e.g., getServletContext().getRequestDispatcher("/mycontext/myservlet/images/img1.g if,"); HTH John -----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED] Behalf Of Jen Sent: Tuesday, June 17, 2003 1:49 AM To: [EMAIL PROTECTED] Subject: Re: Using Response.sendRedirect() --- how to avoid 302 Thanks. The problem is when i use the forward, all the static stuff like images have relative path, so the call becomes /myservlet/images/img1.gif, sure it won't work. --- John Arockiaraj <[EMAIL PROTECTED]> wrote: > Hi, > > you can think of using > RequestDispatcher.forward(...) call > instead of sendRedirect(...) > > HTH > John > > -----Original Message----- > From: A mailing list for discussion about Sun > Microsystem's Java Servlet > API Technology. > [mailto:[EMAIL PROTECTED] Behalf Of > Jen > Sent: Thursday, June 12, 2003 3:39 AM > To: [EMAIL PROTECTED] > Subject: Re: Using Response.sendRedirect() --- how > to avoid 302 > > > Hi, > In my application I use sendRedirect to serve all > the > pages because all my images in the jsp have relative > path. I have a client reported that he got a page > says > "Thid document you requested has moved temporarily" > and supply a link, so basicly he has to click all > the > links to nav my site. > How to avoid that? Thanks > > --- John Arockiaraj <[EMAIL PROTECTED]> wrote: > > Hi, > > > > You can still manage the session while redirecting > > to another > > resource(jsp/servlet/html) > > on your server. > > HttpServletResponse.sendRedirect(...) can be > > considered as > > another > > client request via browser. > > > > Note 1 : Using sendRedirect(), you can jump to > even > > another domain. > > > > e.g., if www.yourhost.com is your > > domain, you can redirect to > > www.myhost.com > > > > Note 2 : Good coding practice is to call the > > 'encodeRedirectURL' method > > before sending > > the URL to the output stream: > > > > response.sendRedirect > > (response.encodeRedirectURL > > ("http://myhost/app/module")); > > (This encoding is also useful in maintaining > session > > in case yours is > > cookie-based > > or url-rewriting based session management) > > > > > > HTH > > John > > > > > > -----Original Message----- > > From: A mailing list for discussion about Sun > > Microsystem's Java Servlet > > API Technology. > > [mailto:[EMAIL PROTECTED] Behalf Of > > raj > > Sharma > > Sent: Tuesday, June 10, 2003 7:26 PM > > To: [EMAIL PROTECTED] > > Subject: Using Response.sendRedirect() > > > > > > Hi, > > > > Will the session variables be available in the > > page where I send by > > response.sendRedirect() to the other page? > > > > > > Raj > > > > > ___________________________________________________________________________ > > To unsubscribe, send email to > [EMAIL PROTECTED] > > and include in the body > > of the message "signoff SERVLET-INTEREST". > > > > Archives: > > > http://archives.java.sun.com/archives/servlet-interest.html > > Resources: > > > http://java.sun.com/products/servlet/external-resources.html > > LISTSERV Help: > > http://www.lsoft.com/manuals/user/user.html > > > > > ___________________________________________________________________________ > > To unsubscribe, send email to > [EMAIL PROTECTED] > > and include in the body > > of the message "signoff SERVLET-INTEREST". > > > > Archives: > > > http://archives.java.sun.com/archives/servlet-interest.html > > Resources: > > > http://java.sun.com/products/servlet/external-resources.html > > LISTSERV Help: > > http://www.lsoft.com/manuals/user/user.html > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Calendar - Free online calendar with sync to > Outlook(TM). > http://calendar.yahoo.com > > ___________________________________________________________________________ > To unsubscribe, send email to [EMAIL PROTECTED] > and include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: > http://archives.java.sun.com/archives/servlet-interest.html > Resources: > http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: > http://www.lsoft.com/manuals/user/user.html > > ___________________________________________________________________________ > To unsubscribe, send email to [EMAIL PROTECTED] > and include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: > http://archives.java.sun.com/archives/servlet-interest.html > Resources: > http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: > http://www.lsoft.com/manuals/user/user.html > __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html