This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet and XML file..

 
Chuck Meduri
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I created a xml file (web.xml) which is given below as shown in the book
******************************************************
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<servlet-name>
ShowMsg
</servlet-name>

<servlet-class>
coreservlets.ShowMessage
</servlet-class>

<init-param>
<param-name>
message
</param-name>
<param-value>
Chakravarthy
</param-value>
</init-param>

<init-param>
<param-name>
repeats
</param-name>
<param-value>
5
</param-value>
</init-param>
</servlet>
</web-app>
**************************************************
I am trying to use the elements in here in a servlet. This is an example that I trying a book ( Coreservlets and JSP by Marty Hall). When I put this web.xml in the d:\resin1.2.1\doc\web-inf directory and start the resin server, it gives me a error saying...
CANNOT MIX TEXT AND ELEMENTS AT WEB-APP followed by a bunch of exceptions.
I do not know any XML and I just started learning servlets..
Could somebody help me?
Chuck
 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I don't know much about resin, but most servers have a webapps directory(for Web Applications) then under it there are the application directories (usually the name of the application, like MyCatalog) under the application directories there are the Web-inf directories. And then classes and lib such. Maybe you can try tomcat if you really can't get resin to work.
[This message has been edited by Bob Moranski (edited December 22, 2000).]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks to me like it is objecting to something about the formatting in the web.xml file. You need to find an XML checking utility to make sure it is well formed. Unfortunately, the one I use (Clip) seems to have gone out of business!
You might try closing up the tags like this:
<init-param><param-name>message</param-name>
<param-value>Chakravarthy</param-value>
</init-param>
just in case the server is not trimming blanks from the values.
(just a guess)
Bill

------------------
author of:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic