Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5846
  • Last Modified:

Element type "servlet" must be followed by either attribute specifications, ">" or "/>"

Hi, I am using Tomcat 4.0.

Followed is the content I put in Web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>
<servlet>
<servlet&#8722;name>action</servlet&#8722;name>
<servlet&#8722;class>org.apache.struts.action.ActionServlet</servlet&#8722;class>
<init&#8722;param>
<param&#8722;name>config</param&#8722;name>
<param&#8722;value>/WEB&#8722;INF/struts&#8722;config.xml</param&#8722;value>
</init&#8722;param>
<load&#8722;on&#8722;startup>1</load&#8722;on&#8722;startup>
</servlet>
<servlet&#8722;mapping>
<servlet&#8722;name>action</servlet&#8722;name>
<url&#8722;pattern>*.do</url&#8722;pattern>
</servlet&#8722;mapping>
</web-app>


When I run "startup" in the command prompt, it shows something like this:

Starting service Tomcat-Standalone
Apache Tomcat/4.0.1
PARSE error at line 9 column 9
org.xml.sax.SAXParseException: Element type "servlet" must be followed by either
 attribute specifications, ">" or "/>".
Starting service Tomcat-Apache
Apache Tomcat/4.0.1

How to solve it?
0
william007
Asked:
william007
  • 3
  • 2
  • 2
1 Solution
 
suprapto45Commented:
Hi,

Why do you have all those "&#8722;"?
Try to remove them and try again.

Thanks
David
0
 
suprapto45Commented:
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>

0
 
avinthmCommented:
use this
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>
    <servlet>
        <servletname>action</servletname>
            <servletclass>org.apache.struts.action.ActionServlet</servletclass>
                <initparam>
                    <paramname>config</paramname>
                        <paramvalue>/WEBINF/strutsconfig.xml</paramvalue>
                </initparam>
                <loadonstartup>1</loadonstartup>
    </servlet>
    <servletmapping>
        <servletname>action</servletname>
            <urlpattern>*.do</urlpattern>
    </servletmapping>
</web-app>

your web.xml had some extra characters all over "&#8722;"
i just removed them
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
avinthmCommented:
oops.....i m late.
suprapto45 is right.
0
 
william007Author Commented:
Thanks:-)
0
 
william007Author Commented:
I am using emeditor, I type -, and it "helps" me to change to"&#8722;", What a strange behaviour.
0
 
suprapto45Commented:
hi,

Thanks for accepting. It would be good if you use a more *sophisticated* IDE such as Eclipse to help you.

David
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now