|
INTERVIEW QUESTIONS
J2EE
JSP
DETAILS
Question: What is difference between scriptlet and expression?
Answer: What ever we write inside the scriptlet thats become a part of service mathod of jsp generated serlet. and executed with in service method. and treated as html info. and what ever we write inside expression its is wirteen out side of service methods and become part of global inside class of servlet and expression is used for declarion of methods and variable and treated as java code exeution parts.
Submitted by Pushpendra Singh ([email protected])
______________
With expression in jsp ,the results of evaluating the expression r converted to a string and directly included within the output page.Typically expressions r used to display simple values of variables or return values by invoking a bean's getter methods.Jsp expressions begin within tags and do not include semicolons.
But scriptlet can contain any number of language statements,variable or method declarations,or expressions that are valid in the page scripting language.Within scriptlet tags,you can declare variables or methods to use later in the file,write expressions valid in the page scripting language. Scriptlet:
=> any java code embedded into a html page<% %> => it can have declaration,valid _expression => executed at the request time Expression: => any valid _expression <%= %> => implicit object like request,response & out are used in the expression => evaluvated at run time
Submitted by ANGELA ARUL MANI Selvaraj ([email protected])
|
|
|
Category |
JSP Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 10086 users |
Added on |
11/9/2010 |
Views |
74884 |
Rate it! |
|
|
Question:
What is difference between scriptlet and expression?
Answer:
What ever we write inside the scriptlet thats become a part of service mathod of jsp generated serlet. and executed with in service method. and treated as html info. and what ever we write inside expression its is wirteen out side of service methods and become part of global inside class of servlet and expression is used for declarion of methods and variable and treated as java code exeution parts.
Submitted by Pushpendra Singh ([email protected])
______________
With expression in jsp ,the results of evaluating the expression r converted to a string and directly included within the output page.Typically expressions r used to display simple values of variables or return values by invoking a bean's getter methods.Jsp expressions begin within tags and do not include semicolons.
But scriptlet can contain any number of language statements,variable or method declarations,or expressions that are valid in the page scripting language.Within scriptlet tags,you can declare variables or methods to use later in the file,write expressions valid in the page scripting language. Scriptlet:
=> any java code embedded into a html page<% %> => it can have declaration,valid _expression => executed at the request time Expression: => any valid _expression <%= %> => implicit object like request,response & out are used in the expression => evaluvated at run time
Submitted by ANGELA ARUL MANI Selvaraj ([email protected]) Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What is Declaration?
|
View Answer
|
|
How do you connect to the database from JSP?
|
View Answer
|
|
How do you call stored procedures from JSP?
|
View Answer
|
|
How do you restrict page errors display in the JSP page?
|
View Answer
|
|
How do you pass control from one JSP page to another?
|
View Answer
|
|
How do I have the JSP-generated servlet subclass my own custom servlet class, instead of the default?
|
View Answer
|
|
How does a servlet communicate with a JSP page?
|
View Answer
|
|
Is there a way I can set the inactivity lease period on a per-session basis?
|
View Answer
|
|
How can I set a cookie and delete a cookie from within a JSP page?
|
View Answer
|
|
How can I declare methods within my JSP page?
|
View Answer
|
|
How can I enable session tracking for JSP pages if the browser has disabled cookies?
|
View Answer
|
|
How do I use a scriptlet to initialize a newly instantiated bean?
|
View Answer
|
|
How does JSP handle run-time exceptions?
|
View Answer
|
|
How do I prevent the output of my JSP or Servlet pages from being cached by the browser?
|
View Answer
|
|
How do I use comments within a JSP page?
|
View Answer
|
|
Can I stop JSP execution while in the midst of processing a request?
|
View Answer
|
|
Is there a way to reference the "this" variable within a JSP page?
|
View Answer
|
|
How do I perform browser redirection from a JSP page?
|
View Answer
|
|
What JSP lifecycle methods can I override?
|
View Answer
|
|
Can a JSP page process HTML FORM data?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All JSP Interview Questions & Answers - Exam Mode /
Learning Mode
|