Ok ovako pokusavam uplodovati xml file na jednu stranicu evo koda stranice
<body>
<hr>
<form action="/tim6shop/ListServlet" enctype="multipart/form-data" method="post">
<table cellspacing="2" cellpadding="0" border="0">
<tbody>
<tr>
<td>File:</td>
<td><input type="file" name="file" size="25"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Submit"></td>
</tr>
</tbody>
</table>
</form>
<p><a href ="/tim6shop/Download?naziv=Odgovor.xml&verzija=">Download xml odgovora</a></p>
<p><a href="index.jsp">Nazad</a></p>
</body>
kako da napisem kod da posalje file. Evo stvari koje sam do sada pokusao
RequestEntity entity = new FileRequestEntity(ufile, "text/xml; charset=ISO-8859-1");
//nisam siguran koji url da pozivam uploadXML.jsp ili ListServlet
PostMethod uploadxml = new PostMethod("/tim6shop/ListServlet");
PostMethod uploadxml = new PostMethod("/tim6shop/uploadXML.jsp");
uploadxml.setRequestEntity(entity);
NameValuePair file = new NameValuePair("file", ".\\xmldata\\listaKomponentiZahtev.xml");
NameValuePair submit = new NameValuePair("submit", "Submit");
uploadxml.setRequestBody(new NameValuePair[] {file,submit});
File input =new File("c:\\nj.xml");
InputStream body = (InputStream) getClass().getResourceAsStream("c:\\nj.xml");
uploadxml.setRequestBody(body);
client.executeMethod(uploadxml);
i pokusao sam jos sa nekom klasom koju sam nasao na netu HTTP_post koja je koristila URLConection i DataOutputStream ali ni sa njom nisam daleko dogurao.
<body>
<hr>
<form action="/tim6shop/ListServlet" enctype="multipart/form-data" method="post">
<table cellspacing="2" cellpadding="0" border="0">
<tbody>
<tr>
<td>File:</td>
<td><input type="file" name="file" size="25"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Submit"></td>
</tr>
</tbody>
</table>
</form>
<p><a href ="/tim6shop/Download?naziv=Odgovor.xml&verzija=">Download xml odgovora</a></p>
<p><a href="index.jsp">Nazad</a></p>
</body>
kako da napisem kod da posalje file. Evo stvari koje sam do sada pokusao
RequestEntity entity = new FileRequestEntity(ufile, "text/xml; charset=ISO-8859-1");
//nisam siguran koji url da pozivam uploadXML.jsp ili ListServlet
PostMethod uploadxml = new PostMethod("/tim6shop/ListServlet");
PostMethod uploadxml = new PostMethod("/tim6shop/uploadXML.jsp");
uploadxml.setRequestEntity(entity);
NameValuePair file = new NameValuePair("file", ".\\xmldata\\listaKomponentiZahtev.xml");
NameValuePair submit = new NameValuePair("submit", "Submit");
uploadxml.setRequestBody(new NameValuePair[] {file,submit});
File input =new File("c:\\nj.xml");
InputStream body = (InputStream) getClass().getResourceAsStream("c:\\nj.xml");
uploadxml.setRequestBody(body);
client.executeMethod(uploadxml);
i pokusao sam jos sa nekom klasom koju sam nasao na netu HTTP_post koja je koristila URLConection i DataOutputStream ali ni sa njom nisam daleko dogurao.