facebook

Importing a web app into MyEclipse

  1. MyEclipse IDE
  2.  > 
  3. Feature Requests
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #206593 Reply

    choppc
    Member

    I’ve been using the book “The Struts Framework” as a learning aid for learning to develop Struts-based Java web apps. I have Eclipse v2.1.7, MyEclipse v2.1 and JDK v1.3.1-11 on WinXP Pro SP1a. I also have Apache v2.x and Tomcat v4.1.3 on an OpenVMS Alpha system.

    The book has a companion web site from which a .war & .jar file are available for download. These files contain the sample application code for the application this is used as an example throughout the entire book.

    The URL is as follows:

    http://books.elsevier.com/us//mk/us/subindex.asp?maintarget=companions/defaultindividual.asp&isbn=1558608621&country=United+States&srccode=&ref=&subcode=&head=&pdf=&basiccode=&txtSearch=&SearchField=&operator=&order=&community=mk

    I’ve downloaded the strutspracticalguide.jar file from the URL http://books.elsevier.com/companions/1558608621/software/strutspracticalguide.jar

    After unpacking the .jar file, I’ve been trying to figure out how to get this project loaded into MyEclipse as a Web Module project but I’m at a loss as to how exactly it is that I go about doing this. So far, my approach has been to create a new Web Module application and then do perform an “Import -> File System” process. This hasn’t really resulted in any sort of success, however, as I am getting so many errors reported by the import process that I don’t even know where to begin to look to get these problems resolved.

    I would appreciate any tips, tricks, clues, etc… for getting this done.

    #206596 Reply

    Riyad Kalla
    Member

    Thank you for being so detailed with the links, I have downloaded the application to see how I can transpose it into MyEclipse.

    The biggest grouping of errors (90% of them) will be because the JSP pages are probably “outside of the webroot”. More specifically, this means that in your MyEclipse settings (Window > Preferences > MyEclipse > J2EE > Project Templates) you have specified a webroot directory (what will be deployed to your application server), the default is WebRoot, so lets assume its still WebRoot. Well this example app actually has all of its JSP files and such in a subdirectory “strutspg”. So the first problem is that when you load up this project in MyEclipse, it sees ALL your files under “strutspg” but on the same token, you told it that its webroot directory is “WebRoot”, so its complainging “Hey, all of your JSP files are not in my webroot”, so to solve that problem, just drag/drop the ENTIRE contents of “strutspg” into your “WebRoot” directory, and say yes to any overwrite warnings.

    Now things seem to be a bit happier, but you are probably still seeing a bunch of “cannot load class: cdmanager.tags.ValidateSessionTag”. The first part of this problem is that this project has its Java source directory under the “WebRoot” directory in “src”, so right click on your project properties, go to Java Build Path, click on the 1st tab ( source) and Edit that source entry to point to that dir… (or just move it) now hit OK, your source will rebuild.

    If you have strict compiler settings like I do, you probably see a bunch of unused imports now *shaking fist in frustration* but we don’t need to worry about that just yet. You might noticed that we are getting some class not found exceptions, that seems to be from missing log4j JAR, lets ig nore that. You might notice that you STILL have a bunch of missing tag errors, so lets select the project root, and go to the Project menu and select Rebuild Project. Now you should see 2 or 3 missing class errors and a BUNCH of unused imports… but none the less you should be ready to rock and roll at this point.

    IMO (and I’m not necessarily right) this project was setup kind of hap-hazardly and could benefit from some reorganization, but this should atleast get you in a position to play with it.

    #206597 Reply

    Riyad Kalla
    Member

    I cleaned up the project for you and created a zip for you to download and use:
    http://www.u.arizona.edu/~rsk/myeclipse/strutspg.zip

    Please note that my directions above might be slightly wrong, I hadn’t noticed the build directory or the missing TLD’s from the WEB-INF directory.

    #206614 Reply

    choppc
    Member

    Riyad,

    Thank you for the detailed analysis of what’s wrong with that project, as well as for the zip file that you posted with the fixes in it.

    I’m going to give it a try following your instructions to get the project fixed up, and then I’m going to go back and compare that
    with the zip file contents to see how closely my own attempts match your fixed up code.

    Once I get things working better, I’m going to contact the author of the book and discuss this with her as well. Although the book
    lays out the development of the application in a fairly structured manner, there is no discussion of the actual sample project itself.
    The lack of organization in the project’s code was causing me a great deal of confusion, and the last thing I need while trying to
    learn a language, an IDE and a deployment platform is poorly organized examples that don’t work as advertised.

    #206618 Reply

    Riyad Kalla
    Member

    I’m going to give it a try following your instructions to get the project fixed up, and then I’m going to go back and compare that
    with the zip file contents to see how closely my own attempts match your fixed up code.

    That’s a great idea. I think some of my description might be wrong, but that just makes it more of a challenge… like finding a hidden treasure! 🙂

    The lack of organization in the project’s code was causing me a great deal of confusion, and the last thing I need while trying to
    learn a language, an IDE and a deployment platform is poorly organized examples that don’t work as advertised.

    I agree. While the author *does* certain provide structure to the app, I don’t know that its the best. The app is also copied again into the /build dir which should ONLY be the side effect of a build script, I don’t know why it was included… that is very confusing.

    Good luck with your work!

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Importing a web app into MyEclipse

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