GM friends how are you ?
So today we are going to learn about jsp (component of advance java) and expression tag in jsp and and we are going to learn about a little about jstl(java standard tag library.)
J2EE =java to enterprise edition.
j2ee module is used to develop the following applications.
1.web applications .
4.N- tier applications.
JSP is a dynamica progrmming language .
It is capable of making simple program to complex program.
An HTML page with some java code sprinkled in jsp.
JSP is processed on the server. (tomcat,glassfish ,javaserver etc)
result of java code included in html returned to browser.
A jsp consists of html tag and jsp tag.
Jsp is a technology used to create web applications just like servlet technology.
IT can be thought as an extension of servlet because more functionality than servlets. such as expression language ,jstl etc.
the JSp pages are easier to maintain then servlet because we can separate designing and development .
IT provides same additional feature such as expression language ,custom tags etc.
There are three types of JSP expression.
- JSP expression <%= some java expression %>
2. JSP Scriptlet = <%= some java code: 1 to many lines %>
3 .JSP declaration = <%! variable or method declaration %>
<h1>converting a string to uppercase:</h1>
<% = new String(“hello world”).to uppercase()%>
output:- HELLO WORLD
insert 1 to many lines of java code.
to include content in the page use: out.println.
<h1>jsp scriptlet </h1>
for (int i=1;i<=5;i++)
out.println(“the numbers in the loop”+i);
output:-the numbers in the loop 1
the numbers in the loop 2
the numbers in the loop 3
the numbers in the loop 4
the numbers in the loop 5
Declare a method in the jsp tag.
Call the method in the same jsp page.
the declarations tag .
write some code
String make it lower(String data)
return data to Lowercase();
Lower case”HELLO WORLD”-
<%= makeitLower(“hello world”) %>
thank you hope you will like this article and get benefited.