Sat Jan 17, 2009 1:27 am
<HTML>
<HEAD>
<TITLE>Calling a Private Method</TITLE>
</HEAD>
<BODY>
<H1>Java Beans Calling a Private Method</H1>
<jsp:useBean id="myhome" class="codebeans.Home" />
The message is: <jsp:getProperty name="myhome" property="HomeName" />
<BR>
<jsp:setProperty name="myhome" property="HomeName" value="Codemiles home" />
Our Home name is <jsp:getProperty name="myhome" property="HomeName" />
</BODY>
</HTML>
package codebeans;
public class Home {
String HomeName ;
private void savetodatabase(){
// code to save to database
}
public int getHomeName() {
return this.HomeName;
}
public void setHomeName(String HomeName)
{
this.HomeName = HomeName;
savetodatabase();
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.