Simple JSP tags

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

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

2.Declaration

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

3.Scriptlet

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); %>

4.Expression

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,

https://smoothknowledge.com/2017/12/29/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.