- This topic has 5 replies, 3 voices, and was last updated 12 years, 5 months ago by support-tony.
-
AuthorPosts
-
Rob SilverParticipantI recently tried to include an applicationconext.xml file located in the src folder
but have no idea how to specify the include for that folder.
I have been able to place such an applicationcontext.xml file in the webroot folder, one of the default folders by using relative path. e.g relative to the /webroot/WEB-INF where web.xml
is loaded from.
so webroot folder relative to WEB-INF folder is :
<import resource=”../applicationcontext.xml’/>
So how would I specify the path either relative to or absolute for the src folderfor example???This should be simple but it is not. It would really help to better understand the path settings across project folders.
support-swapnaModeratorrss245b,
Relative paths are relative to the current working directory, while absolute paths are relative to the root of the filesystem. In this case you will have to specify it as relative path.
If you are looking for a more detailed insight, then I suggest you cross post to development related forums for a better understanding on the workings.
Hope it helps.
Rob SilverParticipantI guess I was expecting information based on the defaults in place perhaps as a formula of
<Path to workspace>\ProjectName\WebRoot would be set up as absolute(within war file path) “/application.xml” assuming the Context Root folder is the key to all of this Assuming my Context Root is /MyProject1 and assuming the standard default setup on MyEclipse what folder does this context root point to? /src? no /MyProject1 ? no
So where does this apply? Give me a standard path assuming the Context Root mentioned and how would I describe absolute path given standard configuration
to the classes folder where message.properties bundle files should go?
This is the kind of detailed information I am seeking to better understand the absolute paths set up by a default configured MyEclipse web project
the relative path “../application.xml” is the WebRoot folder meaning
everything starts from WEB-INF folder but what is the absolute path to the WEB-INF folder then?
As this is not the standard path setup for Eclipse proper how might the file tree or
Project path configuration in standard Jee Eclipse or Eclipse be realized?
support-tonyKeymasterRob,
Eclipse, or MyEclipse, doesn’t determine the output paths, though, obviously, you can define the output path and context root folder for a web application. If you right-click on the project and select Properties, then MyEclipse->Web, you will see the Web-root folder (where MyEclipse expects to find the application binaries and resources to deploy to the web server) and the Web Context-root (used in the URL to address the application). In the Java Build Path page of the properties, you will see source folders defined and a default output folder (individual source folders may also override this default, though that’s unusual). The output folder defines where class files will be put and where resource files will be copied. Your application.xml file (did you mean applicationContext.xml?) that is in the src folder, will be copied to the output folder (by default, this is WebRoot/WEB-INF/classes) so that it will be on the application’s java classpath at runtime, after deployment. Every time you change a resource, the new version will be copied to the output folder.
Almost all of this is standard web development behavior, so it might be a good idea to read up on Web development, if you are not too familiar with it. MyEclipse simply provides the tools to make Web development easier and has some useful defaults when defining new Web projects. MyEclipse doesn’t dictate any particular application structure and will use your definitions (which are often defaulted).
I hope this helps.
Rob SilverParticipantWhat you just wrote helps a lot!
I now have a better idea where to place the properties files – Before I was keeping them
in WEB-INF folder where I should have kept them in the src folder as you suggest now the
question remains so my import tag should indicate
<import resource “classes/application.xml” /> or
<import resource “./classes/application.xml” /> should work in the Dispatcher-servlet.xml
file if I place the application.xml file in the src folder???
support-tonyKeymasterRob,
We try to help, even with questions that are not directly related to MyEclipse functionality, if they don’t involve much investigation and arise out of using MyEclipse, but we are not a general web development support site. I suggest you try such sites for general development questions; there are many of them.
In this case, I suggest trying a few different paths to see which works. I doubt that the “classes” directory should be part of the path, though.
-
AuthorPosts