14
14
import com .saf .app .lostpet .vo .LostPetVO ;
15
15
16
16
public class LostPetWriteOk implements Action {
17
- @ Override
18
- public ActionForward execute (HttpServletRequest req , HttpServletResponse resp ) throws IOException {
19
-
20
-
21
-
22
- String uploadFolder = "C:\\ aigb_0900_ksy\\ 1team_image" ; //request.getSession().getServletContext().getRealPath("");
23
- int fileSize = 1024 * 1024 * 5 ;//5M
24
-
25
- //요청객체, 업로드폴더 경로, 파일의 크기, 인코딩 방식, 이름변경정책
26
- MultipartRequest multi = new MultipartRequest (req , uploadFolder , fileSize , "UTF-8" , new DefaultFileRenamePolicy ());
27
-
28
-
29
- System .out .println (multi .getParameter ("lpstatus" ));
30
- System .out .println (multi .getParameter ("lpgender" ));
31
- System .out .println (multi .getParameter ("lpcontent" ));
32
- LostPetDAO lpDao = new LostPetDAO ();
33
-
34
-
35
-
36
- FilesDAO fDao = new FilesDAO ();
37
- LostPetVO lostpet = new LostPetVO ();
38
- ActionForward af = new ActionForward ();
39
- lostpet .setLpstatus (Integer .parseInt (multi .getParameter ("lpstatus" )));
40
- lostpet .setLparea1 (multi .getParameter ("lparea1" ));
41
- lostpet .setLparea2 (multi .getParameter ("lparea2" ));
42
- lostpet .setLparea3 (multi .getParameter ("lparea3" ));
43
- lostpet .setLpspecies (multi .getParameter ("lpspecies" ));
44
- lostpet .setLpbreed (multi .getParameter ("lpbreed" ));
45
- lostpet .setLpgender (multi .getParameter ("lpgender" ));
46
- lostpet .setLpage (multi .getParameter ("lpage" ));
47
- lostpet .setLpcolor (multi .getParameter ("lpcolor" ));
48
- lostpet .setLptime (multi .getParameter ("lptime" ));
49
- lostpet .setLpcontent (multi .getParameter ("lpcontent" ));
50
- lostpet .setUnum (1 );
51
-
52
- //게시글 추가
53
- lpDao .insert (lostpet );
54
- //파일 추가
55
- fDao .insert (multi , lpDao .getSeq ());
56
-
57
- af .setRedirect (true );
58
- af .setPath (req .getContextPath () + "/lostpet/controller/LostPetListOk.lo" );
59
-
60
- return af ;
61
- }
17
+ @ Override
18
+ public ActionForward execute (HttpServletRequest req , HttpServletResponse resp ) throws IOException {
19
+
20
+
21
+
22
+ // String uploadFolder = "C:\\aigb_0900_ksy\\1team_image"; //request.getSession().getServletContext().getRealPath("");
23
+ String rootPath = req .getSession ().getServletContext ().getRealPath ("/" );
24
+ String uploadFolder = rootPath + "lostpet\\ images\\ " ;
25
+ int fileSize = 1024 * 1024 * 5 ;//5M
26
+
27
+ //요청객체, 업로드폴더 경로, 파일의 크기, 인코딩 방식, 이름변경정책
28
+ MultipartRequest multi = new MultipartRequest (req , uploadFolder , fileSize , "UTF-8" , new DefaultFileRenamePolicy ());
29
+
30
+
31
+ System .out .println (multi .getParameter ("lpstatus" ));
32
+ System .out .println (multi .getParameter ("lpgender" ));
33
+ System .out .println (multi .getParameter ("lpcontent" ));
34
+ LostPetDAO lpDao = new LostPetDAO ();
35
+
36
+
37
+
38
+ FilesDAO fDao = new FilesDAO ();
39
+ LostPetVO lostpet = new LostPetVO ();
40
+ ActionForward af = new ActionForward ();
41
+ lostpet .setLpstatus (Integer .parseInt (multi .getParameter ("lpstatus" )));
42
+ lostpet .setLparea1 (multi .getParameter ("lparea1" ));
43
+ lostpet .setLparea2 (multi .getParameter ("lparea2" ));
44
+ lostpet .setLparea3 (multi .getParameter ("lparea3" ));
45
+ lostpet .setLpspecies (multi .getParameter ("lpspecies" ));
46
+ lostpet .setLpbreed (multi .getParameter ("lpbreed" ));
47
+ lostpet .setLpgender (multi .getParameter ("lpgender" ));
48
+ lostpet .setLpage (multi .getParameter ("lpage" ));
49
+ lostpet .setLpcolor (multi .getParameter ("lpcolor" ));
50
+ lostpet .setLptime (multi .getParameter ("lptime" ));
51
+ lostpet .setLpcontent (multi .getParameter ("lpcontent" ));
52
+ lostpet .setUnum (1 );
53
+
54
+ //게시글 추가
55
+ lpDao .insert (lostpet );
56
+ //파일 추가
57
+ fDao .insert (multi , lpDao .getSeq ());
58
+
59
+ af .setRedirect (true );
60
+ af .setPath (req .getContextPath () + "/lostpet/controller/LostPetListOk.lo" );
61
+
62
+ return af ;
63
+ }
62
64
63
- }
65
+ }
0 commit comments