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
What are java packages?
Is java a security risk?
Name component subclasses that support painting in java programming?
How many types of the indexof method are there for strings?
What are the advantages of packages in java?
What is class and object in java?
Explain wait(), notify() and notifyall() methods of object class ?
Does list allow duplicates in java?
Which java version is latest?
What is collection api?
What is implicit object in java?
What does singleton mean in java?
What’s the difference between callable and runnable?
When the constructor of a class is invoked?
What is the difference between a constructor and a method?