You might want to create 2 DAO objects to unit test.
1 to return a list of teams.
The other DAO takes an argument of the team ID and returns a list of memners of the team.
(Many DAO's out there, try iBatis.com).
Once you have that unit tested, you can write an action that populates object from DAO 1, and puts it in request scope; so you can display the JSP.
From that JSP, call another action, where you get the parm out of the request of the team you want returned.
Good luck.
On Struts wiki, there are 20 books on Struts, and many online tutorials on Struts (look at one from Rick Reuman)
.V
Jamison Roberts wrote:
I've been a C#/.Net developer for two years. Recently my company has decided to move towards Java/Struts, so i've spent the last three weeks familiarizing myself with Java, JDBC, Type 4 drivers, Tomcat, Ant, and Struts.
Struts is the last thing i've tried to tackle, and I thought I had a handle on it, however I don't. I'm not sure of the best (or correct/standard) way of doing simple things. I've read that if I ever have a *.jsp showing in the address bar outside of the entry page, i've done something wrong.
I'd like to give an example, and hear suggestions on the correct way to implement such an idea. Simple example to follow...
Let's say I have a database that contains a two tables: one called teams, and one called riders. There is a one-to-many relationship between teams and riders based on a "teamid."
In the teams table, we have the following data (Primary Key in parens): (1) USPS (2) T-Mobile (3) Cofidis (4) Phonak ...
In the riders table, we have this data (relationship in parens): Lance Armstrong (teamid = 1) George Hincapie (teamid = 1) Jan Ullrich (teamid = 2) Alexandre Vinokourov (teamid = 2) David Millar (teamid = 3) Tyler Hamilton (teamid = 4) ...
From the Index.jsp, there should be a link to another page that will have a single select box, and a submit button. The select box needs to be populated with a list of teams/teamids from the database.
Upon submission of the form, all riders will be displayed in a table.
Pretty simple stuff, except I can't seem to figure out how to do it
with Struts. The closest i've gotten is to have a "static" Teams.jsp
with an input-text box, which calls an Action to display the users. In otherwords my Index.jsp links to Teams.jsp, instead of something
like Teams.do (and I can't figure out how to populate a select box
from a Vector or other sort of list).
I apologize for asking simple questions, but i'm at the end of my rope trying to figure out all these "new" technologies (new to my Microsoft dominated world).
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]