facebook

XDoclet Questions [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #197612 Reply

    Eric Glass
    Member

    I was looking at a tutorial called “Enhance J2EE component reuse with XDoclet” from http://www.ibm.com/developerWorks for how to use XDoclet with Srevlets and JSP custom tags. I coded the examples, but instead of using the tutorials build script and project layout I used a MyEclipse Web Module and the built in support for XDoclet.

    I found the following questions.

    1) Is there any way to clean/delete the files that were generated by XDoclet in a previous run?
    I especially found this needed if you have generated a lot of interface and utility files for EJBs and decided to refactor the package names, then after the generation with XDoclet of the new interface and utility files I had to delete by hand the old ones.

    2) I would like to provide properties to the Ant XDoclet process, so after I have made any changes to the XDoclet process I edit te xdoclet-build.xml file and add the following element after the root <project element:
    <property file=”xdoclet-build.properties”/>
    I then have a file called xdoclet-build.properties that has my properties needed during the XDoclet process.
    Is there a better way of doing this?
    Should this be an enhancement?

    3) I do not know if this is a problem because I am using webdoclet or not, but I have a JSP page that uses a JSP custom tag that was developed in this project and I am getting “can not be resolved” errors for all of the variables for this custom tag. The JSP page works fine in the J2EE container, which is Tomcat 5.
    How can I get the JSP compiler to find the variables?

    I can send you the zipped up project, if you like.

    Thank you for your help.

    Eric

    #197617 Reply

    Scott Anderson
    Participant

    1) Is there any way to clean/delete the files that were generated by XDoclet in a previous run?

    At present, no there isn’t. But it’s a good enhancment request so I’ve entered it into our internal tracking system. This is a bit tricky because you never know what people are “really” doing with the generated code. 😉

    2) I would like to provide properties to the Ant XDoclet process, so after I have made any changes to the XDoclet process I edit te xdoclet-build.xml file and add the following element after the root <project element:
    <property file=”xdoclet-build.properties”/>
    Is there a better way of doing this?

    I’d suggest right clicking on the XDoclet build file and selecting “Run Ant…”. This will give you full control over the launch configuration, including setting properties. Just run with this technique instead.

    How can I get the JSP compiler to find the variables?

    The problem we see most often is that people forget to enter taglib uri to taglib location maps in web.xml. Additionally, the jars need to be in WEB-INF/lib and the tld’s need to be in WEB-INF and referenced properly from web.xml. There is one known problem regarding taglib recognition, but it only shows up if your project’s storage location is outside your workspace. For more details I’d suggest searching the forums for ‘tablib’ or ‘Struts’.

    –Scott
    MyEclipse Support

    #197632 Reply

    Eric Glass
    Member

    Hi Scott,

    The problem we see most often is that people forget to enter taglib uri to taglib location maps in web.xml.

    I do have the taglib mapped in the web.xml.

    Additionally, the jars need to be in WEB-INF/lib and the tld’s need to be in WEB-INF and referenced properly from web.xml.

    This project actually contains the source for the custom tag, so it is compiled and placed in the WEB-INF/classes folder.

    I am using a JSP in the same project to test out the custom tag.

    Do I have to package up the custom tag class into a JAR and place it into the WEB-INF/lib folder before I can use it with out any errors with the JSP editor?

    Eric

    #197636 Reply

    Scott Anderson
    Participant

    Eric,

    I do have the taglib mapped in the web.xml.
    Do I have to package up the custom tag class into a JAR and place it into the WEB-INF/lib folder before I can use it with out any errors with the JSP editor?

    Yes, according to the spec I believe you have to package the taglib properly and add the appropriate mappings in web.xml to map the uri to the location. Please give that a try and I believe you’ll be in good shape.

    –Scott
    MyEclipse Support

    #197665 Reply

    Eric Glass
    Member

    Hi Scott,

    I’d suggest right clicking on the XDoclet build file and selecting “Run Ant…”. This will give you full control over the launch configuration, including setting properties. Just run with this technique instead.

    Thank you so much for your response, because this worked a lot nicer, then me editing the xdoclet-build.xml file by hand.

    Yes, according to the spec I believe you have to package the taglib properly and add the appropriate mappings in web.xml to map the uri to the location. Please give that a try and I believe you’ll be in good shape.

    I packaged the JSP custom tag class into a JAR and placed the JAR in the WEB-INF/lib folder. I still get the “cannot be resolved” errors for the JSP that is used to test this custom tag, even after recompiling the JSP. I opened the JAR and made sure that it had the correct structure. I also made sure that the web.xml has a taglib mapping for the custom tag that is used by the JSP. The code assist works for the custom tag, it is just the compile comes up with these errors. The JSP compiles and runs with no errors in Tomcat 5.

    I was wondering how others are using MyEclipse to develop JSP custom tags?

    How do they test these JSP custom tags, in the same project or a different project?

    Thanks so much for your help so far!

    Eric

    #197667 Reply

    Scott Anderson
    Participant

    Eric,

    We just fixed a problem with recognition of taglibs, if the project was created outside the workspace (ie. not in the default location). Could this apply to one or both of your projects? If so, it will be fixed in the next service release.

    –Scott
    MyEclipse Support

    #197670 Reply

    Eric Glass
    Member

    Hi Scott,

    I created the project in the default location with the J2EE Web Module Project wizard.

    Eric

    #197676 Reply

    Scott Anderson
    Participant

    Eric,

    Can you send us a copy of the problematic project for further investigation? support@my…

    –Scott
    MyEclipse Support

    #197682 Reply

    Eric Glass
    Member

    Hi Scott,

    I found the problem!

    This project was part of the tutorial that I was putting together and I found that I was missing an attribute on the XDoclet @jsp.variable tag.

    The code assist for @jsp.variable did not show that there is the declare attribute that takes a boolean value; and this attribute is optional.

    I added the attribute declare=”true” to the three @jsp.variable tags, regenerated the .tld file, and recompiled the JSP.

    This got rid of the errors I was seeing!

    Just a note, I went to the XDoclet reference provided with MyEclipse Help and the link to the @web and @jsp tags failed. I was not connected to the Internet at the moment. I had to go to the XDoclet site on the Internet to find the documentation for the @web and @jsp tags.

    Thanks for all of your help!

    Eric

    #197685 Reply

    Scott Anderson
    Participant

    Eric,

    I added the attribute declare=”true” to the three @jsp.variable tags, regenerated the .tld file, and recompiled the JSP.

    This got rid of the errors I was seeing!

    That’s excellent news. Thanks for pushing through and determining the problem.

    MyEclipse Help and the link to the @web and @jsp tags failed

    I’ve entered this into our internal defect tracking system and it will be resolved in the next service release. Thanks for pointing it out.

    Thanks for all of your help!

    No problem, but I think you helped yourself more than I did. 🙂

    For those interested in the tutorial Eric refers to in this thread, Eric has been kind enough to allow us to share his findings with everyone. His tutorial will be come a featured article on the site within the next few days.

    –Scott
    MyEclipse Support

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: XDoclet Questions [Closed]

You must be logged in to post in the forum log in