perjantai 30. elokuuta 2013

Dynamic Web Project small view around

When you have created a new Dynamic Web Project it will look like this. A lot of folders. Don't panic. We are going to need just few of them in the beginning. WebContent as the name says is the folder for all your web content. For example, images, CSS and HTML goes here. There are two folders inside WebContent. META-INF which we are not going to touch and WEB-INF where you can add libraries. 

 

To start developing your web project just simply right click WebContent and select New - JSP file.


This is your "index.html" page. You can start creating HTML normally. 

Next do the same thing, right click WebContent, but select File instead of JSP and type style.css and finish for example. This is your CSS file. Both index and css straight under the WebContent. You could also create a new folder inside WebContent for example "images" and add some content to your web page.

When you have build your page layout you can open folder Java Recourses. Inside SRC folder you add all the java files for your project. Of course you need some Java knowledge. 

To run your page, press the green play button

Select Run On Server, pick Tomcat and Finish

  

Now Eclipse opens Web browser and shows your page.



This is my test page and my folder hierarchy.





Starting Java Developing - Dynamic Web Project - With Eclipse

During the Spring we had a course named software developing. We had to use Eclipse, Dynamic Web Project and Tomcat server. Now I'm going to tell few things about this process.

1. Start by downloading the newest Eclipse version from http://www.eclipse.org/downloads/
2. Select this version: Eclipse IDE for Java EE Developers Eclipse IDE for Java EE Developers and download either 32 or 64bit version depending on your system.

3. Eclipse comes in a Zip file, program called 7-Zip is very good program to unzip zip files. So download it from http://www.7-zip.org/ unless you have another program to unzip it. 

4. When you have unzipped Eclipse you will need Tomcat. Tomcat runs Java program in the server. It is good to have it locally on your computer that you can test your program in real time.

5. Go to Tomcat web-page http://tomcat.apache.org Under downloads there are different versions. Pick for example version 7 and download it under Binary Distributions - Core: and select Zip file.

6. Again, unzip the tomcat somewhere so your folder should look like this:


7. Now open the Eclipse

8. In Eclipse, select File - New - Dynamic Web Project. If it is not there, select other and search it. Select a name for your project and press Finish.




9. Now it's time to add Tomcat server. Select File - New - Other and type server. Select next.


10.  Select Tomcat version 7 under apache folder and type something similar if the forms are empty.


11. From the server runtime environment select Add and locate Tomcat where you unzipped it.


12. Click Finnish and you are ready to go, or should be. Now you can start creating your Dynamic Web Project.