On Thu, 12 Jul 2001, Kevin HaleBoyes wrote:
> First off, I'm running Tomcat 4b5 (standalone) on Linux RedHat 7.1.
>
> I've been looking at (and learning from) the Java Pet Store from Sun and
> have been writing some custom Taglibs for my application. I'm currently doing
> lists of things that use the NextFormTag and PrevFormTag extensions from
> a jsp file/program. These tags generate <form> elements to move to the next
> and previous pages where you specify the "action" of the form. Here is an
> example (snippet):
>
> <opf:prevForm action="/cust/listorders">
> <input type="submit" value="Prev" name="Prev"/>
> </opf:prevForm>
> <opf:nextForm action="/cust/listorders">
> <input type="submit" value="Next" name="Next"/>
> </opf:nextForm>
>
> This generates the following HTML output:
>
> <form method="GET" action="/cust/listorders">
> <input type="hidden" name="orderlist_startIndex" value="5">
> <input type="hidden" name="orderlist_next" value="true">
> <input type="submit" value="Next" name="Next"/>
> </form>
>
> I'm having trouble specifying the action element of the form. From above,
> listorders is actually a JSP file. I need to provide a mapping from the
> actual JSP file "/cust/listorders.jsp" to "/cust/listorders" but I'm not sure
> how to go about it.
>
> I tried to put the following in my web.xml file but it didn't work:
>
> <servlet>
> <servlet-name>listorders</servlet-name>
> <servlet-class>/cust/listorders.jsp</servlet-class>
> </servlet>
>
This is close but not quite right. Try:
<servlet>
<servlet-name>listorders</servlet-name>
<jsp-file>/cust/listorders.jsp</jsp-file>
</servlet>
> <servlet-mapping>
> <servlet-name>listorders</servlet-name>
> <url-pattern>/cust/listorders</url-pattern>
> </servlet-mapping>
>
> When I click the Next button I get the following in my browser:
>
> HTTP Status 404 - /cust/listorders
> The requested resource (/cust/listorders) is not available.
>
>
> Can anyone help? I searched the archives at mikal but didn't come up with
> anything that was applicable.
>
As someone else pointed out, you could also have modified your actions to
be the name of the JSP page instead (/cust/listorders.jsp).
> Many thanks,
> Kevin.
>
Craig McClanahan