From: Ignacio C. <ic...@gm...> - 2006-12-22 14:55:14
|
You can use multi-select (in fact, it would be easier), but that would work with even fewer rows because you cannot show contents using multiple columns and your scrollbar will get huge. On 12/22/06, Aaron Porter <aa...@mo...> wrote: > I've done it with checkboxes but it was ugly. On the server before > saving I delete everything from the mapping table that relates to the > current object then I add everything that was selected. It would work > better to use a list box (multi-select) because you could use > ServletRequest.getParameterValues() but I'm afraid the HTML part would > still be a hack. > > Aaron > > Ignacio Coloma wrote: > > In the database, a many-to-many relationship is usually implemented as > > an intermediate table (in your case, a ARTICLE_TO_CATEGORY table). > > Most ORM like Hibernate handle this transparently. > > > > In the interface, that's a good question (people, =BFideas?) I have the > > same problem and was thinking about a list of checkboxes, but that > > would only work for lists of reasonable size. > > > > I am interested in people idea's about an interface to handle a > > many-to-many relationship. Having said that, it seems like your > > concrete needs would better be done with tags (in a similar way as > > google products, del.icio.us, flickr) > > > > Regards, > > > > On 12/22/06, Paul Barry <ma...@pa...> wrote: > > > >> Does anyone have any advice on how to handle a many-to-many with a > >> form? The specific example I'm working on consists of two objects, > >> Article and Category. An article can be in many categories and a > >> category can have many articles. I'm trying to build a form to edit > >> an article. What I'd like to have is an HTML select with > >> multiple=3Dtrue, but I'm not sure how to go about it. My action bean > >> has a List<Category> categories property that I'm populating with all > >> of the categories in a pre-action. My action bean also has an Article > >> property, which is where I'm going to put all the form data. The > >> article has a Set<Category> categories property that holds all of it's > >> categories. So I've got 2 questions: > >> > >> 1. Is there some combination of the stripes select/options tags that > >> I can use to generate a select with multiple=3Dtrue that will properly > >> mark the categories that the article already has as selected? > >> > >> 2. How should I handle this on the data side? Will I have to remove > >> all the categories from the article, and then add the ones that get > >> passed from the stripes action? > >> > >> ----------------------------------------------------------------------= --- > >> Take Surveys. Earn Cash. Influence the Future of IT > >> Join SourceForge.net's Techsay panel and you'll get the chance to shar= e your > >> opinions on IT & business topics through brief surveys - and earn cash > >> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID= =3DDEVDEV > >> _______________________________________________ > >> Stripes-users mailing list > >> Str...@li... > >> https://lists.sourceforge.net/lists/listinfo/stripes-users > >> > >> > > > > -----------------------------------------------------------------------= -- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share= your > > opinions on IT & business topics through brief surveys - and earn cash > > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID= =3DDEVDEV > > _______________________________________________ > > Stripes-users mailing list > > Str...@li... > > https://lists.sourceforge.net/lists/listinfo/stripes-users > > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share y= our > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Stripes-users mailing list > Str...@li... > https://lists.sourceforge.net/lists/listinfo/stripes-users > |