Answer Posted / sivasubramanian.k
(1)A declaration tag places a variable definition inside
the body of the java servlet class. Static data members may
be defined as well. Also inner classes should be defined
here.
Example:<%! int serverInstanceVariable = 1; %>
Declaration tags also allow methods to be defined.
<%!
/**
* Converts the Object into a string or if
* the Object is null, it returns the empty string.
*/
public String toStringOrBlank( Object obj ){
if(obj != null){
return obj.toString();
}
return "";
}
%>
(2)A scriptlet tag places the contained statements inside
the _jspService() method of the java servlet class.
<% int localStackBasedVariable = 1;
out.println(localStackBasedVariable); %>
(3)An expression tag places an expression to be evaluated
inside the java servlet class. Expressions should not be
terminated with a semi-colon .
<%= "expanded inline data " + 1 %>
(4)Also we can use the following tag to give comments in
jsp:
<%-- give your comments here --%>
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
Why do we need singleton?
Define linked list and its features with signature?
Java.util.regex consists of which classes?
What does @param args mean in java?
Is boolean a wrapper class in java?
Is there any difference between nested classes and inner classes?
What is the difference between jvm and jre? What is an interface?
How long will it take to learn java?
What is role of void keyword in declaring functions?
What is byte code and why is it important to java’s use for internet programming?
Should database connections be singleton?
What is the use of singleton class?
What are the pillars of java?
Can you access non static variable in static context?
Can a class be declared as static?