RE: select tag woes

2003-09-16 Thread Michael Ruppin
Alternatively, nest your beans.  That is, have TeamForm contain an instance of 
AwayTeam and an instance of HomeTeam:
 
   public class TeamForm extends ActionForm {
private AwayTeam awayteam = new AwayTeam();
private HomeTeam hometeam = new HomeTeam();
   ...
 
Then, your select tags look like:
 
   

RE: select tag woes

2003-09-16 Thread Wendy Smoak
Martin wrote:
> The problem is that both the bean homeTeam and awayTeam have the 
> property teamId which results in the following HTML...
> As you can see both the name attributes have the value teamId, 
> which of course is a problem.

I'm confused by having one html form, but expecting Struts to populate
two beans.  AFAIK, it's one-to-one with the html form and the ActionForm
instance (the form bean).  After that, you can do what you like in the
Action to populate whatever you need.

So you might have properties such as homeTeamId and awayTeamId in your
form bean.  You probably won't be able to use the magic
BeanUtils.copyProperties() but instead will have to write code to
populate your homeTeam and awayTeam beans from the values in the form
bean.

So I see it going:
Html form -> ActionForm/Action -> populate custom beans -> forward to
view

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



select tag woes

2003-09-16 Thread Martin Smith
Hi there,

I have the following code in my jsp...


  










The problem is that both the bean homeTeam and awayTeam have the property
teamId
which results in the following HTML...


Arsenal
Aston Villa
Middlesborough
Newcastle United
Porstmouth


Arsenal
Manchester City
Manchester United
Middlesborough
Newcastle United


THE PROBLEM

As you can see both the name attributes have the value teamId, which of
course is a problem.

Is there a better solution but still using the html tags, rather that
building up the select elements manualy??

Maybe by using the html-el tags???

Thanks,

Martin


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]