2010/2/14 David Short <dsh...@san.rr.com> > Thank you Juha. The <c:url value='/AuthLogin'/>" works nicely. > > -----Original Message----- > From: Juha Laiho [mailto:juha.la...@iki.fi] > Sent: Sunday, February 14, 2010 8:49 AM > To: users@tomcat.apache.org > Subject: Re: Tomcat not seeing servlet > > On 02/14/2010 06:21 PM, David Short wrote: > > "./AuthLogin" and "AuthLogin" still don't work. > > > > It works with the fully qualified path > > "http://yourserver:port/yourwebapp/AuthLogin" or "../../AuthLogin" > > Ah, yes, that completes the picture. And below I'll > somewhat repeat what Konstantin already explained, but > perhaps in a little bit different way. > > The url-patterns you set in web.xml are relative to the > application (context) root: > > >> <servlet-mapping> > >> <servlet-name>AuthLoginServlet</servlet-name> > >> <url-pattern>/AuthLogin</url-pattern> > >> </servlet-mapping> > > .. which means that the full URL for the above servlet will be > http://server:port/contextroot/AuthLogin > > However, URLs you set in jsp:s are "true" URLs, which means > that the /AuthLogin in your jsp form is not relative to > the application root: > > >> Login.jsp snippet: > >> <form name="login" method="post" action="/AuthLogin"> > > ... /AuthLogin here refers to > http://server:port/AuthLogin > > The proposed forms > > <form name="login" method="post" action="AuthLogin"> > > <form name="login" method="post" action="./AuthLogin"> > > would both refer to > http://server:port/yourwebapp/path_to_Loginjsp/AuthLogin > > ... where, apparently the path_to_Loginjsp in your case > has two levels of directories. To make either of the above > forms work, your url-pattern for the AuthLoginServlet would > have to be > <url-pattern>/path_to_Loginjsp/AuthLogin</url-pattern> > ... and this would pretty much be the easiest way to solve > the problem; with this, your JSP could really have the > form action as plain "AuthLogin". > > The JSTL tag library does also contain a tag "c:url", which > helps in making URLs that refer to the application itself; > that would be another solution if your application already > uses JSTL. For an explanation, see f.ex. > http://www.ibm.com/developerworks/java/library/j-jstl0318/ > -- > ..Juha > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
-- MBA Ing. Ugo Ojeda del Arco Gerente de Desarrollo de Sistemas Universidad del Pacifico Telf. 2190100 - 2228 / 2161 PD Tarda 7 segundos en imprimir este email y 7 años en crecer el árbol que servirá para hacer el papel.