Simple JSP tags

Java Server Page(JSP) is easy to learn.It is written inside the tags. Some JSP tags are described below.

Comments can be written like this.
<%– your comments –%>


We can use this tag to declare something.
<%! int a %>
<%! int add(int x,int y) { return (x+y); } %>


We can use the following tag to write general java code. we basically tag for loop,conditions,switching statements.
<% for(int i=0;i<=1;i++) System.out.println(“i= ” + i); %>


Using expression tag you can print something.
<%= number %>
The above tag is same as writing this <% System.out.println(number); %>

5.Directive tags

There are three types of directive tags.

(i) The page directive tag:– It basically use to import a page.
<%@ page import=”javax.swing.*” %>

(ii) The taglib directive tag:– It can be used to include different tag libraries.
<%@ taglib tagdir=”/WEB-INF/tags” %>

(iii)The include directive:– It is used to include a page at page translation time.The page may be a HTML or a JSP or anything.
<%@ include file=”welcome.html” %>

The above contains only basic JSP tags.There are also some other tags which will be discussed latter.

Read about JMS,

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.