request.getParamterName()を使用します.
1670 ワード
/**
* From name
*/
Enumeration<?> enu = request.getParameterNames();
List<Map<?, ?>> productSpecs=new ArrayList<Map<?, ?>>();
while(enu.hasMoreElements())
{
String paramName=enu.nextElement().toString();
if(paramName.indexOf("productspec")>-1){
String paramId=paramName.replace("productspec", "");
Map<Object, Object> productSpec1=new HashMap<Object, Object>();
productSpec1.put("productspec", request.getParameter ("productspec"+paramId));
productSpec1.put("productfromprice", request.getParameter("productfromprice"+paramId));
productSpec1.put("productnowprice" ,request.getParameter("productnowprice"+paramId));
productSpecs.add(productSpec1);
}
}
Map<Object,Object> Specmap=new HashMap<Object, Object>();
Specmap.put("productId", productId);
/**
*
*/
for(int i=0;i<productSpecs.size();i++)
{
String productspec=(String)productSpecs.get(i).get("productspec");
Integer productfromprice=Integer.parseInt((String)productSpecs.get(i).get("productfromprice"));
Integer productnowprice=Integer.parseInt((String)productSpecs.get(i).get("productnowprice"));
Specmap.put("productSpec", productspec);
Specmap.put("productSpecFromPrice", productfromprice);
Specmap.put("productSpecNowPrice", productnowprice);
productSpecDAO.insertvlaue(Specmap);
}