Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Using scriptlet to Initialize JavaBean
How do I use a scriptlet to initialize a newly instantiated bean?
✍: FYICENTER.com
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.
<jsp:useBean id="foo" class="com.Bar.Foo" > <jsp:setProperty name="foo" property="today" value="<%=java.text.DateFormat.getDateInstance().format (new java.util.Date())%>"/> <%-- scriptlets calling bean setter methods go here --%> </jsp:useBean >
2007-04-03, 6740👍, 0💬
Popular Posts:
What is a delegate ? Delegate is a class that can hold a reference to a method or a function. Delega...
What is Service Oriented architecture? “Services” are components which expose well defined interface...
If we have the following in a Java code: String s="abc"; String s2="abc"; Then what will be output o...
How To Retrieve Input Values for Checkboxes Properly? - PHP Script Tips - Processing Web Forms If mu...
I have 5 questions please give me the answer ,explanation,suggestions if any?? what is PMP(project m...