This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes filter, forward,ajax call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "filter, forward,ajax call" Watch "filter, forward,ajax call" New topic
Author

filter, forward,ajax call

Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 147
I have a request to my site, intercept it, and since I know there is nothing, I forward request to valid address



Then it arrives to the exact page that I want. On that page java script:


Now the prob is that ajax no longer calls to
catchAjaxRequest.jsp
but instead to
gallery/catchAjaxRequest.jsp
which does not exist there.

Any advice ?

I guess I have to change request, before I forward the whole thing ?


Searchable nature photo gallery: http://agrozoo.net/jsp/Galery.jsp?l2=en
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Moving to Servlets.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Markas Korotkovas
Greenhorn

Joined: Jan 27, 2011
Posts: 21

In your second snippet you have "catchAjaxRequest.jsp" which is relative path, so when making the request the whole context is included (everything after the domain in your URL). In order to exclude the context add a / like this "/catchAjaxRequest.jsp". This will result in a URL like yourdomain.com/catchAjaxRequest.jsp which is what you are looking for i think.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

The URL should start with the context path of the web application, which is not necessarily just /.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 147
Thank you both. That was helpful.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: filter, forward,ajax call
 
Similar Threads
escaping url, sitemap, filter
Designing a shopping cart
Value shows up in url
How To "Forward Request" in JSP
Servlet chaining