자료실

server.xml에 

     <Context docBase="파일관리프로젝트" path="/파일관리프로젝트" reloadable="true" source="org.eclipse.jst.jee.server:파일관리프로젝트"/>   -응 자동으로 잡히고

     <Context docBase="D:\\upload" path="/files"   reloadable="true"  />   -는 써준다.(업로드는 수동으로 잡아주어야함)

그러면 D:\\upload 에는 WEB-INF 폴더를 만들어주고 web.xml은 아래와 같이 만들어준다.

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"

  version="3.0"

  metadata-complete="true">


  <display-name>Upload</display-name>

  <description>

     Welcome to Tomcat

  </description>

  <welcome-file-list>

    <welcome-file>filelist.jsp.html</welcome-file>

  </welcome-file-list>

</web-app>

지난번에 했던 파일관리 프로젝트에서

fileupload.jsp에 내용 조금 추가.

MultipartRequest mr = new MultipartRequest(request, dir, max, "utf-8", new DefaultFileRenamePolicy()); 밑에

response.sendRedirect("/files/filelist.jsp");  를 추가.

그리고 upload 폴더에 filelist.jsp

<%@ page contentType="text/html;charset=utf-8" %>

<jsp:directive.page import="java.util.Date, java.io.File" />


<%

String path = application.getRealPath(".");

File dirFile = new File(path);

File [] fileList = dirFile.listFiles();

%>

<!doctype html>

<html lang="ko">

 <head>

  <meta charset="UTF-8">

  <title>자료실</title>

 </head>

 <body>

<h3 align='center'><%=path %>파일 목록</h3>

<table width="50%" style="border-collapase:collapse;margin:auto" cellpadding="5">

<%  

for(int i = 0 ; i < fileList.length ;i++){

      String name = fileList[i].getName();

  if(!name.endsWith(".jsp")){

   %>

      <tr>

<td style="border:0px solid black" width="70%">

<% if(fileList[i].isDirectory()){ %>

<img src="images/dir.png" width="20" height="20"><%=name%>

<% }else { //파일이라면 %>

<img src="images/file.png" width="20" height="20">

<a href="<%=name%>"><%=name%></a>

<% } %>

</td>

<td style="border:0px solid black">

<%=fileList[i].length() %>

</td>

<td style="border:0px solid black">

<%

Date d = new Date(fileList[i].lastModified());

out.print(d.toLocaleString());

%>

</td>

  </tr>

   <%  

} //if end

}//for end 

%>

</table>

 </body>

</html>


해주고.... 

---------------------

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

centos 의 mail 서버 깐 것을 열어

su

cd /etc/mail

gedit access 의 제일 밑에

Connect: 192.168.64.1 RELAY   를 추가하고 (요청하는 쪽)

아이피는 내 윈도우의 (VMware Network Adpater VMnet8)아이피.

service saslauthd start 

service sendmail start

service xinetd start

윈도우즈에서 centos 아이피로 접속.

telnet 192.168.89.135 25   

ehlo javaexpert.co.kr

mail from : instructor@havaexpert.co.kr

rcpt to : jongsoon.bok@gmail.com

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

윈도우즈 http://www.apache.org/ 접속. james 누르고,

Download Stable James Server 2.3.2 누르고,

Binary (ZIP Format): james-binary-2.3.2.zip 눌러 다운.

압축을 여기에 풀기로 풀고 이름을 james 로 바꾸고, C드라이브에 위치시킴.

알집을 열고 C:\james\apps폴더에 james.sar 파일을 열어서 압축을 풀어줌.

C:\james\apps\james\SAR-INF 폴더의 config.xml 을 열어

73라인의 localhost 부분을 자기 윈도우의 아이피로 바꿔줌.

815라인 login 과 password의 이 메일서비스를 쓸 사람.(root/javajames로 해줬음)

779라인 781라인 주석제거

780라인을 아래와 같이 변경.

<server>192.168.8.151</server>

<server>127.0.0.1</server>


<server>168.126.63.1</server>

3번째 쓴것은 KT DNS임.

저장후 나와서

명령프롬프트 띄우고

cd c:\james

cd bin

run

새로운 명령프롬프트 띄어서 

telnet localhost 4555

Login id: 에 root

Password: 에 javajames

그리고 james는 메일보내기 기능이 없다고 말씀하셨다 두둥.

--------------------------

telnet 192.168.8.151 25

ehlo Windows81-04

mail from:<admin@javaexpert.co.kr>

rcpt to:<jongsoon.bok@gmail.com>

또 안됨.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

service mysqld stauts 로 mysql이 돌아가고있는지 확인.

gesipan.sql

CREATE TABLE Gesipan

(

idx                   INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,

name                  VARCHAR(20) NOT NULL,

passwd                VARCHAR(12) NOT NULL,

email                 VARCHAR(50) NOT NULL,

title                 VARCHAR(100) NOT NULL,

contents              TEXT NOT NULL,

writedate             DATE NOT NULL,

readcount             MEDIUMINT NOT NULL,

filename              VARCHAR(200) NULL,

grp                   INTEGER NOT NULL,

lev                   TINYINT NOT NULL,

step                  INTEGER NOT NULL,

);

mysql에 넣고

mysql -u root -p

source /home/mino/Desktop/gesipan.sql

desc Gesipan;






+ Recent posts