📄 photoupload.java
字号:
package huitong.servlet;
import huitong.util.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import huitong.javabean.*;
import huitong.util.db.*;
public class PhotoUpLoad extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws javax.servlet.ServletException,java.io.IOException
{
HttpSession session = request.getSession();
if (session.getAttribute("userName") == null)
{
response.sendRedirect("/photo/logon.jsp");
return;
}
String photoInfo[] = new ImgUp().setSourcefile(request);
String photo_albumId = photoInfo[0];
String photoName = photoInfo[1];
String photoAlt = photoInfo[2];
String photoSuffix = photoInfo[3];
String photoId = photoInfo[4];
//生成相片对象
AlbumPhoto photo = new AlbumPhoto();
photo.setPhoto_albumId(photo_albumId);
photo.setPhotoName(photoName);
photo.setPhotoAlt(photoAlt);
photo.setPhotoSuffix(photoSuffix);
photo.setPhotoId(photoId);
new PhotoTable().addPhoto(photo);
String oper="oper=DoMenu('ChildMenu3');" +
"addPhoto('div_ChildMenu3');" +
"alert('ok!');";
//response.sendRedirect("/photo/show/index.jsp?"+oper);
response.sendRedirect("/photo/show/up_js.html");
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws javax.servlet.ServletException,java.io.IOException
{
System.out.println("in PhotopLoad "+request.getSession().getAttribute("userName") );
doGet(request,response);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -