You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Mok <mi...@consultech.net.au> on 2000/08/25 09:45:29 UTC

How to forward to a servlet?

Hi

Somebody may have already answered this but here a simple question.

1) created a servlet called  com.consultech.web.booking.WebBureauServlet. In
the doPost method of this servlet, I simply output text to the browser (ie

 	  Writer w = response.getWriter();
    	  w.write("Hello world");

2) Add the servlet entry into web.xml. eg

  <servlet>
    <servlet-name>webbureau</servlet-name>

<servlet-class>com.consultech.web.booking.WebBureauServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

3) created a index.jsp and added this link. Eg

<li><struts:link href="webbureau">Web Bureau Test</struts:link>

4) Built the .war file and deployed to the webapps directory of Tomcat.

Tomcat loaded my website find and displays the index.jsp. But when I click
on the Web Bureau Text, Tomcat could not find the servlet. Any idea how I
should configure this to get my servlet to display the message?

Thanks in advance.

Michael Mok