You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Neg <Ne...@gmail.com> on 2007/01/22 22:27:23 UTC

Having multiple similar elements in a form

Hi everyone

Ive got a problem that's really bugging me,

I have a jsp, in which i can upload a few photographs.

I'd like to have one set of :"comboboxes" and "textfields" for each
photograph, in the next page. 

But the thing is, i've only got one set of beans in my actionForm, and i
dont know how many pictures are going to be uploaded so that i can have
eanough beans for them all.

This is the code for the first page(in future i'd like to have as many find
elements as the user wishes to have):

##################################################

/*
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>



  
  




	

			
			
			
			
		
	
	

			
			
			
			
		
	
	

			
			
	
	

			
			
	
	

			
			
	
	

			
		
			
			
			
			
		
	



*/




#####################################################3

This is the code for the second page:

?*<!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=iso-8859-1" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <title><bean:message key="orderDetails.title"/></title>
</head>
<body>
<html:form action="/OrderDetails">
	<table border="1" cellpadding="5" width="100%">
		
		<%akschap.Order o=(akschap.Order)session.getAttribute("Order");
		java.util.Set pics=o.getPictures();
		java.util.Iterator i=pics.iterator();
		int x=0;
		<b>while(i.hasNext())
		{akschap.Picture p=(akschap.Picture)i.next();
		%>
		<trbgcolor="antiquewhite"><>
			<td width="25%" rowspan="6"><div align="center"><img src=""
align="middle" width="100" height="100"/></div></td>
			<td width="20%"><bean:message key="orderDetails.label.size"/></td>
			<td width="55%">
				<html:select size="1" property="sizeArray">
					<html:option value="2x3"><bean:message
key="orderDetails.combo.size.2x3"/></html:option>
					<html:option value="3x4"><bean:message
key="orderDetails.combo.size.3x4"/></html:option>
					<html:option value="6x4"><bean:message
key="orderDetails.combo.size.6x4"/></html:option>
					<html:option value="9x13"><bean:message
key="orderDetails.combo.size.9x13"/></html:option>
					<html:option value="10x15"><bean:message
key="orderDetails.combo.size.10x15"/></html:option>
					<html:option value="13x18"><bean:message
key="orderDetails.combo.size.13x18"/></html:option>
					<html:option value="15x20"><bean:message
key="orderDetails.combo.size.15x20"/></html:option>
					<html:option value="20x25"><bean:message
key="orderDetails.combo.size.20x25"/></html:option>
					<html:option value="20x30"><bean:message
key="orderDetails.combo.size.20x30"/></html:option>
					<html:option value="30x40"><bean:message
key="orderDetails.combo.size.30x40"/></html:option>
					<html:option value="30x45"><bean:message
key="orderDetails.combo.size.30x45"/></html:option>
					<html:option value="30x50"><bean:message
key="orderDetails.combo.size.30x50"/></html:option>
					<html:option value="30x60"><bean:message
key="orderDetails.combo.size.30x60"/></html:option>
					<html:option value="30x70"><bean:message
key="orderDetails.combo.size.30x70"/></html:option>
					<html:option value="30x80"><bean:message
key="orderDetails.combo.size.30x80"/></html:option>
					<html:option value="30x90"><bean:message
key="orderDetails.combo.size.30x90"/></html:option>
				  
				</html:select>
				</tr>
				<tr>
					<td><bean:message key="orderDetails.label.type"/></td>
		      		<td width="55%">
		      			<html:select property="typeArray" size="1">
		      				<html:option value="Matt"><bean:message
key="orderDetails.combo.type.Matt"/></html:option>
		      				<html:option value="Glossy"><bean:message
key="orderDetails.combo.type.Glossy"/></html:option>
		      				<html:option value="Luster"><bean:message
key="orderDetails.combo.type.Luster"/></html:option>
		      				<html:option value="Silk"><bean:message
key="orderDetails.combo.type.Silk"/></html:option>
		      				<html:option value="Metalic"><bean:message
key="orderDetails.combo.type.Metalic"/></html:option>
		      			</html:select>
		      		</td>
				</tr>
				<tr>
		  			<td><bean:message key="orderDetails.label.no"/></td>
	      			<td width="55%">
	      				<html:select property="noArray" size="1">
	      					<html:option value="1"><bean:message
key="orderDetails.combo.no.1"/></html:option>
	      					<html:option value="2"><bean:message
key="orderDetails.combo.no.2"/></html:option>
	      					<html:option value="3"><bean:message
key="orderDetails.combo.no.3"/></html:option>
	      					<html:option value="4"><bean:message
key="orderDetails.combo.no.4"/></html:option>
	      					<html:option value="5"><bean:message
key="orderDetails.combo.no.5"/></html:option>
	      					<html:option value="6"><bean:message
key="orderDetails.combo.no.6"/></html:option>
	      					<html:option value="7"><bean:message
key="orderDetails.combo.no.7"/></html:option>
	      					<html:option value="8"><bean:message
key="orderDetails.combo.no.8"/></html:option>
	      					<html:option value="9"><bean:message
key="orderDetails.combo.no.9"/></html:option>
	      					<html:option value="10"><bean:message
key="orderDetails.combo.no.10"/></html:option>
	      					<html:option value="11"><bean:message
key="orderDetails.combo.no.11"/></html:option>
	      					<html:option value="12"><bean:message
key="orderDetails.combo.no.12"/></html:option>
	      					<html:option value="13"><bean:message
key="orderDetails.combo.no.13"/></html:option>
	      					<html:option value="14"><bean:message
key="orderDetails.combo.no.14"/></html:option>
	      					<html:option value="15"><bean:message
key="orderDetails.combo.no.15"/></html:option>
	      					<html:option value="16"><bean:message
key="orderDetails.combo.no.16"/></html:option>
	      					<html:option value="17"><bean:message
key="orderDetails.combo.no.17"/></html:option>
	      					<html:option value="18"><bean:message
key="orderDetails.combo.no.18"/></html:option>
	      					<html:option value="19"><bean:message
key="orderDetails.combo.no.19"/></html:option>
	      					<html:option value="20"><bean:message
key="orderDetails.combo.no.20"/></html:option>
	      					
	      				</html:select>
	      			</td>
	  			</tr>
				<tr>
		  			<td><bean:message key="orderDetails.label.fileSize"/></td>
	      			<td width="55%">
	      				<b><%=p.getFileSize()%>   Kb.</td>
	  			</tr>
				<tr>
				  <td><bean:message key="orderDetails.label.dimensions"/></td>
			      <td width="55%"><c:out
value="${OrderDetailsForm.dimensions}"/></td>
			  </tr>
				<tr>
				  <td><bean:message key="orderDetails.label.price"/></td>
			      <td width="55%"><c:out value="${OrderDetailsForm.price}"/></td>
			  </tr><%x++;}%></b>			  <tr>
			  	</b><td></td>
			  				  	<td></td>
			  	<td align="right">
			  		<html:submit>
			  			<bean:message key="orderDetails.button.next"/>
			  		</html:submit>
			  	</td>
			  </tr>
	</table>
</html:form>

</body>
</html>*/


 

##########################################3
I'd like the indicated parts to iterate but i cant get my actionForm right,
And i dont know whether what i want is technically possible or not. 

Please help me out

cheers
-- 
View this message in context: http://www.nabble.com/Having-multiple-similar-elements-in-a-form-tf3060575.html#a8510313
Sent from the Struts - User mailing list archive at Nabble.com.