|
INTERVIEW QUESTIONS
J2EE
JSP
DETAILS
Question: How do I use a scriptlet to initialize a newly instantiated bean?
Answer: A jsp:useBean action may optionally have a body. If the body is specified, its contents will be automatically invoked when the specified bean is instantiated. Typically, the body will contain scriptlets or jsp:setProperty tags to initialize the newly instantiated bean, although you are not restricted to using those alone. The following example shows the "today" property of the Foo bean initialized to the current date when it is instantiated. Note that here, we make use of a JSP expression within the jsp:setProperty action. value=""/ >
|
|
|
Category |
JSP Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9699 users |
Added on |
9/16/2014 |
Views |
69985 |
Rate it! |
|
|
Question:
How do I use a scriptlet to initialize a newly instantiated bean?
Answer:
A jsp:useBean action may optionally have a body. If the body is specified, its contents will be automatically invoked when the specified bean is instantiated. Typically, the body will contain scriptlets or jsp:setProperty tags to initialize the newly instantiated bean, although you are not restricted to using those alone. The following example shows the "today" property of the Foo bean initialized to the current date when it is instantiated. Note that here, we make use of a JSP expression within the jsp:setProperty action. value=""/ > 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 |
|
How do you prevent the Creation of a Session in a JSP Page and why? What is the difference between include directive & jsp:include action?
|
View Answer
|
|
How do I mix JSP and SSI #include? What is the difference between include directive & jsp:include action?
|
View Answer
|
|
How do I mix JSP and SSI #include?
|
View Answer
|
|
What is JSP?
|
View Answer
|
|
Can a JSP page instantiate a serialized bean?
|
View Answer
|
|
Can you make use of a ServletOutputStream object from within a JSP page?
|
View Answer
|
|
Is there a way I can set the inactivity lease period on a per-session basis?
|
View Answer
|
|
How do you pass control from one JSP page to another?
|
View Answer
|
|
Is there a way to reference the "this" variable within a JSP page?
|
View Answer
|
|
Can a JSP page process HTML FORM data?
|
View Answer
|
|
Can I stop JSP execution while in the midst of processing a request?
|
View Answer
|
|
How can I declare methods within my JSP page?
|
View Answer
|
|
Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
|
View Answer
|
|
How do I use comments within a JSP page?
|
View Answer
|
|
How does JSP handle run-time exceptions?
|
View Answer
|
|
How do I perform browser redirection from a JSP page?
|
View Answer
|
|
What JSP lifecycle methods can I override?
|
View Answer
|
|
How do you restrict page errors display in the JSP page?
|
View Answer
|
|
How do I prevent the output of my JSP or Servlet pages from being cached by the browser?
|
View Answer
|
|
Why does JComponent have add() and remove() methods but Component does not?
|
View Answer
|