Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what are the jsp tags with example?



what are the jsp tags with example?..

Answer / 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

More Core Java Interview Questions

Can an object be null?

0 Answers  


what is struts-config-xml?and its use?

3 Answers  


what are the uses of Class class and what it returns? explain it with the example code.

1 Answers  


How many types of modifiers are there?

1 Answers   Infosys,


Is hashset ordered?

0 Answers  


What are adapter classes?

0 Answers  


Can a class be protected in java?

0 Answers  


Is char a method in java?

0 Answers  


In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?

0 Answers  


what is jms? features of jms

2 Answers   CTS,


What is java used for?

0 Answers  


How to do validation of the fields in any project ?

2 Answers  


Categories