photoaddaction.java~8~

来自「一、数据库登录名:blog 密码:blog 二、首页应该运行log.jsp页面」· JAVA~8~ 代码 · 共 38 行

JAVA~8~
38
字号
package Action;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import ActionForm.photoActionForm;
import org.apache.struts.action.Action;
import OperationDB.operation;
import org.apache.struts.upload.FormFile;
import javax.servlet.http.HttpSession;
import java.io.UnsupportedEncodingException;
import Tool.UploadFile;
public class photoAddAction extends Action {
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws Exception {
        photoActionForm photoActionForm = (photoActionForm) form;
         operation o=new operation();
   UploadFile uploadFile = new UploadFile();
   String dir = servlet.getServletContext().getRealPath("/photo");
    FormFile formfile=photoActionForm.getFormfile();
     String getType=formfile.getFileName().substring(formfile.getFileName().lastIndexOf(".")+1);
    String imageType[]={"JPG","BMP","bmp","gif","jpg"};
  for(int ii=0;ii<imageType.length;ii++){
    if(imageType[ii].equals(getType)){
        photoActionForm.setPhotoAddress("photo/"+uploadFile.upload(dir,formfile));
        photoActionForm.setPhotoDescription(request.getParameter("description"));
        photoActionForm.setPhotoTime(request.getParameter("time"));
      boolean flag=o.addphoto(photoActionForm);
    }
  }
        throw new java.lang.UnsupportedOperationException(
                "Method $execute() not yet implemented.");
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?