ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Internet & the Web

Designing Webpages in JSP (Java Server Pages):

Updated on November 6, 2014

Step 1: Start Netbean and create a new project

We can press combination of Ctrl+Shift+N as shortcut keys. And there is also a common way go to the File menu and then create a new project see the figure for details. In figures there are some areas which are highlighted to indicate the chosen options. You should select the highlighted options to complete this tutorial.

Figure 1
Figure 1

When you done then you will see the figure 1, and check the highlighted areas from which you can understand which options should be select or choose. When you done then this step press next to go forward…

Project Name and Folder

Figure: 2
Figure: 2

Step 2:

In this step you will learn how to give a name to your project and where you can save it. See the highlighted areas in the figure 2. In which first is Project Name second is Project Location the last and third is Project Folder. Make changes according to your desire and then click next button to go forward. Commonly we name our projects according to the project type. In website projects you should give it your domain name. For example: if you are designing a website name is so your project name should be xyz, from this you will identify your project easily.


Figure 3: Server
Figure 3: Server

Step 3:

In this step you should don’t change anything, leave it as default. And click next button to go forward. We can make changes if you have multiple installed servers for your JSP webpages. JSP webpages runs on glassfish and apache tomcat servers. If you have installed both so you can change the servers from here. And for Java EE version is should be default by your IDE, because when we use IDE for JSP or any other programming platforms we do update to our IDE. That’s why leave it as it is.

And one thing more i would like to increase in your knowledge, that is you can change your server at any time during your development. But it will not a proper way of development. Because it will disturb your settings of pages. It happens sometimes, not usually because if you are working with CSS and HTML so they need their real way of rendering.


Figure 4: Frameworks
Figure 4: Frameworks

Step 4:

We are not going to use any framework, so don’t try to click. Just leave them as they are, click on next button to go forward. There is some techniques to use frameworks in our JSP projects. But in this tutorial I am just focusing the beginners. In future i will give you a useful tutorial about Java frameworks. We use Frameworks to get ease of doing something. And from frameworks our programming security increase. That's why people commonly in Software Companies use framework, because their customers need their product to be complete on time. And the framework will help you to complete and submit the projects on time.

There number of frameworks in JAVA, and they are being used usefully. Because if one thing just designed for your ease and benefit so take advantages from it. As you can see in figure 4, there is a list of frameworks. And if you have idea to work with the help of frameworks then you can select your favorite framework of JAVA.

Step 5:

In this step we will first delete the index.html file and then we will create a new file with extension of index.jsp. We deleted the index.html because I telling you about JSP and it is necessary to change or delete if you got index.html file by default. And you can check if there is by default index.html file, leave it as it is. Create a new file and name it index.jsp and do different actions on both files now run your project so your website will show the index.jsp data on your webpages.

Create a new JSP file

Figure 6: Create a new JSP file
Figure 6: Create a new JSP file

Step 6:

Follow the figure 6, from which you can create a new file. And we will name the new file as index.jsp as we discussed it in step 5. If you have any problem then see the figure 7 and just do that changes which are highlighted. In this way we can create JavaScript and CSS files in JSP projects. And their use is simple as we use them in PHP projects to design or develop webpages.

Changing Name

Figure 7: Changing Name
Figure 7: Changing Name

Step 7:

Now we are ready to start programming to design JSP dynamic webpages. I designed a simple page it will show the current date and time. See the coding in listing 1and if you have any kind of problem in JSP tags so you can read my previous article about JSP tags and its uses link:

Listing 1: JSP Dynamic Webpages

[cod language=”jsp”]

<%@ page import="*,java.util.*, javax.servlet.*" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>



<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>JSP Dynamic Webpages</title>



<h1>JSP Dynamic Webpages</h1>


Date date = new Date();

out.print("<h4>Hello Hubpages! Date:</h4>"+date.toString());





Here it is the code of the JSP webpage. It is very easy to design webpages using JSP, there are different type of tags in JSP. We can use html normally as we learnt to use them. Just the new technique is to insert the JSP tags. Inside the JSP tags we use Java programming to make our JSP webpages useful. Lets see the output and in the output we will see the current date and time.


Figure 8: Output
Figure 8: Output


Now the webpage is showing the current date and time. If we note the highlighted area so there is localhost and port number. As I told you in previous steps we run the JSP dynamic webpages using severs. I am using apache tomcat on my local machine. That’s why it is written in the address bar localhost:8084. Do your precious comments let me know your ideas about my articles.


    0 of 8192 characters used
    Post Comment

    • profile image

      Gul 3 years ago

      Please write about's interesting and useful

    • Tanja B Trkulja profile image

      Tanja Trkulja 3 years ago from Serbia

      Wow! This is going to be really helpful. Thanks for sharing! :)