I am trying to include background image in my JSP using external stylesheet.But when I run my tomcat server, the image is not being displayed. I use Spring MVC framework and eclipse IDE. This is my jsp code fragment
This is what I have in my est.css
My image are in the eclipse folder : com/myorg/projectname/web/image
My stylesheet is in the eclipse folder : com/myorg/projectname/web/styles
I am new to web application. I am sorry if I am not answering your question but willing to learn..
As far as I know the WAR file is the used for the deployment of the web application. I use eclipse to run this dynamic project that I created. I didnt create any WAR file as such. Does it require to create WAR file to run the application in eclipse?? or am I missing something basic I am supposed to know??
Since you are new to web applications, my recommendation is to use a text editor and build your web application by hand. There are resources that will guide you through this, such as http://www.moreservlets.com/. That is a fairly old resource but it will teach you the basics, especially how a WAR file is laid out and how the parts of it work together. And how to deploy it to a servlet container.
The problem with relying on Eclipse when you are trying out a new Java technology is that when Eclipse screws up (and it does that fairly regularly), it you do not have the basic understanding about the technology, then you will be completely lost. Personally, I use Eclipse as a glorified text editor and use other mechanisms (Maven, Ant) to do my builds and deployment of web applications.
Joined: Feb 23, 2009
Thanks for your suggestions and your views. But I have a question this is how generally web application are being built, not many people use eclipse to develop dynamic webapplication? I am just weighing my option to learn maven and ant and start to build.
In my case the application will have to connect to Oracle database in future, in which case I have to setup the drivers if I start to do it by hand. But In eclipse just need to add jar files, which will save me from configuring the drivers and connecting to oracle. I am also using spring framework for this application.
Here's a hint: the code you generate shouldn't have any references to Eclipse in it. If you think about it for a few seconds, you should realize the the application is going to be run on a different computer where Eclipse isn't even installed. So start by getting your hard-coded Eclipse references out of there.
Yes lots of people use Eclipse (or NetBeans) to develop their web applications. But those people also understand how WAR files are laid out and how WAR files are deployed to the application servers of their choice. If you are unaware of these details then you will spent all of your time fighting Eclipse rather than getting anything done.
Also, you should learn both Ant and Maven. Depending on Eclipse to do your builds and deployment is not recommended. Yes you can use Eclipse to debug your app, but the "official" build should be done using Ant or Maven. Heck, even when I used Visual Studio to develop and debug C++ applications I still relied on make files for the official build. That is the only sane way to do things when there are multiple developers on a project andwhen you want to avoid the "gee, it works just fine on my machine" bug.
Joined: Feb 23, 2009
Peter Johnson wrote:Where is the image file located in the WAR file? Where is the stylesheet located in the WAR file?