• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Please help with web.xml problem

 
Ranch Hand
Posts: 58
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers,

I have run into a brick-wall and i don't seem to make any meaningful progress at all. My problem is a DD.
I have a servlet called "OnusReportServlet" saved in the path "WEB-INF/classes/reports/servlets".
The package declaration at the very top of the servlet source code is "package reports.servlets;".
The problem is when invoke the servlet using url "/onus.rpt" am getting "HTTP Status 404 - /onus.rpt" message.
The actual line of html code invoking the servlet is:
"<form name="reportForm" action="/onus.rpt" method="get">"

Here below is an excerpt from the DD. Please Help. What am i doing wrong?

<servlet>
<description></description>
<display-name></display-name>
<servlet-name>DownloadServlet</servlet-name>
<servlet-class>reports.servlets.DownloadServlet</servlet-class>
</servlet>

<servlet>
<servlet-name>Onus</servlet-name>
<servlet-class>reports.servlets.OnusReportServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>DownloadServlet</servlet-name>
<url-pattern>/reports.download</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Onus</servlet-name>
<url-pattern>/onus.rpt</url-pattern>
</servlet-mapping>
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the ServletsFaq for an entry on troubleshooting this issue.

Your form action looks very suspect.
 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bell,

Replace action="/onus.rpt" with action="onus.rpt" this will work.

Regards
Jatan bhavsar

 
Bell Katapa
Ranch Hand
Posts: 58
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey thanks,

The problem indeed was the form action. I removed the forward slash and it's now working.
Thanks guys,

Bell.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While that may have worked, it is not the correct solution. Page-relative actions are fragile and may stop working when minor changes are made elsewhere in the web app.

Action URLs, as well as URLs to resources such as images, should be server-relative URLs that begin with the context path.
reply
    Bookmark Topic Watch Topic
  • New Topic