having problem with RequestDispatcher

Discussion in 'Java' started by Joshua, Feb 9, 2007.

  1. Joshua

    Joshua Guest

    hi all.
    i am currently working with java-based blogging engine.
    it's presentation layer is based on struts framework.

    to make urls look tidy (www.myblog.com/entry/Test-Entry)
    i've been trying to use RequestDispatcher object to forward the
    incoming tidy url to our blog engine's native url (such as
    www.myblog.com/blog/entry/view.do?logTitle=Test-Entry).

    but it does not work at all.
    system yields the log below.

    - Invalid path /blog/entry/view was requested

    i don't have any idea.
    could anybody help me out?
    thanks.


    joshua song.
    Joshua, Feb 9, 2007
    #1
    1. Advertising

  2. Joshua

    Joshua Guest

    sorry i forgot something.
    i used this two lines of simple code:

    RequestDispatcher rq = request.getRequestDispatcher("/blog/entry/
    view.do?logTitle=Test-Entry");
    rq.forward(request, response);
    Joshua, Feb 9, 2007
    #2
    1. Advertising

  3. Joshua

    Lew Guest

    Joshua wrote:
    > sorry i forgot something.
    > i used this two lines of simple code:
    >
    > RequestDispatcher rq = request.getRequestDispatcher("/blog/entry/
    > view.do?logTitle=Test-Entry");
    > rq.forward(request, response);


    When you get the RD from request it cannot step outside the current context
    root. You have to get the ServletContext of the other context root, then call
    ServletContext.getRequestDispatcher(java.lang.String) on it.

    - Lew
    Lew, Feb 9, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Vincent Craven

    Multiple includes with RequestDispatcher

    Paul Vincent Craven, Aug 29, 2003, in forum: Java
    Replies:
    0
    Views:
    646
    Paul Vincent Craven
    Aug 29, 2003
  2. Will Handley
    Replies:
    1
    Views:
    571
    Nigel Wade
    Dec 10, 2003
  3. Ryan Stewart

    RequestDispatcher.include() behavior

    Ryan Stewart, May 20, 2004, in forum: Java
    Replies:
    0
    Views:
    478
    Ryan Stewart
    May 20, 2004
  4. DiscoStu
    Replies:
    1
    Views:
    500
    Erwin Moller
    Jul 20, 2004
  5. John English
    Replies:
    6
    Views:
    3,913
    Andrea Desole
    Jul 19, 2005
Loading...

Share This Page