{
e.printStackTrace();
}
}
}
二、Article.java
package article;
import java.sql.*;
import java.util.*;
import javax.naming.*;
import javax.sql.*;
public class Article
{
String kind;
String author;
String title;
String date;
String body;
int checknum;
public Article()
{
}
public Article(String kind,String author,String title,String date,String body,int checknum)
{
this.kind=kind;
this.author=author;
this.title=title;
this.date=date;
this.body=body;
this.checknum=checknum;
}
/*********读取字段值********/
public int getChecknum()
{
return this.checknum;
}
public String getKind()
{
return this.kind;
}
public String getAuthor()
{
return this.author;
}
public String getTitle()
{
return this.title;
}
public String getDate()
{
return this.date;
}
public String getBody()
{
return this.body;
}
/**********设置字段值*********/
public void setKind(String kind)
{
this.kind=kind;
}
public void setAuthor(String author)
{
this.author=author;
}
public void setTitle(String title)
{
this.title=title;
}
public void setDate(String date)
{
this.date=date;
}
public void setBody(String body)
{
this.body=body;
}
public void setChecknum(int checknum)
{
this.checknum=checknum;
}
}
附:在Jsp中这样设置的:
<jsp:useBean id="articledb" class="article.ArticleDB" scope="application">
<jsp:setProperty name="articledb" property="provider" value="<%=application.getAttribute("CONNECTOR")%>"/>
</jsp:useBean>
这么一来,在Jsp中就可以随处使用你的业务Bean的方法来工作了。
总结:这是个很简单的小应用工具,适用于小型或中小型的应用。可以减少开发者在数据库连接上的花的工夫。专心编写业务程序。当然,也许很多人认为不必要,呵,这是我个人认为了。最好大家都能自已动手写一个,这样的话可以对数据库连接和相关的知识有更进一步的了解,另一方面可以方便自已以后的开发。数据池,最后不要用别人写的,要么自已写!写得不好没关系,再写!直接拿别人的来用就什么都学不到了。呵呵。我是这样认为的。这个工具到目前为止功能不算多,以后还会继续增加。
上一篇: HelloWorld------SOAP
下一篇: Struts的体系结构
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!



