On 9/24/07, A. Lotfi <[EMAIL PROTECTED]> wrote: > Hi, > I am using struts1.3.8 > > I just want when the user click in a link (SurveyAction.do) , he will be > presented with a form : > > ID ---- Title ------ O smal O medium O hight > ........ > ID ---- Title ------ O smal O medium O hight > > SaveSubmitButton > > > The three radio buttons are all not selected, the user just has to select > one of each line then click the Save SubmitButton. > > > Please help me, > 1) How to create the data radio butons in the database tabel ?
Remember the struts property is what you are gathering from the form. So for example, say your ActionForm for a Person wants to collect the user's favoriteColor using some radio buttons... <html:radio property="favoriteColor" value="1"/>Green <html:radio property="favoriteColor" value="2"/>Blue <html:radio property="favoriteColor" value="3"/>Orange If you want that to be dynamic, just query your table for Favorite colors from the db, populate it in List and stick in request scope before you go to the form and then just iterate over the colors (it's exactly like the example I told you to look at in an earlier post with the Employee CRUD example - see how Departments is populated.) Then you can just iterate over your colors list and display them... <c:forEach var="color" items="colors"> <html:radio property="favoriteColor" value="${color.id}"/> ${color.name} </c:forEach> (if you don't want to populate the list before hand in a prePopulate type of Action method... //top of page: <jsp:useBean id="colorsService" scope="page" class="net.whatever.package.service.ColorsService"/> //in form on page <c:forEach var="color" items="${colorsService.colors}"> <html:radio property="favoriteColor" value="${color.id}"/> ${color.name} </c:forEach> -- Rick --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]