Website in JSP with header with param, footer and index part.

It is another my post. Today we ceate very simple JSP project in Netbeans.

So open Netbeans IDE and from menu choose File->New Project.

In New Project window from Categories select Java Web and from Projects choose Web Application.

Click Next button. In Project Name field write MyFirstJSP and click the Next button.

From Server list select your favorite server. I chose tomcat7. Click the Next button.

In another window you may click the Finish button.

In tree of project you see index.jsp file.

Now we may create two another files: footer.jsp and header.jsp. So right click on project node and choose New->JSP.

In New JSP window in File Name write header and click the Finish button.

In the same way create footer.jsp file.

You have tree jsp files: header, footer and index. Paste into header.jsp this code:





    
        
        
        
    
    

You see stylesheet file include into website. Create css file. Right click the Web Pages node and choose New->Folder.

In New Folder window write in File Name field css and click the Finish button.

Right click the css folder and choose New->Other.

From New File window form Categories choose Other and from File Types select Cascading Style Sheet. Click the Next button.

In File Name field write main and click the Finish button.

In the footer.jsp file paste this code:



 

And in index.jsp paste the code:








        

It is my first website in JSP.

        

All files contain page directive with contentType attribute and pageEncoding attribute.  In index.jsp file adding header and footer file is by means of include directive with page attribute. If you would like to add param to this part website you must add in include tags (with page attribute)  param tag with name of param and its value. In this example we add title of website into it.

Run your application.