Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Eclipse not accepting taglib tag in web.xml
Eclipse not accepting taglib tag in web.xml [message #137890] Fri, 09 September 2005 17:40 Go to next message
Eclipse UserFriend
Originally posted by: neil.JAMMConsulting.com

Hello:

I am converting an existing struts based web app into an Eclipse WTP
project.

Eclipse does not like my web.xml, it gives me this error:

cvc-complex-type.2.4.a: Invalid content was found starting with element
'taglib'.
One of '{"http://java.sun.com/xml/ns/j2ee":description,
"http://java.sun.com/xml/ns/j2ee":display-name,
"http://java.sun.com/xml/ns/j2ee":icon,
"http://java.sun.com/xml/ns/j2ee":distributable,
"http://java.sun.com/xml/ns/j2ee":context-param,
"http://java.sun.com/xml/ns/j2ee":filter,
"http://java.sun.com/xml/ns/j2ee":filter-mapping,
"http://java.sun.com/xml/ns/j2ee":listener,
"http://java.sun.com/xml/ns/j2ee":servlet,
"http://java.sun.com/xml/ns/j2ee":servlet-mapping,
"http://java.sun.com/xml/ns/j2ee":session-config,
"http://java.sun.com/xml/ns/j2ee":mime-mapping,
"http://java.sun.com/xml/ns/j2ee":welcome-file-list,
"http://java.sun.com/xml/ns/j2ee":error-page,
"http://java.sun.com/xml/ns/j2ee":jsp-config,
"http://java.sun.com/xml/ns/j2ee":security-constraint,
"http://java.sun.com/xml/ns/j2ee":login-config,
"http://java.sun.com/xml/ns/j2ee":security-role,
"http://java.sun.com/xml/ns/j2ee":env-entry,
"http://java.sun.com/xml/ns/j2ee":ejb-ref,
"http://java.sun.com/xml/ns/j2ee":ejb-local-ref,
"http://java.sun.com/xml/ns/j2ee":service-ref,
"http://java.sun.com/xml/ns/j2ee":resource-ref,
"http://java.sun.com/xml/ns/j2ee":resource-env-ref,
"http://java.sun.com/xml/ns/j2ee":message-destination-ref,
"http://java.sun.com/xml/ns/j2ee":message-destination,
"http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is
expected.

Here is my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<!-- Standard Action Servlet Configuration (with debugging) -->
<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>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<!-- Application wide error pages -->
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error.do</location>
</error-page>

<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location >
</taglib>
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location >
</taglib>
<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location >
</taglib>
<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location >
</taglib>
<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location >
</taglib>

<!-- Do not allow users to load jsps directly -->
<security-constraint>
<web-resource-collection>
<web-resource-name>no_access</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>

</web-app>

Any ideas why this error is occurring?

Thanks,
Neil

--
Neil Aggarwal, JAMM Consulting, (214)986-3533, www.JAMMConsulting.com
FREE! Valuable info on how your business can reduce operating costs by
17% or more in 6 months or less! http://newsletter.JAMMConsulting.com
Re: Eclipse not accepting taglib tag in web.xml [message #137902 is a reply to message #137890] Fri, 09 September 2005 18:00 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
This web.xml would probably be valid for Servlet 2.3, but with Servlet
2.4, the schema requires that <taglib> elements be children of a
<jsp-config> element.

Cheers,
Larry

Neil Aggarwal wrote:
> Hello:
>
> I am converting an existing struts based web app into an Eclipse WTP
> project.
>
> Eclipse does not like my web.xml, it gives me this error:
>
> cvc-complex-type.2.4.a: Invalid content was found starting with element
> 'taglib'.
> One of '{"http://java.sun.com/xml/ns/j2ee":description,
> "http://java.sun.com/xml/ns/j2ee":display-name,
> "http://java.sun.com/xml/ns/j2ee":icon,
> "http://java.sun.com/xml/ns/j2ee":distributable,
> "http://java.sun.com/xml/ns/j2ee":context-param,
> "http://java.sun.com/xml/ns/j2ee":filter,
> "http://java.sun.com/xml/ns/j2ee":filter-mapping,
> "http://java.sun.com/xml/ns/j2ee":listener,
> "http://java.sun.com/xml/ns/j2ee":servlet,
> "http://java.sun.com/xml/ns/j2ee":servlet-mapping,
> "http://java.sun.com/xml/ns/j2ee":session-config,
> "http://java.sun.com/xml/ns/j2ee":mime-mapping,
> "http://java.sun.com/xml/ns/j2ee":welcome-file-list,
> "http://java.sun.com/xml/ns/j2ee":error-page,
> "http://java.sun.com/xml/ns/j2ee":jsp-config,
> "http://java.sun.com/xml/ns/j2ee":security-constraint,
> "http://java.sun.com/xml/ns/j2ee":login-config,
> "http://java.sun.com/xml/ns/j2ee":security-role,
> "http://java.sun.com/xml/ns/j2ee":env-entry,
> "http://java.sun.com/xml/ns/j2ee":ejb-ref,
> "http://java.sun.com/xml/ns/j2ee":ejb-local-ref,
> "http://java.sun.com/xml/ns/j2ee":service-ref,
> "http://java.sun.com/xml/ns/j2ee":resource-ref,
> "http://java.sun.com/xml/ns/j2ee":resource-env-ref,
> "http://java.sun.com/xml/ns/j2ee":message-destination-ref,
> "http://java.sun.com/xml/ns/j2ee":message-destination,
> "http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is
> expected.
>
> Here is my web.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> version="2.4">
>
> <!-- Standard Action Servlet Configuration (with debugging) -->
> <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>
> <init-param>
> <param-name>debug</param-name>
> <param-value>0</param-value>
> </init-param>
> <init-param>
> <param-name>detail</param-name>
> <param-value>0</param-value>
> </init-param>
> <load-on-startup>2</load-on-startup>
> </servlet>
>
> <!-- Standard Action Servlet Mapping -->
> <servlet-mapping>
> <servlet-name>action</servlet-name>
> <url-pattern>*.do</url-pattern>
> </servlet-mapping>
>
> <!-- The Welcome File List -->
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
>
> <!-- Application wide error pages -->
> <error-page>
> <exception-type>java.lang.Throwable</exception-type>
> <location>/error.do</location>
> </error-page>
>
> <!-- Struts Tag Library Descriptors -->
> <taglib>
> <taglib-uri>/tags/struts-bean</taglib-uri>
> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location >
> </taglib>
> <taglib>
> <taglib-uri>/tags/struts-html</taglib-uri>
> <taglib-location>/WEB-INF/struts-html.tld</taglib-location >
> </taglib>
> <taglib>
> <taglib-uri>/tags/struts-logic</taglib-uri>
> <taglib-location>/WEB-INF/struts-logic.tld</taglib-location >
> </taglib>
> <taglib>
> <taglib-uri>/tags/struts-nested</taglib-uri>
> <taglib-location>/WEB-INF/struts-nested.tld</taglib-location >
> </taglib>
> <taglib>
> <taglib-uri>/tags/struts-tiles</taglib-uri>
> <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location >
> </taglib>
>
> <!-- Do not allow users to load jsps directly -->
> <security-constraint>
> <web-resource-collection>
> <web-resource-name>no_access</web-resource-name>
> <url-pattern>*.jsp</url-pattern>
> </web-resource-collection>
> <auth-constraint/>
> </security-constraint>
>
> </web-app>
>
> Any ideas why this error is occurring?
>
> Thanks,
> Neil
>
Re: Eclipse not accepting taglib tag in web.xml [message #137940 is a reply to message #137902] Fri, 09 September 2005 20:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: neil.JAMMConsulting.com

Larry:

Is there a way to tell eclipse to use the servlet 2.3 spec?
My server is running Tomcat 5.0 and I dont want to go thru the
hassle of upgrading it.

Thanks,
Neil

Larry Isaacs wrote:
> This web.xml would probably be valid for Servlet 2.3, but with Servlet
> 2.4, the schema requires that <taglib> elements be children of a
> <jsp-config> element.
Re: Eclipse not accepting taglib tag in web.xml [message #137963 is a reply to message #137940] Fri, 09 September 2005 20:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jrduncans.stephenduncanjr.com

Neil Aggarwal wrote:
> Larry:
>
> Is there a way to tell eclipse to use the servlet 2.3 spec?
> My server is running Tomcat 5.0 and I dont want to go thru the
> hassle of upgrading it.
>
> Thanks,
> Neil
>
> Larry Isaacs wrote:
>
>> This web.xml would probably be valid for Servlet 2.3, but with Servlet
>> 2.4, the schema requires that <taglib> elements be children of a
>> <jsp-config> element.
>
>
>
>
Tomcat 5.0 supports the Servlet 2.4 spec. I think you'd be better off
just modifying your web.xml file to match the Servlet 2.4 spec.

However, if you really want to revert back to 2.3, you just need to fix
the web.xml to be declared as 2.3 instead of 2.4 (DOCTYPE with 2.3 dtd,
vs. 2.4 schema)

-Stephen
Re: Eclipse not accepting taglib tag in web.xml [message #137975 is a reply to message #137963] Fri, 09 September 2005 21:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: neil.JAMMConsulting.com

Stephen:

So, what you are saying is that Tomcat is allowing me to specify the 2.4 DTD
and
be sloppy.

I get your point. I will change my web.xml.

Thanks,
Neil

--
Neil Aggarwal, JAMM Consulting, (214)986-3533, www.JAMMConsulting.com
FREE! Valuable info on how your business can reduce operating costs by
17% or more in 6 months or less! http://newsletter.JAMMConsulting.com

"Stephen Duncan Jr" <jrduncans@stephenduncanjr.com> wrote in message
news:dfsra8$dba$1@news.eclipse.org...
> Tomcat 5.0 supports the Servlet 2.4 spec. I think you'd be better off
> just modifying your web.xml file to match the Servlet 2.4 spec.
>
> However, if you really want to revert back to 2.3, you just need to fix
> the web.xml to be declared as 2.3 instead of 2.4 (DOCTYPE with 2.3 dtd,
> vs. 2.4 schema)
>
> -Stephen
Re: Eclipse not accepting taglib tag in web.xml [message #137997 is a reply to message #137975] Fri, 09 September 2005 22:26 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
If you only change the web.xml, only the server will think the webapp is
2.3. WebTools will still think it's 2.4 since that is how it was
created. WebTools wouldn't let you test it with a Tomcat 4.1 server.

When you create a Dynamic Web Application, make sure the Advanced
section is displayed. It is there that you can select the module's J2EE
version. You may want to create a new 2.3 Dynamic Web Application and
copy your current content over.

You could compare ".*" files between the two and try to manually change
your current project to 2.3. However, I don't know if that might make
the project inconsistent with cached information that would lead to
erroneous behavior.

Larry

Neil Aggarwal wrote:
> Stephen:
>
> So, what you are saying is that Tomcat is allowing me to specify the 2.4 DTD
> and
> be sloppy.
>
> I get your point. I will change my web.xml.
>
> Thanks,
> Neil
>
Re: Eclipse not accepting taglib tag in web.xml [message #138296 is a reply to message #137997] Mon, 12 September 2005 14:47 Go to previous message
Chuck Bridgham is currently offline Chuck BridghamFriend
Messages: 35
Registered: July 2009
Member
Larry is describing some additional metadata that tracks the "module"
version, and should be changed as well. The .wtpmodules file uses the
<module-type module-type-id="jst.web">
<version>2.3</version> attribute, make sure you change this as
well.
The servlet schema didn't change too much between these versions, so you
should be fine....

- Chuck


Larry Isaacs <Larry.Isaacs@sas.com> wrote in
news:dft26d$lus$1@news.eclipse.org:

> If you only change the web.xml, only the server will think the webapp
> is 2.3. WebTools will still think it's 2.4 since that is how it was
> created. WebTools wouldn't let you test it with a Tomcat 4.1 server.
>
> When you create a Dynamic Web Application, make sure the Advanced
> section is displayed. It is there that you can select the module's
> J2EE version. You may want to create a new 2.3 Dynamic Web
> Application and copy your current content over.
>
> You could compare ".*" files between the two and try to manually
> change your current project to 2.3. However, I don't know if that
> might make the project inconsistent with cached information that would
> lead to erroneous behavior.
>
> Larry
>
Previous Topic:Excluding a file from a war
Next Topic:SSE Documentation?
Goto Forum:
  


Current Time: Wed Jan 15 04:49:14 GMT 2025

Powered by FUDForum. Page generated in 0.04468 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top