• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Tomvat 5.5.11 having trouble finding Servlets

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys. I'm having a little trouble with Tomcat 5.5.11 and Servlets...

Basically I have a web based system which allows users to login and browse/upload/download images at will

I have created the basic JSPs and file structure
C:\Java\Tomcat 5.5\webapps\web
Java classes are under - C:\Java\Tomcat 5.5\webapps\web\WEB-INF\classes\uk\co\domain\...

Servlets are under a folder in here called [servlets]
C:\Java\Tomcat 5.5\webapps\web\WEB-INF\classes\uk\co\domain\servlets

I have written the LoginServlet and it is under the following above address and it works fine. But
I have a Servlet called UploadServlet for uploading images i the same folder, mapped in the web.xml (see below) and
called in the following form:

<form name="frmUploader" action="UploadServlet" method="POST">

Page just redirects to a 404 [The requested resource (/web/secure/dam/uploader/UploadServlet) is not available]

<servlet id="Servlet_1136308272594">
<servlet-name>LoginServlet</servlet-name>
<servlet-class>uk.co.domain.servlets.LoginServlet</servlet-class>
</servlet>
<servlet id="Servlet_1136308272595">
<servlet-name>UploadServlet</servlet-name>
<servlet-class>uk.co.domain.servlets.UploadServlet</servlet-class>
</servlet>

<servlet-mapping id="ServletMapping_1136308273704">
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
<servlet-mapping id="ServletMapping_1136308273705">
<servlet-name>UploadServlet</servlet-name>
<url-pattern>/UploadServlet</url-pattern>
</servlet-mapping>

As I say, the LoginServket works fine so why would the be a problem with the UploadServlet?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you look in your Tomcat logs for error messages?

What upload library are you using?
In order to upload files you need to set the enctype to multipart/form-data.


Is your upload library rejecting no-multipart requests?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think Secker had gone that for to the multi-part part. According to your description, Secker try giving the path as "/web", docBase as "web" in the Context.xml, something like this:
<Context path="/web" docBase="web" ...>
and calling the servlet this way:
<form name="yourformname" action="/web/UploadServlet" ...>
 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic