Free WebSchools.com

Google


Submit ArticleForumsLive chat Webhosting Link TO Us SEO Toolsjobs & interview


HOME

Java Server Pages

JSP Introduction
JSP Syntax
JSP Expression
JSP Declaration
JSP Comments

JSP Directives
JSP Actions
JavaBeans
JSP Sessions
JSP JDBC
JSP And HTML Forms
JSP With XML

JSP Exam


JSP Syntax





The Sun Microsystems’s java server pages technology allows you to rapidly develop and easily maintain rich, dynamic web pages. As a part of java family JSP enables development of web based applications that are platform independent. The web applications build using JSP technology works with a wide variety of web servers, application servers, browsers and development tools. The logic that generates the content is encapsulated in tags and JavaBeans components and tied together in scriptlets, all of which are executed on the server side. If the core logic is encapsulated in tags and Beans then other individuals, such as web masters and page designers, can edit and work with JSP pages without affecting the generation of the content. Thus the JSP technology separates the user interface from the content generation.



  • Tags have a start tag with optional attributes, an optional body and a matching end tag
  • Attributes values in the tag always appear quoted
  • Any white space within body of a document is not significant but is preserved.
  • The character \ (backslash) is used as an escape character in the tag

The difference between the JSP page and an HTML page is that while HTML tags are all Processed by the browser, the special JSP tags are processed by the web server. This allows the JSP page contents to change dynamically. JSP tags allow java code to be embedded directly in the HTML page, which then executed whenever the page is requested.

JSP syntax basic

Elements data can be classified into the following categories

  • Directives
  • Declaration
  • Scriptlets
  • Expression
  • Standard actions

The scripting language used in JSP is Java. There are 5 types of JSP Directives and scripting elements. Most of the JSP tags are enclosed within a single tag that begins with <% and end with %> The JSP tags are casesensitive

Writing Simple JSP page using scriplets

Hello.jsp

<html>
<head><title>Hello welcome to freewebschools<title></head>
<body>
<%
int x=0;
for(x=0;x<5;x++)
{
out.println("<h1> hello friend </h1>");
}
%>
</body>
</html>


OUTPUT

hello friend

hello friend

hello friend

hello friend

hello friend


Inform Friend About This Site

Your Name:

Friend's Name:

Friend's Email: