1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)
Java online test
JSP online test
ORACLE online test
Hibernate online test
Servlet online test
Struts online test
EJB online test
C online test
C++ online test
Aptitude online test

What is a Expression,Declaration,Scriptlet in jsp?

<b>expression </b>
An expression tag contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. Because the value of an expression is converted to a String, you can use an expression within text in a JSP file. Like
<%= emp.getName()%>
<%= (new java.util.Date()).toLocaleString() %>
You cannot use a semicolon to end an expression.

All the expression code is converting to servlet. All the expressions go to inside service() method of the convert servlet.


<b>Declaration</b>
A declaration declares one or more variables or methods for use later in the JSP source file.
A declaration must contain at least one complete declarative statement. You can declare any number of variables or methods within one declaration tag, as long as they are separated by semicolons. The declaration must be valid in the scripting language used in the JSP file.

<%! int i = 0; %>
<%! int a, b, c; %

You can add method to declaration part.
<%!
public String trimData(String str){
return str.trim();
}
%>

You can call the method within the jsp.

All the declaration code is converting to servlet. If you add method , the method is in convert servlet. All varibales are instance variable in the convert servlet.

<b>Scriptlet</b>
Scriptlet code is like java logic. you can declare varibales in the scriptlet and do the logic.
All the Scriptlet go to inside service() method of the convert servlet.

<%
int n=10;
for(int i=0;i<n;i++){
}
%>


Online Practice Test

Java online test
JSP online test
ORACLE online test
Hibernate online test
Servlet online test
Struts online test
EJB online test
C online test
C++ online test
Aptitude online test

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy