2013-02-25 1 views
2

몇 가지 웹 응용 프로그램을 실행하는 TomCat 서버가 있습니다.XML 파일을 Tomcat에 업로드하는 방법은 무엇입니까?

나는 Tomcat 서버에 XML 파일을 업로드하여 C#에서 개발중인 프로그램을 사용하여 파일에 액세스하고 다운로드 할 수 있습니다.

나는 많은 검색을 해왔고 견고한 리드가 없으므로 파일을 액세스 할 수 있도록 톰캣 서버에 업로드하려면 어떻게해야합니까?

For example, I want my program to be able to use this: 
get file from(http://tomcat-ip:port/example/data.xml) 

감사합니다.


솔루션 파악 : 장소의 webapps/루트에서 파일을 당신은 호스트 이름의 파일에 액세스 할 수 있습니다 : 당신이 당신의 tomact 서버를 실행하는 경우 포트/파일 이름


+0

솔루션을 알아 낸 : 전자 HTML 테이블도 당신은 배열 할 수 있습니다 장소의 webapps/루트에있는 파일과는 호스트에서 파일을 액세스 할 수 있습니다 : 당신이 필요로하는 배열을 만드는 경우 포트/파일 이름 – user2019260

답변

1

을 XAMPP에서 당신은 C:\xampp\htdocs 코드에 xml 파일을 넣을 수 있습니다 : 당신이 근래 경우

URL oracle = new URL("http://localhost/data.xml); 
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream())); 

while ((inputLine = in.readLine()) != null) 
{ 
    Sysetm.out.println(inputLine); 
} 
in.close(); 

Document doc = Jsoup.parse(inputLine); 
      Elements tables = doc.select("table"); 
      for (Element table : tables) { 
       Elements trs = table.select("tr"); 
       String[][] trtd = new String[trs.size()][]; 
       for (int i = 0; i < trs.size(); i++) { 
        Elements tds = trs.get(i).select("td"); 
        trtd[i] = new String[tds.size()]; 
        for (int j = 0; j < tds.size(); j++) { 
         trtd[i][j] = tds.get(j).text(); 
        } 
       } 
       // trtd now contains the desired array for this table 
        System.out.println(trtd[column][row]); 
      } 
+0

Jsoup library –

+0

Eclipse에 tomcat 서버가 있다면 –

+0

안에 data.xml로 프로젝트를 만드십시오 죄송합니다 ... 저는 약간 혼란 스럽습니다. 단순히 서버 컴퓨터 자체의 Tomcat 서버에 파일을 업로드하고 싶다면 코드가 필요합니까? 내 생각에 파일을 적절한 위치에 놓고 일부 구성을 변경해야 할 것입니다. 감사합니다. – user2019260

관련 문제