svnno****@sourc*****
svnno****@sourc*****
2007年 8月 4日 (土) 14:31:24 JST
Revision: 443 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=443 Author: shinsuke Date: 2007-08-04 14:31:23 +0900 (Sat, 04 Aug 2007) Log Message: ----------- added file upload for a product. Modified Paths: -------------- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductsDescription.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditPage.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListAction.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ProductService.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ProductServiceImpl.java pompei/portlets/pompei-core/trunk/src/main/resources/appMessages.properties pompei/portlets/pompei-core/trunk/src/main/webapp/WEB-INF/portlet.xml pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productEdit.html Added Paths: ----------- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UploadedFileUtil.java pompei/portlets/pompei-core/trunk/src/main/webapp/images/ pompei/portlets/pompei-core/trunk/src/main/webapp/images/products/ pompei/portlets/pompei-core/trunk/src/main/webapp/images/products/README.txt -------------- next part -------------- Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java 2007-08-04 05:31:23 UTC (rev 443) @@ -0,0 +1,12 @@ +package jp.sf.pal.pompei; + +public class PompeiConstants { + public static final String JPEG = ".jpg"; + + public static final String PNG = ".png"; + + public static final String GIF = ".gif"; + + public static final String PRODUCTS_IMAGE_DIRECTORY_NAME = "products"; + +} Property changes on: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java ___________________________________________________________________ Name: svn:eol-style + native Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductsDescription.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductsDescription.java 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductsDescription.java 2007-08-04 05:31:23 UTC (rev 443) @@ -1,13 +1,31 @@ package jp.sf.pal.pompei.exentity; +import jp.sf.pal.jsf.custom.fileupload.UploadedFile; /** * The entity of PRODUCTS_DESCRIPTION. * * @author DBFlute(AutoGenerator) */ -public class ProductsDescription extends jp.sf.pal.pompei.bsentity.BsProductsDescription { +public class ProductsDescription extends + jp.sf.pal.pompei.bsentity.BsProductsDescription { /** Serial version UID. (Default) */ private static final long serialVersionUID = 1L; + + private UploadedFile productsImageFile; + + /** + * @return productsImageFile + */ + public UploadedFile getProductsImageFile() { + return productsImageFile; + } + + /** + * @param productsImageFile 設定する productsImageFile + */ + public void setProductsImageFile(UploadedFile productsImageFile) { + this.productsImageFile = productsImageFile; + } } Added: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UploadedFileUtil.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UploadedFileUtil.java 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UploadedFileUtil.java 2007-08-04 05:31:23 UTC (rev 443) @@ -0,0 +1,77 @@ +package jp.sf.pal.pompei.util; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.util.Locale; + +import javax.faces.context.FacesContext; + +import jp.sf.pal.common.CommonException; +import jp.sf.pal.common.util.StreamUtil; +import jp.sf.pal.jsf.custom.fileupload.UploadedFile; +import jp.sf.pal.pompei.PompeiConstants; + +public class UploadedFileUtil { + private static String getExtension(String name) { + if (name == null) { + return null; + } + String lname = name.toLowerCase(Locale.ENGLISH); + if (lname.endsWith(PompeiConstants.GIF)) { + return PompeiConstants.GIF; + } else if (lname.endsWith(PompeiConstants.JPEG)) { + return PompeiConstants.JPEG; + } else if (lname.endsWith(PompeiConstants.PNG)) { + return PompeiConstants.PNG; + } + return null; + } + + protected static String getAbsoluteImagePath() throws CommonException { + Object context = FacesContext.getCurrentInstance().getExternalContext() + .getContext(); + try { + Class<?> cls = context.getClass(); + Method method = cls.getMethod("getRealPath", + new Class[] { String.class }); + //TODO get a target directory from portlet.xml + return (String) method.invoke(context, new Object[] { "/images" }); + + } catch (Exception e) { + throw new CommonException("could.not.retrive.image.path", + "Could not retrive the absoluteImage path.", e); + } + } + + public static String storeProduct(BigDecimal id, UploadedFile uploadedFile) + throws CommonException { + String name = uploadedFile.getName(); + String ext = getExtension(name); + if (ext == null) { + throw new CommonException("unsupported.file.format", + "Unsupported file format."); + } + StringBuffer filepath = new StringBuffer(getAbsoluteImagePath()); + filepath.append( + File.separator + PompeiConstants.PRODUCTS_IMAGE_DIRECTORY_NAME + + File.separator).append(id.toString()).append(ext); + File outputFile = new File(filepath.toString()); + try { + StreamUtil.drain(uploadedFile.getInputStream(), + new FileOutputStream(outputFile)); + return "/" + PompeiConstants.PRODUCTS_IMAGE_DIRECTORY_NAME + "/" + + id.toString() + ext; + } catch (FileNotFoundException e) { + throw new CommonException("could.not.save.uploaded.file", + "Could not find " + filepath.toString(), e); + } catch (IOException e) { + throw new CommonException("could.not.save.uploaded.file", + "I/O error: " + filepath.toString(), e); + } + + } +} Property changes on: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UploadedFileUtil.java ___________________________________________________________________ Name: svn:eol-style + native Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditAction.java 2007-08-04 05:31:23 UTC (rev 443) @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.List; +import jp.sf.pal.common.CommonException; +import jp.sf.pal.common.util.FacesMessageUtil; import jp.sf.pal.pompei.dxo.ManufacturersDxo; import jp.sf.pal.pompei.dxo.ProductDxo; import jp.sf.pal.pompei.exentity.Products; @@ -11,141 +13,162 @@ import jp.sf.pal.pompei.web.admin.product.service.ManufacturerService; import jp.sf.pal.pompei.web.admin.product.service.impl.ProductServiceImpl; - public class ProductEditAction { - private static final String MODE_INSERT = "insert"; - private static final String MODE_UPDATE = "update"; - /** */ - private ProductEditPage productEditPage; - /** */ - private ProductServiceImpl productService; - /** */ - private ProductDxo productDxo; - /** */ - private ManufacturerService manufacturerService; - /** */ - private ManufacturersDxo manufacturersDxo; + private static final String MODE_INSERT = "insert"; - public ProductDxo getProductDxo() { - return productDxo; - } + private static final String MODE_UPDATE = "update"; - public void setProductDxo(ProductDxo productDxo) { - this.productDxo = productDxo; - } + /** */ + private ProductEditPage productEditPage; - public Class initialize() { - System.out.println("ProductEditAction:initialize"); + /** */ + private ProductServiceImpl productService; - List mList = getManufacturerList(); - productEditPage.setManufacturersIdItems(mList); + /** */ + private ProductDxo productDxo; - return null; - } + /** */ + private ManufacturerService manufacturerService; - private List getManufacturerList() { - List mList = manufacturerService.getManufacturesList(); - List list = new ArrayList(); - manufacturersDxo.convertCombo(mList, list); - return list; - } + /** */ + private ManufacturersDxo manufacturersDxo; - public Class prerender() { - if(isUpdate()) { - ProductsDescription description = productService.getProdcutsDescription(productEditPage.getProductsId()); - productDxo.convert(description,productEditPage); + public ProductDxo getProductDxo() { + return productDxo; + } - }else { - productEditPage.setMode(MODE_INSERT); - productEditPage.setProductsName(""); - productEditPage.setProductsModel(""); - productEditPage.setProductsImage(""); - BigDecimal zero = new BigDecimal("0"); - productEditPage.setProductsPrice(zero); - productEditPage.setProductsQuantity(zero); - productEditPage.setProductsStatus(zero); - productEditPage.setProductsWeight(zero); - } - return null; - } + public void setProductDxo(ProductDxo productDxo) { + this.productDxo = productDxo; + } + public Class<?> initialize() { + System.out.println("ProductEditAction:initialize"); - public Class doUpdate() { - if(isInsert()) { - ProductsDescription description = productDxo.convert(productEditPage); - Products products = productDxo.convertProducts(productEditPage); - products.setProductsTaxClassId(new BigDecimal("0")); + List mList = getManufacturerList(); + productEditPage.setManufacturersIdItems(mList); - description.setProducts(products); - description.setLanguageId(new BigDecimal("1")); + return null; + } - productService.addProducts(description, productEditPage.getParentId()); + private List getManufacturerList() { + List mList = manufacturerService.getManufacturesList(); + List list = new ArrayList(); + manufacturersDxo.convertCombo(mList, list); + return list; + } - }else if(isUpdate()) { - ProductsDescription description = productService.getProdcutsDescription(productEditPage.getProductsId()); - productDxo.convertPageToDescription(productEditPage, description); + public Class<?> prerender() { + if (isUpdate()) { + ProductsDescription description = productService + .getProdcutsDescription(productEditPage.getProductsId()); + productDxo.convert(description, productEditPage); - Products products = description.getProducts(); - productDxo.convertPageToProducts(productEditPage, products); + } else { + productEditPage.setMode(MODE_INSERT); + productEditPage.setProductsName(""); + productEditPage.setProductsModel(""); + productEditPage.setProductsImage(""); + BigDecimal zero = new BigDecimal("0"); + productEditPage.setProductsPrice(zero); + productEditPage.setProductsQuantity(zero); + productEditPage.setProductsStatus(zero); + productEditPage.setProductsWeight(zero); + } + + // render faces messages + FacesMessageUtil.renderMessages(); + return null; + } - productService.updateProducts(description); + public Class<?> doUpdate() { + if (isInsert()) { + ProductsDescription description = productDxo + .convert(productEditPage); + Products products = productDxo.convertProducts(productEditPage); + products.setProductsTaxClassId(new BigDecimal("0")); - }else { - return null; - } + description.setProducts(products); + description.setLanguageId(new BigDecimal("1")); + description.setProductsImageFile(productEditPage + .getProductsImageFile()); + try { + productService.addProducts(description, productEditPage + .getParentId()); + } catch (CommonException e) { + FacesMessageUtil.addErrorMessage(e.getMessageId()); + } - return ProductListPage.class; - } + } else if (isUpdate()) { + ProductsDescription description = productService + .getProdcutsDescription(productEditPage.getProductsId()); + productDxo.convertPageToDescription(productEditPage, description); + Products products = description.getProducts(); + productDxo.convertPageToProducts(productEditPage, products); - private boolean isUpdate() { - String mode = productEditPage.getMode(); - return mode != null && mode.equals(MODE_UPDATE); - } + description.setProductsImageFile(productEditPage + .getProductsImageFile()); + try { + productService.updateProducts(description); + } catch (CommonException e) { + FacesMessageUtil.addErrorMessage(e.getMessageId()); + } - private boolean isInsert() { - String mode = productEditPage.getMode(); - return mode != null && mode.equals(MODE_INSERT); - } + } else { + return null; + } - /** - * @return productEditPage - */ - public ProductEditPage getProductEditPage() { - return productEditPage; - } + return ProductListPage.class; + } - /** - * @param productEditPage 設定する productEditPage - */ - public void setProductEditPage(ProductEditPage productEditPage) { - this.productEditPage = productEditPage; - } + private boolean isUpdate() { + String mode = productEditPage.getMode(); + return mode != null && mode.equals(MODE_UPDATE); + } - public ProductServiceImpl getProductService() { - return productService; - } + private boolean isInsert() { + String mode = productEditPage.getMode(); + return mode != null && mode.equals(MODE_INSERT); + } - public void setProductService(ProductServiceImpl productService) { - this.productService = productService; - } + /** + * @return productEditPage + */ + public ProductEditPage getProductEditPage() { + return productEditPage; + } - public ManufacturersDxo getManufacturersDxo() { - return manufacturersDxo; - } + /** + * @param productEditPage 設定する productEditPage + */ + public void setProductEditPage(ProductEditPage productEditPage) { + this.productEditPage = productEditPage; + } - public void setManufacturersDxo(ManufacturersDxo manufacturersDxo) { - this.manufacturersDxo = manufacturersDxo; - } + public ProductServiceImpl getProductService() { + return productService; + } - public ManufacturerService getManufacturerService() { - return manufacturerService; - } + public void setProductService(ProductServiceImpl productService) { + this.productService = productService; + } - public void setManufacturerService(ManufacturerService manufacturerService) { - this.manufacturerService = manufacturerService; - } + public ManufacturersDxo getManufacturersDxo() { + return manufacturersDxo; + } + public void setManufacturersDxo(ManufacturersDxo manufacturersDxo) { + this.manufacturersDxo = manufacturersDxo; + } + + public ManufacturerService getManufacturerService() { + return manufacturerService; + } + + public void setManufacturerService(ManufacturerService manufacturerService) { + this.manufacturerService = manufacturerService; + } + } Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditPage.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditPage.java 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductEditPage.java 2007-08-04 05:31:23 UTC (rev 443) @@ -3,195 +3,214 @@ import java.math.BigDecimal; import java.util.List; +import jp.sf.pal.jsf.custom.fileupload.UploadedFile; + import org.seasar.teeda.extension.annotation.scope.SubapplicationScope; public class ProductEditPage { - public static final String productsName_TRequiredValidator = null; - public static final String manufacturersId_TRequiredValidator = null; - public static final String productsModel_TRequiredValidator = null; + public static final String productsName_TRequiredValidator = null; - private String breadcrumb; + public static final String manufacturersId_TRequiredValidator = null; - private int breadcrumbIndex; + public static final String productsModel_TRequiredValidator = null; - @SubapplicationScope - private List breadcrumbItems; + private String breadcrumb; - @SubapplicationScope - private List manufacturersIdItems; + private int breadcrumbIndex; - private BigDecimal manufacturersId; + @SubapplicationScope + private List breadcrumbItems; - private String mode; + @SubapplicationScope + private List manufacturersIdItems; - private BigDecimal parentId; + private BigDecimal manufacturersId; - private BigDecimal productsId; + private String mode; - private String productsImage; + private BigDecimal parentId; - private String productsModel; + private BigDecimal productsId; - private String productsName; + private String productsImage; - private BigDecimal productsPrice; + private UploadedFile productsImageFile; - private BigDecimal productsQuantity; + private String productsModel; - private BigDecimal productsStatus; + private String productsName; - private String productsTaxClass; + private BigDecimal productsPrice; - private BigDecimal productsWeight; + private BigDecimal productsQuantity; - private BigDecimal targetId; + private BigDecimal productsStatus; - private String title; + private String productsTaxClass; - public String getBreadcrumb() { - return breadcrumb; - } + private BigDecimal productsWeight; - public void setBreadcrumb(String breadcrumb) { - this.breadcrumb = breadcrumb; - } + private BigDecimal targetId; - public int getBreadcrumbIndex() { - return breadcrumbIndex; - } + private String title; - public void setBreadcrumbIndex(int breadcrumbIndex) { - this.breadcrumbIndex = breadcrumbIndex; - } + public String getBreadcrumb() { + return breadcrumb; + } - public List getBreadcrumbItems() { - return breadcrumbItems; - } + public void setBreadcrumb(String breadcrumb) { + this.breadcrumb = breadcrumb; + } - public void setBreadcrumbItems(List breadcrumbItems) { - this.breadcrumbItems = breadcrumbItems; - } + public int getBreadcrumbIndex() { + return breadcrumbIndex; + } - public List getManufacturersIdItems() { - return manufacturersIdItems; - } + public void setBreadcrumbIndex(int breadcrumbIndex) { + this.breadcrumbIndex = breadcrumbIndex; + } - public void setManufacturersIdItems(List manufacturerItems) { - this.manufacturersIdItems = manufacturerItems; - } + public List getBreadcrumbItems() { + return breadcrumbItems; + } - public String getMode() { - return mode; - } + public void setBreadcrumbItems(List breadcrumbItems) { + this.breadcrumbItems = breadcrumbItems; + } - public void setMode(String mode) { - this.mode = mode; - } + public List getManufacturersIdItems() { + return manufacturersIdItems; + } - public BigDecimal getParentId() { - return parentId; - } + public void setManufacturersIdItems(List manufacturerItems) { + this.manufacturersIdItems = manufacturerItems; + } - public void setParentId(BigDecimal parentId) { - this.parentId = parentId; - } + public String getMode() { + return mode; + } - public String getProductsImage() { - return productsImage; - } + public void setMode(String mode) { + this.mode = mode; + } - public void setProductsImage(String productsImage) { - this.productsImage = productsImage; - } + public BigDecimal getParentId() { + return parentId; + } - public String getProductsModel() { - return productsModel; - } + public void setParentId(BigDecimal parentId) { + this.parentId = parentId; + } - public void setProductsModel(String productsModel) { - this.productsModel = productsModel; - } + public String getProductsImage() { + return productsImage; + } - public String getProductsName() { - return productsName; - } + public void setProductsImage(String productsImage) { + this.productsImage = productsImage; + } - public void setProductsName(String productsName) { - this.productsName = productsName; - } + /** + * @return productsImageFile + */ + public UploadedFile getProductsImageFile() { + return productsImageFile; + } - public BigDecimal getProductsPrice() { - return productsPrice; - } + /** + * @param productsImageFile 設定する productsImageFile + */ + public void setProductsImageFile(UploadedFile productsImageFile) { + this.productsImageFile = productsImageFile; + } - public void setProductsPrice(BigDecimal productsPrice) { - this.productsPrice = productsPrice; - } + public String getProductsModel() { + return productsModel; + } - public BigDecimal getProductsQuantity() { - return productsQuantity; - } + public void setProductsModel(String productsModel) { + this.productsModel = productsModel; + } - public void setProductsQuantity(BigDecimal productsQuantity) { - this.productsQuantity = productsQuantity; - } + public String getProductsName() { + return productsName; + } - public BigDecimal getProductsStatus() { - return productsStatus; - } + public void setProductsName(String productsName) { + this.productsName = productsName; + } - public void setProductsStatus(BigDecimal productsStatus) { - this.productsStatus = productsStatus; - } + public BigDecimal getProductsPrice() { + return productsPrice; + } - public String getProductsTaxClass() { - return productsTaxClass; - } + public void setProductsPrice(BigDecimal productsPrice) { + this.productsPrice = productsPrice; + } - public void setProductsTaxClass(String productsTaxClass) { - this.productsTaxClass = productsTaxClass; - } + public BigDecimal getProductsQuantity() { + return productsQuantity; + } - public BigDecimal getProductsWeight() { - return productsWeight; - } + public void setProductsQuantity(BigDecimal productsQuantity) { + this.productsQuantity = productsQuantity; + } - public void setProductsWeight(BigDecimal productsWeight) { - this.productsWeight = productsWeight; - } + public BigDecimal getProductsStatus() { + return productsStatus; + } - public BigDecimal getTargetId() { - return targetId; - } + public void setProductsStatus(BigDecimal productsStatus) { + this.productsStatus = productsStatus; + } - public void setTargetId(BigDecimal targetId) { - this.targetId = targetId; - } + public String getProductsTaxClass() { + return productsTaxClass; + } - public String getTitle() { - return title; - } + public void setProductsTaxClass(String productsTaxClass) { + this.productsTaxClass = productsTaxClass; + } - public void setTitle(String title) { - this.title = title; - } + public BigDecimal getProductsWeight() { + return productsWeight; + } - public BigDecimal getManufacturersId() { - return manufacturersId; - } + public void setProductsWeight(BigDecimal productsWeight) { + this.productsWeight = productsWeight; + } - public void setManufacturersId(BigDecimal manufacturersId) { - this.manufacturersId = manufacturersId; - } + public BigDecimal getTargetId() { + return targetId; + } - public BigDecimal getProductsId() { - return productsId; - } + public void setTargetId(BigDecimal targetId) { + this.targetId = targetId; + } - public void setProductsId(BigDecimal productsId) { - this.productsId = productsId; - } + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } + public BigDecimal getManufacturersId() { + return manufacturersId; + } + + public void setManufacturersId(BigDecimal manufacturersId) { + this.manufacturersId = manufacturersId; + } + + public BigDecimal getProductsId() { + return productsId; + } + + public void setProductsId(BigDecimal productsId) { + this.productsId = productsId; + } + } Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListAction.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListAction.java 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/ProductListAction.java 2007-08-04 05:31:23 UTC (rev 443) @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; +import jp.sf.pal.common.util.FacesMessageUtil; import jp.sf.pal.pompei.dxo.CategoriesDxo; import jp.sf.pal.pompei.dxo.ProductDxo; import jp.sf.pal.pompei.exentity.CategoriesDescription; @@ -13,147 +14,156 @@ import jp.sf.pal.pompei.web.admin.product.service.ProductService; public class ProductListAction { - private static final String MODE_DELETE = "delete"; + private static final String MODE_DELETE = "delete"; - /** */ - private ProductListPage productListPage; - /** */ - private ProductService productService; - /** */ - private ProductDxo productDxo; - /** */ - private CategoryService categoryService; - /** */ - private CategoriesDxo categoriesDxo; + /** */ + private ProductListPage productListPage; + /** */ + private ProductService productService; - public Class initialize() { - return null; - } + /** */ + private ProductDxo productDxo; - public Class prerender() { + /** */ + private CategoryService categoryService; - if(productListPage.isDelete()) { - productService.deleteProducts(productListPage.getProductsId()); - } + /** */ + private CategoriesDxo categoriesDxo; - if(productListPage.getParentId() == null) { - productListPage.setParentId(new BigDecimal("0")); - } + public Class initialize() { + return null; + } - if(productListPage.getBreadcrumbItems() == null) { - productListPage.setCategoriesId(new BigDecimal("0")); + public Class prerender() { - List<Map> list = new ArrayList<Map>(); - Map<String, Object> m = new HashMap<String, Object>(); - m.put("categoriesId",new BigDecimal("0")); - m.put("breadcrumb","TOP"); - list.add(m); - productListPage.setBreadcrumbItems(list); + if (productListPage.isDelete()) { + productService.deleteProducts(productListPage.getProductsId()); + } - }else { - if(productListPage.getCategoriesId()!=null) { - productListPage.setParentId(productListPage.getCategoriesId()); - } + if (productListPage.getParentId() == null) { + productListPage.setParentId(new BigDecimal("0")); + } - //パンくずリストを再セット - List list = setBreadcrumb(productListPage.getBreadcrumbItems(),productListPage.getParentId()); - productListPage.setBreadcrumbItems(list); - } + if (productListPage.getBreadcrumbItems() == null) { + productListPage.setCategoriesId(new BigDecimal("0")); - //カテゴリ一覧の取得 - List cList = getCategoriesList(); - productListPage.setCategoryItems(cList); + List<Map> list = new ArrayList<Map>(); + Map<String, Object> m = new HashMap<String, Object>(); + m.put("categoriesId", new BigDecimal("0")); + m.put("breadcrumb", "TOP"); + list.add(m); + productListPage.setBreadcrumbItems(list); - //商品一覧の取得 - List list = productService.getProductsList(productListPage.getParentId()); - List sList = new ArrayList(); - productDxo.convert(list,sList); - productListPage.setProductsItems(sList); + } else { + if (productListPage.getCategoriesId() != null) { + productListPage.setParentId(productListPage.getCategoriesId()); + } - return null; - } + //パンくずリストを再セット + List list = setBreadcrumb(productListPage.getBreadcrumbItems(), + productListPage.getParentId()); + productListPage.setBreadcrumbItems(list); + } - private List getCategoriesList() { - List list = categoryService.getSubCategoryList(productListPage.getParentId()); - List cList = new ArrayList(); - categoriesDxo.convert(list,cList); - return cList; - } + //カテゴリ一覧の取得 + List cList = getCategoriesList(); + productListPage.setCategoryItems(cList); - /** - * @return productListPage - */ - public ProductListPage getProductListPage() { - return productListPage; - } + //商品一覧の取得 + List list = productService.getProductsList(productListPage + .getParentId()); + List sList = new ArrayList(); + productDxo.convert(list, sList); + productListPage.setProductsItems(sList); - /** - * @param productListPage 設定する productListPage - */ - public void setProductListPage(ProductListPage productListPage) { - this.productListPage = productListPage; - } + // render faces messages + FacesMessageUtil.renderMessages(); + return null; + } - /** - * @return productService - */ - public ProductService getProductService() { - return productService; - } + private List getCategoriesList() { + List list = categoryService.getSubCategoryList(productListPage + .getParentId()); + List cList = new ArrayList(); + categoriesDxo.convert(list, cList); + return cList; + } - /** - * @param productService 設定する productService - */ - public void setProductService(ProductService productService) { - this.productService = productService; - } + /** + * @return productListPage + */ + public ProductListPage getProductListPage() { + return productListPage; + } - public CategoryService getCategoryService() { - return categoryService; - } + /** + * @param productListPage 設定する productListPage + */ + public void setProductListPage(ProductListPage productListPage) { + this.productListPage = productListPage; + } - public void setCategoryService(CategoryService categoryListService) { - this.categoryService = categoryListService; - } + /** + * @return productService + */ + public ProductService getProductService() { + return productService; + } - public CategoriesDxo getCategoriesDxo() { - return categoriesDxo; - } + /** + * @param productService 設定する productService + */ + public void setProductService(ProductService productService) { + this.productService = productService; + } - public void setCategoriesDxo(CategoriesDxo categoriesDxo) { - this.categoriesDxo = categoriesDxo; - } + public CategoryService getCategoryService() { + return categoryService; + } - /** - * パンくずリストを返します。 - * @param breadcrumbItems - * @param id - * @return - */ - private List<Map> setBreadcrumb(List<Map> breadcrumbItems, BigDecimal id) { - List<Map> list = new ArrayList<Map>(); - for (Map m : breadcrumbItems) { - list.add(m); - if(((BigDecimal)m.get("categoriesId")).equals(id)) { - return list; - } - } - CategoriesDescription d = categoryService.getCategoriesDescription(productListPage.getCategoriesId()); + public void setCategoryService(CategoryService categoryListService) { + this.categoryService = categoryListService; + } - Map m = new HashMap(); - m.put("categoriesId", id); - m.put("breadcrumb", d.getCategoriesName()); - list.add(m); - return list; - } + public CategoriesDxo getCategoriesDxo() { + return categoriesDxo; + } - public ProductDxo getProductDxo() { - return productDxo; - } + public void setCategoriesDxo(CategoriesDxo categoriesDxo) { + this.categoriesDxo = categoriesDxo; + } - public void setProductDxo(ProductDxo productDxo) { - this.productDxo = productDxo; - } + /** + * パンくずリストを返します。 + * @param breadcrumbItems + * @param id + * @return + */ + private List<Map> setBreadcrumb(List<Map> breadcrumbItems, BigDecimal id) { + List<Map> list = new ArrayList<Map>(); + for (Map m : breadcrumbItems) { + list.add(m); + if (((BigDecimal) m.get("categoriesId")).equals(id)) { + return list; + } + } + CategoriesDescription d = categoryService + .getCategoriesDescription(productListPage.getCategoriesId()); + Map m = new HashMap(); + m.put("categoriesId", id); + m.put("breadcrumb", d.getCategoriesName()); + list.add(m); + return list; + } + + public ProductDxo getProductDxo() { + return productDxo; + } + + public void setProductDxo(ProductDxo productDxo) { + this.productDxo = productDxo; + } + } Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ProductService.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ProductService.java 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/ProductService.java 2007-08-04 05:31:23 UTC (rev 443) @@ -3,23 +3,26 @@ import java.math.BigDecimal; import java.util.List; +import jp.sf.pal.common.CommonException; import jp.sf.pal.pompei.exentity.Manufacturers; import jp.sf.pal.pompei.exentity.ProductsDescription; -public interface ProductService { +public interface ProductService { - public void addProducts(ProductsDescription description, BigDecimal categoriesId); + public void addProducts(ProductsDescription description, + BigDecimal categoriesId) throws CommonException; - public void deleteProducts(BigDecimal productsId); + public void deleteProducts(BigDecimal productsId); - public ProductsDescription getProdcutsDescription(BigDecimal id); + public ProductsDescription getProdcutsDescription(BigDecimal id); - public List getProductsList(); + public List getProductsList(); - public List getProductsList(BigDecimal categoriesId); + public List getProductsList(BigDecimal categoriesId); - public void updateProducts(ProductsDescription description); + public void updateProducts(ProductsDescription description) + throws CommonException; - public Manufacturers getManufacturers(BigDecimal manufacturersId); + public Manufacturers getManufacturers(BigDecimal manufacturersId); } Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ProductServiceImpl.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ProductServiceImpl.java 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/admin/product/service/impl/ProductServiceImpl.java 2007-08-04 05:31:23 UTC (rev 443) @@ -6,6 +6,7 @@ import java.util.Date; import java.util.List; +import jp.sf.pal.common.CommonException; import jp.sf.pal.pompei.cbean.ManufacturersCB; import jp.sf.pal.pompei.cbean.ProductsDescriptionCB; import jp.sf.pal.pompei.cbean.ProductsToCategoriesCB; @@ -17,122 +18,143 @@ import jp.sf.pal.pompei.exentity.Products; import jp.sf.pal.pompei.exentity.ProductsDescription; import jp.sf.pal.pompei.exentity.ProductsToCategories; +import jp.sf.pal.pompei.util.UploadedFileUtil; import jp.sf.pal.pompei.web.admin.product.service.ProductService; -public class ProductServiceImpl implements ProductService{ +public class ProductServiceImpl implements ProductService { - private ProductsDescriptionBhv productsDescriptionBhv; - private ProductsBhv productsBhv; - private ProductsToCategoriesBhv productsToCategoriesBhv; - private ManufacturersBhv manufacturersBhv; + private ProductsDescriptionBhv productsDescriptionBhv; + private ProductsBhv productsBhv; - public void addProducts(ProductsDescription description, BigDecimal categoriesId) { + private ProductsToCategoriesBhv productsToCategoriesBhv; - Products products = description.getProducts(); - products.setProductsDateAdded(new Timestamp(new Date().getTime())); - products.setProductsLastModified(new Timestamp(new Date().getTime())); - productsBhv.insert(products); + private ManufacturersBhv manufacturersBhv; - description.setProductsId(products.getProductsId()); - productsDescriptionBhv.insert(description); + public void addProducts(ProductsDescription description, + BigDecimal categoriesId) throws CommonException { - ProductsToCategories toCategories = new ProductsToCategories(); - toCategories.setCategoriesId(categoriesId); - toCategories.setProductsId(products.getProductsId()); - productsToCategoriesBhv.insert(toCategories); + Products products = description.getProducts(); + products.setProductsDateAdded(new Timestamp(new Date().getTime())); + products.setProductsLastModified(new Timestamp(new Date().getTime())); + productsBhv.insert(products); - } + description.setProductsId(products.getProductsId()); + productsDescriptionBhv.insert(description); - public void deleteProducts(BigDecimal productsId) { - ProductsDescription description = getProdcutsDescription(productsId); - Products products = description.getProducts(); - List<Products> list = new ArrayList<Products>(); - list.add(products); - productsBhv.loadProductsToCategoriesList(list); + ProductsToCategories toCategories = new ProductsToCategories(); + toCategories.setCategoriesId(categoriesId); + toCategories.setProductsId(products.getProductsId()); + productsToCategoriesBhv.insert(toCategories); - List<ProductsToCategories> toCategoriesList = products.getProductsToCategoriesList(); - productsToCategoriesBhv.delegateDeleteList(toCategoriesList); - productsDescriptionBhv.delete(description); - productsBhv.delegateDelete(products); - } + if (description.getProductsImageFile() != null) { + String filename = UploadedFileUtil.storeProduct(products + .getProductsId(), description.getProductsImageFile()); + products.setProductsImage(filename); + productsBhv.update(products); + } + } - public ProductsDescription getProdcutsDescription(BigDecimal id) { - ProductsDescriptionCB descriptionCB = new ProductsDescriptionCB(); - descriptionCB.setupSelect_Products(); + public void deleteProducts(BigDecimal productsId) { + ProductsDescription description = getProdcutsDescription(productsId); + Products products = description.getProducts(); + List<Products> list = new ArrayList<Products>(); + list.add(products); + productsBhv.loadProductsToCategoriesList(list); - descriptionCB.query().setLanguageId_Equal(new BigDecimal("1")); - descriptionCB.query().setProductsId_Equal(id); - return productsDescriptionBhv.selectEntity(descriptionCB); - } + List<ProductsToCategories> toCategoriesList = products + .getProductsToCategoriesList(); + productsToCategoriesBhv.delegateDeleteList(toCategoriesList); + productsDescriptionBhv.delete(description); + productsBhv.delegateDelete(products); - public List getProductsList() { - // TODO 自動生成されたメソッド・スタブ - return null; - } + //TODO remove image + } - public List getProductsList(BigDecimal categoriesId) { - ProductsToCategoriesCB categoriesCB = new ProductsToCategoriesCB(); - categoriesCB.setupSelect_Products(); - categoriesCB.setupSelect_Products().withManufacturers(); - categoriesCB.query().setCategoriesId_Equal(categoriesId); - List<ProductsToCategories> list = productsToCategoriesBhv.selectList(categoriesCB); + public ProductsDescription getProdcutsDescription(BigDecimal id) { + ProductsDescriptionCB descriptionCB = new ProductsDescriptionCB(); + descriptionCB.setupSelect_Products(); - List productsList = new ArrayList(); - for (ProductsToCategories categories : list) { - productsList.add(categories.getProducts()); - } - productsBhv.loadProductsDescriptionList(productsList); + descriptionCB.query().setLanguageId_Equal(new BigDecimal("1")); + descriptionCB.query().setProductsId_Equal(id); + return productsDescriptionBhv.selectEntity(descriptionCB); + } - return productsList; - } + public List getProductsList() { + // TODO 自動生成されたメソッド・スタブ + return null; + } - public void updateProducts(ProductsDescription description) { - Products products = description.getProducts(); - products.setProductsLastModified(new Timestamp(new Date().getTime())); - productsBhv.update(products); + public List getProductsList(BigDecimal categoriesId) { + ProductsToCategoriesCB categoriesCB = new ProductsToCategoriesCB(); + categoriesCB.setupSelect_Products(); + categoriesCB.setupSelect_Products().withManufacturers(); + categoriesCB.query().setCategoriesId_Equal(categoriesId); + List<ProductsToCategories> list = productsToCategoriesBhv + .selectList(categoriesCB); - productsDescriptionBhv.update(description); - } + List productsList = new ArrayList(); + for (ProductsToCategories categories : list) { + productsList.add(categories.getProducts()); + } + productsBhv.loadProductsDescriptionList(productsList); - public ProductsDescriptionBhv getProductsDescriptionBhv() { - return productsDescriptionBhv; - } + return productsList; + } - public void setProductsDescriptionBhv(ProductsDescriptionBhv descriptionBhv) { - this.productsDescriptionBhv = descriptionBhv; - } + public void updateProducts(ProductsDescription description) throws CommonException{ + Products products = description.getProducts(); + products.setProductsLastModified(new Timestamp(new Date().getTime())); + + if (description.getProductsImageFile() != null) { + String filename = UploadedFileUtil.storeProduct(products + .getProductsId(), description.getProductsImageFile()); + products.setProductsImage(filename); + } + + productsBhv.update(products); - public ProductsBhv getProductsBhv() { - return productsBhv; - } + productsDescriptionBhv.update(description); + } - public void setProductsBhv(ProductsBhv productsBhv) { - this.productsBhv = productsBhv; - } + public ProductsDescriptionBhv getProductsDescriptionBhv() { + return productsDescriptionBhv; + } - public ProductsToCategoriesBhv getProductsToCategoriesBhv() { - return productsToCategoriesBhv; - } + public void setProductsDescriptionBhv(ProductsDescriptionBhv descriptionBhv) { + this.productsDescriptionBhv = descriptionBhv; + } - public void setProductsToCategoriesBhv( - ProductsToCategoriesBhv productsToCategoriesBhv) { - this.productsToCategoriesBhv = productsToCategoriesBhv; - } + public ProductsBhv getProductsBhv() { + return productsBhv; + } - public Manufacturers getManufacturers(BigDecimal manufacturersId) { - ManufacturersCB manufacturersCB = new ManufacturersCB(); - manufacturersCB.query().setManufacturersId_Equal(manufacturersId); + public void setProductsBhv(ProductsBhv productsBhv) { + this.productsBhv = productsBhv; + } - return manufacturersBhv.selectEntity(manufacturersCB); - } + public ProductsToCategoriesBhv getProductsToCategoriesBhv() { + return productsToCategoriesBhv; + } - public ManufacturersBhv getManufacturersBhv() { - return manufacturersBhv; - } + public void setProductsToCategoriesBhv( + ProductsToCategoriesBhv productsToCategoriesBhv) { + this.productsToCategoriesBhv = productsToCategoriesBhv; + } - public void setManufacturersBhv(ManufacturersBhv manufacturersBhv) { - this.manufacturersBhv = manufacturersBhv; - } + public Manufacturers getManufacturers(BigDecimal manufacturersId) { + ManufacturersCB manufacturersCB = new ManufacturersCB(); + manufacturersCB.query().setManufacturersId_Equal(manufacturersId); + return manufacturersBhv.selectEntity(manufacturersCB); + } + + public ManufacturersBhv getManufacturersBhv() { + return manufacturersBhv; + } + + public void setManufacturersBhv(ManufacturersBhv manufacturersBhv) { + this.manufacturersBhv = manufacturersBhv; + } + } Modified: pompei/portlets/pompei-core/trunk/src/main/resources/appMessages.properties =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/resources/appMessages.properties 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/resources/appMessages.properties 2007-08-04 05:31:23 UTC (rev 443) @@ -1,2 +1,9 @@ added.product.to.cart=Added the product to a cart. + +# UploadedFileUtil +could.not.retrive.image.path=Could not retrive an image path. Please contact a site administrator. +unsupported.file.format=Unsupported file format. Please use .jpg, .gif or .png file. +could.not.save.uploaded.file=Could not save your uploaded file. Please try again. If you see this error again, please contact a site administrator. + + Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/WEB-INF/portlet.xml =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/webapp/WEB-INF/portlet.xml 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/webapp/WEB-INF/portlet.xml 2007-08-04 05:31:23 UTC (rev 443) @@ -23,6 +23,10 @@ <display-name xml:lang="ja">Pompei: カテゴリ管理</display-name> <portlet-class>org.apache.portals.bridges.portletfilter.FilterPortlet</portlet-class> <init-param> + <name>jp.sf.pal.jsf.filter.FileUploadPortletFilter:multipartEncoding</name> + <value>UTF-8</value> + </init-param> + <init-param> <name>portlet-class</name> <value>org.seasar.teeda.core.portlet.FacesPortlet</value> </init-param> @@ -60,6 +64,10 @@ <display-name xml:lang="ja">Pompei: メーカー管理</display-name> <portlet-class>org.apache.portals.bridges.portletfilter.FilterPortlet</portlet-class> <init-param> + <name>jp.sf.pal.jsf.filter.FileUploadPortletFilter:multipartEncoding</name> + <value>UTF-8</value> + </init-param> + <init-param> <name>portlet-class</name> <value>org.seasar.teeda.core.portlet.FacesPortlet</value> </init-param> @@ -97,6 +105,10 @@ <display-name xml:lang="ja">Pompei: 商品管理</display-name> <portlet-class>org.apache.portals.bridges.portletfilter.FilterPortlet</portlet-class> <init-param> + <name>jp.sf.pal.jsf.filter.FileUploadPortletFilter:multipartEncoding</name> + <value>UTF-8</value> + </init-param> + <init-param> <name>portlet-class</name> <value>org.seasar.teeda.core.portlet.FacesPortlet</value> </init-param> @@ -139,7 +151,7 @@ </init-param> <init-param> <name>portlet-filters</name> - <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter,jp.sf.pal.jsf.filter.FileUploadPortletFilter</value> + <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter</value> </init-param> <init-param> <name>view-page</name> @@ -176,7 +188,7 @@ </init-param> <init-param> <name>portlet-filters</name> - <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter,jp.sf.pal.jsf.filter.FileUploadPortletFilter</value> + <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter</value> </init-param> <init-param> <name>view-page</name> @@ -213,7 +225,7 @@ </init-param> <init-param> <name>portlet-filters</name> - <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter,jp.sf.pal.jsf.filter.FileUploadPortletFilter</value> + <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter</value> </init-param> <init-param> <name>view-page</name> @@ -250,7 +262,7 @@ </init-param> <init-param> <name>portlet-filters</name> - <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter,jp.sf.pal.jsf.filter.FileUploadPortletFilter</value> + <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter</value> </init-param> <init-param> <name>view-page</name> @@ -287,7 +299,7 @@ </init-param> <init-param> <name>portlet-filters</name> - <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter,jp.sf.pal.jsf.filter.FileUploadPortletFilter</value> + <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.pooptimizer.OptimizerFilter,org.seasar.portlet.filter.S2PortletFilter,org.seasar.portlet.filter.HotdeployPortletFilter</value> </init-param> <init-param> <name>view-page</name> Added: pompei/portlets/pompei-core/trunk/src/main/webapp/images/products/README.txt =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/webapp/images/products/README.txt 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/webapp/images/products/README.txt 2007-08-04 05:31:23 UTC (rev 443) @@ -0,0 +1 @@ +Image Directory for Products Property changes on: pompei/portlets/pompei-core/trunk/src/main/webapp/images/products/README.txt ___________________________________________________________________ Name: svn:eol-style + native Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productEdit.html =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productEdit.html 2007-08-04 05:29:08 UTC (rev 442) +++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/admin/product/productEdit.html 2007-08-04 05:31:23 UTC (rev 443) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja" xmlns:pal="http://pal.sourceforge.jp/jsf4portlet"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title id="title-head">商品登録編集画面</title> @@ -13,7 +13,7 @@ > <span id="breadcrumb">パンくずリスト</span> </div> <hr/> -<form id="form" method="POST"> +<form id="form" method="post" enctype="multipart/form-data"> <div><span id="allMessages"></span></div> <input type="hidden" id="mode" /> <input type="hidden" id="targetId" /> @@ -24,7 +24,7 @@ <th>商品名</th><td><input id="productsName" /></td> </tr> <tr style="dummy" height="20px"> - <th>イメージ</th><td><input id="productsImage" /></td> + <th>イメージ</th><td><input id="productsImage" type="hidden"/><pal:inputFileUpload id="productsImageFile" value="#{admin_product_productEditPage.productsImageFile}"></pal:inputFileUpload></td> </tr> <tr style="dummy" height="20px"> <th>型番</th><td><input id="productsModel" /></td>