- This topic has 5 replies, 2 voices, and was last updated 19 years, 11 months ago by Riyad Kalla.
-
AuthorPosts
-
zzzz8MemberHi,
(Forgive me as I’m new to MyEclipse… I’m probably setting something incorrectly.)
I’m having problems getting MyEclipse/XDoclet to generate the correct schema declaration – i.e. web-app element (with the correct namespace) for my web application. – Servlets 2.3 uses a DTD while 2.4 uses a namespace declaration in the web-app element. I specify a servletspec of 2.4 (in the properties of my project, under MyEclipse-Xdoclet, using the standard webdoclet configuration, under deploymentdescriptor, and under Servletspec), but every time I run Xdoclet in Eclipse/MyEclipse, I get the following in my web.xml file:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN” “http://java.sun.com/dtd/web-app_2_3.dtd”>
…
I should be getting something like this:
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<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″>What’s going on here? Thanks.
Riyad KallaMemberHere’s what I did (please try it on your end, make sure it works):
0) Eclipse 3.0.1, MyEclipse 3.8.4QF2
1) Created new Web Project
2) Erased the generated web.xml file
3) Right clicked on Project root, MyEclipse-XDoclet, right click Add Standard > Web
4) Select Web, select “deploymentdescriptor” doclet below, changed version from 2.3 to 2.4, hit Apply then OK.
5) Right click on Project, MyEclipse > Run XDoclet
6) Ended up with the following web.xml file:<?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"> <distributable/> <!-- To use non XDoclet filters, create a filters.xml file that contains the additional filters (eg Sitemesh) and place it in your project's merge dir. Don't include filter-mappings in this file, include them in a file called filter-mappings.xml and put that in the same directory. --> <!-- To use non XDoclet filter-mappings, create a filter-mappings.xml file that contains the additional filter-mappings and place it in your project's merge dir. --> <!-- To use non XDoclet listeners, create a listeners.xml file that contains the additional listeners and place it in your project's merge dir. --> <!-- To use non XDoclet servlets, create a servlets.xml file that contains the additional servlets (eg Struts) and place it in your project's merge dir. Don't include servlet-mappings in this file, include them in a file called servlet-mappings.xml and put that in the same directory. --> <!-- To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir. Organize mime-mappings.xml following this DTD slice: <!ELEMENT mime-mapping (extension, mime-type)> --> <!-- To specify error pages, create a file named error-pages.xml, put it in your project's mergedir. Organize error-pages.xml following this DTD slice: <!ELEMENT error-page ((error-code | exception-type), location)> --> <!-- To add taglibs by xml, create a file called taglibs.xml and place it in your merge dir. --> <!-- To set up security settings for your web app, create a file named web-security.xml, put it in your project's mergedir. Organize web-security.xml following this DTD slice: <!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)> <!ELEMENT web-resource-collection (web-resource-name, description?, url-pattern*, http-method*)> <!ELEMENT web-resource-name (#PCDATA)> <!ELEMENT url-pattern (#PCDATA)> <!ELEMENT http-method (#PCDATA)> <!ELEMENT user-data-constraint (description?, transport-guarantee)> <!ELEMENT transport-guarantee (#PCDATA)> <!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)> <!ELEMENT auth-method (#PCDATA)> <!ELEMENT realm-name (#PCDATA)> <!ELEMENT form-login-config (form-login-page, form-error-page)> <!ELEMENT form-login-page (#PCDATA)> <!ELEMENT form-error-page (#PCDATA)> --> </web-app>
So this *should* work. What version of Eclipse & MyEclipse are you using?
zzzz8MemberI’m using version 3.8.4-BetaFor3.1… And I used your instructions….
Riyad KallaMemberWe cannot reproduce this interally.
1) Are you on Linux or Windows?
2) Make sure you are setting the destDir property of the doclet to your WEB-INF dir.
3) Related to #2, make sure you aren’t generating the web.xml file somewhere else and accidentally opening up an old web.xml file under the WEB-INF dir over and over again.
4) Switch to the Build Tab of your MyEclipse-XDoclet settings and select the “Generate xdoclet-build.xml” policy then post the file contents here for me to see (be sure to use the “Code” button below and then past the contents between the code blocks).
zzzz8MemberHi Riyad,
Setting the destdir to WEB-INF dir solved the problem… I guess I can’t save the web.xml anywhere but WEB-INF. Anyway, I’m on Windows XP Pro. So there’s no way of getting around this (other than manually moving/copying the file to another directory)? BTW, as a side question (and newbie) – does MyEclipse require me to use the WebRoot directory structure? Can I place my .jsp files, web.xml, and any other files in places not under WebRoot? Thanks.
Riyad KallaMemberI guess I can’t save the web.xml anywhere but WEB-INF
Why not? When I ran my test it generated it into the /src dir. Just change the destDir whereever you want it to go.
does MyEclipse require me to use the WebRoot directory structure? Can I place my .jsp files, web.xml, and any other files in places not under WebRoot?
You *can* put them other places but this will cause deployment, editing, taglib resolution, autocomplete and other MyEclipse facilities to act irradically. If you do not use taglibs at all then you might not notice the problem, but if your site is taglib heavy I highly suggest sticking to the typical webapp layout. We are going to continue to loosen this requirement in the future (we know it doesn’t fit everyone’s style).
-
AuthorPosts