(웹 양식에서) Java 서블릿에서 사용할 파일 이름이나 파일 자체를 검색하지 않습니다.Java 서블릿에서 파일 양식 필드 사용
나는 파일 양식 필드가 : 다음 wanto 내 서블릿에서 처리
<form enctype="multipart/form-data" method="post" action="SaveDictionary.do">
<label>
<input type="file" name="dictionary_file" id="dictionary_file" />
<br />
</label>
<label>
<br />
<input type="submit" name="saveDic" id="saveDic" value="Save Dictionary" />
</label>
</form>
, 내가 이것을 처리하기 위해 할 무엇을 - 일반 텍스트 필드에 내가
같은 것을 사용합니다String myValue = (String) request.getParameter ("parameter_name");
이 클래스가 있다고 가정하면 파일 경로 또는 실제 파일 내용을 얻기 위해 doPost() 메서드에 무엇을 넣어야합니까?
@SuppressWarnings("serial")
public class SaveDictionary extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
// I can't work out what goes here, the same
// String myValue = (String) request.getParameter("parameter_name"); doesn't work
response.sendRedirect("dictionary.jsp");
}
}