struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yuriy Zubarev <>
Subject db and forms
Date Wed, 21 Mar 2001 04:46:46 GMT

If I may I would like to inquire about db/form handling using Struts
framework in theoretical point of view. For instance I have 2 tables in my
db, let's say "Customers":

CustomerID int,
Name       varchar,
Password   varchar

and "Phones":

PhoneID    int,
CustomerID int,
Number     varchar

A customer can log on to a web site by specifying his Name and Password on
the index page and after that he gets to a main page where he can choose
between three links: "view/edit personal information", "view/edit phones"
and "add phone".

I (almost) understand how to organize logon process: I create a that represents form elements on the index page and where I get values from the form and use them to query db
to find out if there is such a user and if so I put UserID taken from
ResultSet into session and finally load the main page. As I mentioned the
main page contains three links which, as I guess, should point to Action
Forms, something like "",
"" and "". Also I should
have jsp pages for creating/editing(viewing) customer and phone
information (customer.jsp, phones.jsp (for list of phones) and phone.jsp
(for particular phone)). And this is where my poor understanding of
overall process ends. What should happen when anyone clicks
""? As far as I know I have to create java
files like this "" and "" and perhaps
"". encapsulates data and methods
of the form (setter, getter), is used to fill in that
form (how?) and to get data from the form and save
them into db, right? Then and
have to contain db related java code where I make use a session element
that contains value of CustomerID, right? And what if I need to show some
page information of which is based on many ID (parameters)? Should I pass
them through URL or Struts offers another way? Well the more I writing the
more questions I have and I suppose nobody has time to answer them, but
perhaps someone could share couple of his jsp/java files (along with
struts-config.xml) that deal with relation db and forms similar to those I
tried to describe above. Struts-example it's a good thing but more
examples are even better.

I would really appreciate any help.

Thank you for your time.

Best of luck.

Do You Yahoo!?
Get your free address at

View raw message