JSP Tutorial Basic Starting - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript JSP Tutorial Basic Starting - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Sunday, August 20, 2017

JSP Tutorial Basic Starting

JSP Tutorial Basic Starting

 

 

Creating a new projetc in Netbeans IDE

Then Select Web Application

Then Select Server to Apache Tomcat Or Tom EE Server then Next.

Now Lets Start .

Creating a Simple JSP Page That prints Hello World In Browser.

home.jsp



Now Write the codes.
<%--
    Document   : home
    Created on : Aug 13, 2017, 12:50:38 PM
    Author     : sanjeev
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>

        <% out.print("<h1>Hello World!</h1>"); %> 
    </body>
</html>



Then Click On Run Icon  then localhost running at port 8080 now open your home.jsp by /home.jsp    
And you successfully run your first jsp page like this.




Now Understanding the codes

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

This line define the page that we are using stand html tag in our page that browser render the html tags to display html view in our browser if we change the “text/html” to “text/plain” then browser display all the contents as plain text like this. We call this option as page header option.






Other are basic Html tags of pages now Next important line is know as scriptlet tag.  A scriptlet tag is used to execute java source code in JSP. Syntax is as follows:

<% java source code %>
Example :

        <% out.print("<h1>Hello World!</h1>"); %> 



Thanks.

No comments:

Post a Comment

Post Top Ad