aspose file tools*
The moose likes Servlets and the fly likes Web.xml files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Web.xml files" Watch "Web.xml files" New topic
Author

Web.xml files

Brian Mulvany
Greenhorn

Joined: Oct 19, 2004
Posts: 28
Hi
I have created several Java classes that will search http://www.cdwow.com for cds by an artist or album name and will parse some of the information. The search it carries out on the site is dependant on what the runtime paramaters for the program are set to.
I have created a servlet (in a seperate package)in JBuilder that has a shtml form. I enter a value in this form and this value is used as a paramater for the package with all the parsing classes. This works in JBuilder. So when I enter in U2 in the shtml form it will search CDWow for cds by U2.
I want to get this working outside JBuilder. I see somebody mentioned you have to change the web.xml file so it will work for whatever file you are trying to create.
When I try and request the shtml file by typing in the following
http://localhost:8080/webapp/servlet1.shtml
it says it cannot find the file, but if I resave the form as form.html it can find that and it works grand in JBuilder. But as the web.xml file is set up for shtml the html version wont work. So I was thinking if I alterthe xml file to work for html it might work.

There are two parts of the code that might need changing included below.

<servlet-mapping>
<servlet-name>shtml</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>shtml</servlet-name>
<servlet-class>com.borland.jbuilder.webserverglue.shtml.ShtmlLoaderEcho</servlet-class>


Thanks
Brian
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
See the tomcat docs.
If 5.0 see http://jakarta.apache.org/tomcat/tomcat-5.0-doc/index.html.

Moreover, you should download servlet spec, and jsp spec from java.sun.com. Read about web.xml and its elements.
[ March 06, 2005: Message edited by: Adeel Ansari ]
 
Consider Paul's rocket mass heater.
 
subject: Web.xml files