-1
자바에서 서버에 문자열을 업로드하고 싶습니다. 내가 문자열 당신은 모두 POST 방법을 사용하여 업로드 할 수 있습니다이자바 문자열을 서버에 업로드하십시오.
자바에서 서버에 문자열을 업로드하고 싶습니다. 내가 문자열 당신은 모두 POST 방법을 사용하여 업로드 할 수 있습니다이자바 문자열을 서버에 업로드하십시오.
같은
String toupload = "Cheese"; Upload(toupload);
을 업로드 할 것입니다 단지 파일을 업로드 할 수 없습니다 것이며, 는 방법을 GET : 를 사용하는 경우 GET 메소드 : 당신은 URL에 문자열을 전달합니다.
예 : 로컬 호스트 : 8080/yourwebproject/yourservlet nameofyourstring = itsvalue
그리고 서블릿에서이 같은 수행 할 수 있습니다 확인
public myServlet extends HttpServlet(HttpServletRequest request, HttpServletResponse response)
public myServlet() {
super();
}
/*This method will be called by your web-container if you used the get method..*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
//here we go
String str = request.getParameter("nameOfyourString");
}`
}
If you use the POST method, you have to implement the doPost with same logic..
을 ,. 이 서버는 어떤 프로토콜입니까? http? – MeBigFatGuy
예 프로토콜은 http @MeBigFatGuy입니다. –
일반적인 http POST를 사용하여 게시하거나 GET에서 쿼리 문자열로 전달할 수없는 이유는 무엇입니까? – kamoor