Can't get to JSP using getRequestDispatcher

My Servlet goGet method is as follows:

public void doGet (HttpServletRequest req, HttpServletResponse res)
   throws ServletException, IOException   {
        try {
                     RequestDispatcher rd = getServletContext().getRequestDispatcher("eei.jsp");
           rd.forward(req, res);

        } catch(Exception e) {

I am using Ant to build a war file that gets deployed.  Using
            <war destfile="in.war"

A few points
1) I deploy my jsp's in the top level (main) project folder in the war archive.
2) I tried it using the following line in my servlet and it failed also:
'RequestDispatcher rd = getServletContext().getRequestDispatcher("/eei.jsp");'

It works fine if I do all the following
1) Don't put my files in a war archive (copy them over directly - exploded) when I deploy.
2) Have a folder called "jsp" under my main project folder parallel to the WEB-INF folder and put my jsp's there.  
3) And use the line 'RequestDispatcher rd = getServletContext().getRequestDispatcher("/jsp/eei.jsp");' instead
of 'RequestDispatcher rd = getServletContext().getRequestDispatcher("eei.jsp");' in my servlet.

I need to make it work the first way though.
I am using Weblogic 9 application server.

Please help,


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mick BarryJava DeveloperCommented:
> 'RequestDispatcher rd = getServletContext().getRequestDispatcher("/eei.jsp");'

I would have thought that should work.

Have you checked that eei.jsp is in the root directory of your war

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mayank SAssociate Director - Product EngineeringCommented:
>> getServletContext().getRequestDispatcher("/jsp/eei.jsp");

Does that work when it is in the WAR (maybe that the JSP is not in the root directory of the WAR).
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.