You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Thom Hehl <th...@nowhereatall.com> on 2006/01/09 01:17:10 UTC

First webapp/JSP

OK, I've looked through the docs and googled and I'm not having any luck 
with this.

I have a brand new servlet for my webapp. I have it connected up and 
running OK.

The problem is the forward to the JSP. I'm getting this error:


  HTTP Status 404 - /visioneer/WEB-INF/SearchErrors.jsp

------------------------------------------------------------------------

*type* Status report

*message* _/visioneer/WEB-INF/SearchErrors.jsp_

*description* _The requested resource 
(/visioneer/WEB-INF/SearchErrors.jsp) is not available._

------------------------------------------------------------------------

Here is the URL that calls my servlet:

http://localhost:81/visioneer/controller

And here is the code in my servlet:

    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
      throws IOException, ServletException
    {
        //retrieve the session
        HttpSession session = request.getSession();

        String act=request.getParameter(PARM_ACTION);

        if(act==null)
        {
            String url = "/visioneer/WEB-INF/SearchErrors.jsp";
            RequestDispatcher dispatcher =
                    getServletContext().getRequestDispatcher(url);
            dispatcher.forward(request, response);
            return;
        }
}

And in my tomcat directory, I have 
webapps/visioneer/WEB-INF/SearchErrors.jsp.

I have also tried my forward as: "/visioneer/SearchErrors.jsp"

I don't know what to try next and need advice.

Thanks.


Thom Hehl
Heavyweight Software for Heavyweight Needs
www.heavyweightsoftware.com
-- 
"In every revolution, there is one man with a vision."--Jerome Bixby



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: First webapp/JSP

Posted by Thom Hehl <th...@nowhereatall.com>.
Wow! Thanks, that's it. I started without that, but added it when I was 
having problems.

Thanks again!

Wendy Smoak wrote:

>On 1/8/06, Thom Hehl <th...@nowhereatall.com> wrote:
>
>  
>
>>        String url = "/visioneer/HomeSearch.jsp";
>>        RequestDispatcher dispatcher =
>>                getServletContext().getRequestDispatcher(url);
>>        dispatcher.forward(request, response);
>>
>>And I now get this error:
>>
>>*type* Status report
>>
>>*message* _/visioneer/HomeSearch.jsp_
>>    
>>
>
>In general, you should not be hard-coding the name of the context in your app.
>
>http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)
>
>"The pathname must begin with a "/" and is interpreted as relative to
>the current context root."
>
>So leave off the 'visioneer' part, (which is the context name,) start
>with / and then give the path to the resource, depending on where you
>moved it to.
>
>HTH,
>--
>Wendy
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>  
>


Thom Hehl
Heavyweight Software for Heavyweight Needs
www.heavyweightsoftware.com
-- 
"In every revolution, there is one man with a vision."--Jerome Bixby



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: First webapp/JSP

Posted by Wendy Smoak <ws...@gmail.com>.
On 1/8/06, Thom Hehl <th...@nowhereatall.com> wrote:

>         String url = "/visioneer/HomeSearch.jsp";
>         RequestDispatcher dispatcher =
>                 getServletContext().getRequestDispatcher(url);
>         dispatcher.forward(request, response);
>
> And I now get this error:
>
> *type* Status report
>
> *message* _/visioneer/HomeSearch.jsp_

In general, you should not be hard-coding the name of the context in your app.

http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)

"The pathname must begin with a "/" and is interpreted as relative to
the current context root."

So leave off the 'visioneer' part, (which is the context name,) start
with / and then give the path to the resource, depending on where you
moved it to.

HTH,
--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: First webapp/JSP

Posted by Thom Hehl <th...@nowhereatall.com>.
Thanks for the response. I moved my JSPs to /visioneer and modified my 
forward to:

        String url = "/visioneer/HomeSearch.jsp";
        RequestDispatcher dispatcher =
                getServletContext().getRequestDispatcher(url);
        dispatcher.forward(request, response);

And I now get this error:

*type* Status report

*message* _/visioneer/HomeSearch.jsp_

*description* _The requested resource (/visioneer/HomeSearch.jsp) is not 
available.

_



Mark Thomas wrote:

>Thom Hehl wrote:
>  
>
>>OK, I've looked through the docs and googled and I'm not having any luck
>>with this.
>>
>>I have a brand new servlet for my webapp. I have it connected up and
>>running OK.
>>
>>The problem is the forward to the JSP. I'm getting this error:
>>
>>
>> HTTP Status 404 - /visioneer/WEB-INF/SearchErrors.jsp
>>    
>>
>
>The servlet spec requires that no resources are served from the
>WEB-INF directory for security reasons. Move the jsp to
>/visioneer/SearchErrors.jsp and all should be fine.
>
>mark
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>  
>


Thom Hehl
Heavyweight Software for Heavyweight Needs
www.heavyweightsoftware.com
-- 
"In every revolution, there is one man with a vision."--Jerome Bixby



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: First webapp/JSP

Posted by Wendy Smoak <ws...@gmail.com>.
On 1/8/06, Mark Thomas <ma...@apache.org> wrote:

> The servlet spec requires that no resources are served from the
> WEB-INF directory for security reasons. Move the jsp to
> /visioneer/SearchErrors.jsp and all should be fine.

But he's forwarding to it, which is allowed.

I think it should be:
   String url = "/WEB-INF/SearchErrors.jsp";

(I would move it to WEB-INF/jsp/SearchErrors.jsp though.)

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: First webapp/JSP

Posted by Mark Thomas <ma...@apache.org>.
Thom Hehl wrote:
> OK, I've looked through the docs and googled and I'm not having any luck
> with this.
> 
> I have a brand new servlet for my webapp. I have it connected up and
> running OK.
> 
> The problem is the forward to the JSP. I'm getting this error:
> 
> 
>  HTTP Status 404 - /visioneer/WEB-INF/SearchErrors.jsp

The servlet spec requires that no resources are served from the
WEB-INF directory for security reasons. Move the jsp to
/visioneer/SearchErrors.jsp and all should be fine.

mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org