点击服务店专页链接,或直接输入网址www.woojii.com/woojii.html,其中woojii为数据表中查询出来的参数,通过传参数可动态传参显示不同用户的数据。生成本用户网页的二维码,
现在的问题为,在本地访问线上该URL可生成每一个用户的二维码,升级上服务器之后,不能生成二维码,及不能访问页面(本地可以生成线上二维码,线上不能生成线上的二维码)。jdbc+struts1
public ActionForward mywzcxpage(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
CarcodeForm mypageForm = new CarcodeForm();
String userName;
String userNameParam;
String urlqrcodeurlqrcodeUrl=null;
String urlqrcodeurlqrcodeUrlLogo=null;
String urlqrcodeFileName=null;
String qrcodeUrl = null;
String fileName=null;
StringBuffer url = request.getRequestURL();
userNameParam=request.getQueryString();
userName =userNameParam.substring(27);
mypageForm = wzcxdao.selmypage(userName);
int userID =mypageForm.getId();
//System.out.println("输出获取到的charge_id"+userID+"iii");
//获取服务器路径
String urlqrcodePath = request.getRealPath("urlqrcode");
String urlqrcodeLogopath =request.getRealPath("urlqrcodeLogo");
//获取待生成二维码的地址
String text ="http://www.woojii.com/"+userName+".html";
//String text = "http://www.woojii.com";
urlqrcodeurlqrcodeUrl = urlqrcodePath + "/" + urlqrcodeLogopath;
//得到上传至服务器的二维码
urlqrcodeurlqrcodeUrlLogo =urlqrcodePath+"/"+text;
if(mypageForm.getFwdQRCode()==null||mypageForm.getFwdQRCode()==""){
try {
fileName= QRCodeUtil.encode(text, null, urlqrcodePath, true);
} catch (Exception e) {
System.err.println("二维码生成失败,错误代码如下:");
e.printStackTrace();
}
String fileName1 = fileName.substring(fileName.lastIndexOf('.'));
fileName1 = userID + fileName1;
wzcxdao.urlqrcode(userID, fileName1);
request.setAttribute("fileName", fileName);
}else{}
System.out.println("截取到用户的字段"+userName+"\n"+userNameParam+"\n"+url);
request.setAttribute("userName", userName);
request.setAttribute("mypageForm", mypageForm);
return mapping.findForward("mywzcxpage");
}