DAO and Struts

I m new to Struts and i wsh to do a stuff in it....I m not clear with the DAOs and Business Delegate model in it and i need a sample code for continuing with wher can i get if anybody culd suggest me a well start point?
[233 byte] By [noush@suna] at [2007-11-27 5:12:10]
# 1

Hi!

A DAO class is a simple class that make the connection to a database and make query, insert, delete or other transaction istructions in your db language.

A method in a dao class usually returns a VO (a value object) class, which is as a DTO class, but its fields are a perfect map of the fields type of the table in the db. (a varchar2 is mapped as a string in a vo, a little number as an int, etc...)

The BD (business delegate) is a class between the web level and the business level of an application and its due is to hide and center in itself problems like lookup to an ejb or to call other business components.

Without a BD class, for instance, you should do a lookup to an ejb from an action class, but in this way you create a strong link between the web level and the business level...

I hope my post can help you...

zat81a at 2007-7-12 10:32:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

hi

thanks for ur response,

Actually i tried the tryme.war from http://javaboutique.internet.com/tutorials/ApacheDAOs/tryme.war

i hav configured my conf/server.xml as

<?xml version='1.0' encoding='utf-8'?>

<Server>

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>

<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>

<GlobalNamingResources>

<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

<Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase" pathname="conf/tomcat-users.xml" factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>

<Resource name="PointBaseJNDI" type="javax.sql.DataSource" password="mysql" driverClassName="com.mysql.jdbc.Driver" maxIdle="2" maxWait="5000" username="root" url="jdbc:mysql://localhost:3306/test" maxActive="40"/>

<Resource name="jdbc/hrweb" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" password="mysql" maxIdle="2" maxWait="5000" username="root" url="jdbc:mysql://localhost:3306/hrweb" maxActive="4"/>

<Resource name="jdbc/hrsite" type="javax.sql.DataSource" password="mysql" driverClassName="com.mysql.jdbc.Driver" maxIdle="2" maxWait="5000" username="root" url="jdbc:mysql://localhost:3306/hrsite" maxActive="40"/>

<Resource name="testmysql" type="javax.sql.DataSource" password="admin" driverClassName="sun.jdbc.odbc.JdbcOdbcDriver" maxIdle="2" maxWait="5000" username="root" url="jdbc:odbc:tomtest" maxActive="4"/>

<Resource name="jdbc/dao" type="javax.sql.DataSource" password="mysql" driverClassName="com.mysql.jdbc.Driver" maxIdle="2" maxWait="5000" username="root" url="jdbc:mysql://localhost:3306/test" maxActive="4"/>

</GlobalNamingResources>

<Service name="Catalina">

<Connector port="8088" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">

</Connector>

<Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">

</Connector>

<Engine defaultHost="localhost" name="Catalina">

<Host appBase="webapps" name="localhost">

</Host>

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>

</Engine>

</Service>

</Server>

also my catalina/localhost/root.xml to be

<?xml version='1.0' encoding='utf-8'?>

<Context displayName="Welcome to Tomcat" docBase="ROOT" path="" workDir="work\Catalina\localhost\_">

<ResourceLink global="jdbc/dao" name="jdbc/daoref" type="javax.sql.sourceParams"/>

<ResourceLink global="testmysql" name="testmysqlref" type="javax.sql.DataSource"/>

<ResourceLink global="PointBaseJNDI" name="PointBaseJNDIRef" type="javax.sql.DataSource"/>

<ResourceLink global="AccessJNDI" name="AccessJNDIRef" type="javax.sql.DataSource"/>

</Context>

but when i tried to get run the tryme.war , list.jsp file

i m getting the follown error...

HTTP Status 500 -

--

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot find bean dvds in any scope

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:845)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:778)

org.apache.jsp.list_jsp._jspService(org.apache.jsp.list_jsp:106)

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.jsp.JspException: Cannot find bean dvds in any scope

org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:938)

org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:277)

org.apache.jsp.list_jsp._jspService(org.apache.jsp.list_jsp:68)

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.

--

could u please figure out the problem?

noush@suna at 2007-7-12 10:32:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...