点提交按钮的时候出现http://localhost:8080/productUpload.do为空白页 谢谢
我的xml:
<form-bean name="productUploadForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="product_Name" type="java.lang.String"></form-property>
<form-property name="categoryId" type="java.lang.Long"></form-property>
。
</form-bean>
<global-forwards >
<forward name="productUpload" path="/upload.jsp"></forward>
<forward name="showPrduct" path="/showProduct.jsp"></forward>
</global-forwards>
<action-mappings>
<action attribute="productUploadForm"
name="productUploadForm"
path="/productUpload"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy"/>JSP页面:<form action="/productUpload.do" method="post">action里面:
DynaValidatorForm ppForm = (DynaValidatorForm) form;
//接受产品类别名称
String categoryName =(String)ppForm.get("categoryName");
Long companyId = (Long)ppForm.get("companyId");
Long categoryId = (Long)ppForm.get("categoryId");
Long listPrice =(Long)ppForm.get("listPrice");// 价格
Long specialPrice =(Long)ppForm.get("specialPrice");//特价 //接受产品名称
String productName=(String)ppForm.get("productName");//产品名称
System.out.println(productName+"------------------------->");
CompanyProfile ins_company = null;
if(null != companyId && companyId>0)ins_company = cpService.findById(companyId);
ProductCategories ins_categories = null;
if(null != categoryId && categoryId>0)ins_categories = pcService.getCategories(categoryId);
if(categoryName.equals("钻石首饰")){
String jewelleryType = (String)ppForm.get("jewelleryType")
System.out.println(jewelleryType);
Long caratWeight =(Long)(ppForm.get("caratWeight"));//
System.out.println(caratWeight);
Long netWeightGram =(Long)(ppForm.get("netWeightGram"));/
Long sideStoneWeight=(Long)(ppForm.get("sideStoneWeight"));
Long mainStoneWeight =(Long)(ppForm.get("mainStoneWeight"));
String diamondColour =(String) ppForm.get("diamondColour");
String diamondClarity= (String)ppForm.get("diamondClarity");
String diamondCutting = (String)ppForm.get("diamondCutting");
String goldAlloy = (String)ppForm.get("goldAlloy");
String goldColour = (String)ppForm.get("goldColour");
String stoneShape = (String)ppForm.get("stoneShape");
String productOfOrigin = (String)ppForm.get("productOfOrigin");
Long lengthCm =(Long)(ppForm.get("lengthcm"));
String stoneSettingType = (String)ppForm.get("stoneSettingType");
String productSeriesName = (String)ppForm.get("productSeriesName");
Long ringSize =(Long)(ppForm.get("ringSize"));
String productDescription = (String)ppForm.get("productDescription");
ProductProfiles product = new ProductProfiles(categoryId, companyId,productName,
productDescription, null,
productSeriesName, new Date(), null,
productOfOrigin, listPrice, specialPrice,
jewelleryType, caratWeight, netWeightGram,
sideStoneWeight, mainStoneWeight, diamondColour,
diamondClarity, diamondCutting,
stoneSettingType, null, stoneShape,
goldAlloy, goldColour, null,
null, null, null,null,lengthCm,ringSize,
new Date(), new Date());
我的xml:
<form-bean name="productUploadForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="product_Name" type="java.lang.String"></form-property>
<form-property name="categoryId" type="java.lang.Long"></form-property>
。
</form-bean>
<global-forwards >
<forward name="productUpload" path="/upload.jsp"></forward>
<forward name="showPrduct" path="/showProduct.jsp"></forward>
</global-forwards>
<action-mappings>
<action attribute="productUploadForm"
name="productUploadForm"
path="/productUpload"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy"/>JSP页面:<form action="/productUpload.do" method="post">action里面:
DynaValidatorForm ppForm = (DynaValidatorForm) form;
//接受产品类别名称
String categoryName =(String)ppForm.get("categoryName");
Long companyId = (Long)ppForm.get("companyId");
Long categoryId = (Long)ppForm.get("categoryId");
Long listPrice =(Long)ppForm.get("listPrice");// 价格
Long specialPrice =(Long)ppForm.get("specialPrice");//特价 //接受产品名称
String productName=(String)ppForm.get("productName");//产品名称
System.out.println(productName+"------------------------->");
CompanyProfile ins_company = null;
if(null != companyId && companyId>0)ins_company = cpService.findById(companyId);
ProductCategories ins_categories = null;
if(null != categoryId && categoryId>0)ins_categories = pcService.getCategories(categoryId);
if(categoryName.equals("钻石首饰")){
String jewelleryType = (String)ppForm.get("jewelleryType")
System.out.println(jewelleryType);
Long caratWeight =(Long)(ppForm.get("caratWeight"));//
System.out.println(caratWeight);
Long netWeightGram =(Long)(ppForm.get("netWeightGram"));/
Long sideStoneWeight=(Long)(ppForm.get("sideStoneWeight"));
Long mainStoneWeight =(Long)(ppForm.get("mainStoneWeight"));
String diamondColour =(String) ppForm.get("diamondColour");
String diamondClarity= (String)ppForm.get("diamondClarity");
String diamondCutting = (String)ppForm.get("diamondCutting");
String goldAlloy = (String)ppForm.get("goldAlloy");
String goldColour = (String)ppForm.get("goldColour");
String stoneShape = (String)ppForm.get("stoneShape");
String productOfOrigin = (String)ppForm.get("productOfOrigin");
Long lengthCm =(Long)(ppForm.get("lengthcm"));
String stoneSettingType = (String)ppForm.get("stoneSettingType");
String productSeriesName = (String)ppForm.get("productSeriesName");
Long ringSize =(Long)(ppForm.get("ringSize"));
String productDescription = (String)ppForm.get("productDescription");
ProductProfiles product = new ProductProfiles(categoryId, companyId,productName,
productDescription, null,
productSeriesName, new Date(), null,
productOfOrigin, listPrice, specialPrice,
jewelleryType, caratWeight, netWeightGram,
sideStoneWeight, mainStoneWeight, diamondColour,
diamondClarity, diamondCutting,
stoneSettingType, null, stoneShape,
goldAlloy, goldColour, null,
null, null, null,null,lengthCm,ringSize,
new Date(), new Date());
如果有的话看看upload.jsp有没有问题
2.查看是否有return 返回的字符串是否和.xml配置文件中的<forword name>是否对应上了,没写错
3.检查成功后转向的页面,可能是页面问题
但是不管是return mapping.findForward(),还是return null都应该有return阿
你是部署的过程中出现这个问题的吗?
我们之前遇到过一次空白页的问题,当时是因为进行部署时使用了Tomcat5.5的服务器,而开发时采用Tomcat 5.0!
查看一下服务器的错误信息,或者尝试在action中输出一些提示信息!
你是部署的过程中出现这个问题的吗?
我们之前遇到过一次空白页的问题,当时是因为进行部署时使用了Tomcat5.5的服务器,而开发时采用Tomcat 5.0!
查看一下服务器的错误信息,或者尝试在action中输出一些提示信息!
情况有如:
1、return new ActionForward("success");
2、return mapping.findForward("success");
3、ActionForward forward = new ActionForward("/success");
return forward;
三种情况将会出现不同的结果!!经常白板,郁闷!!!经常出错,有时候明明写了,程序也走了,但是页面还是白板
可以多次尝试,最后用第三种情况取得成功
http://localhost:8080/productUpload.do
这个怎么没有工程的context路径呢,比如http://localhost:8080/工程context/productUpload.do
看下action的相对路径有没写对