2013-05-01 3 views
0

FormPanel에서 오는 필드의 값을 가져 오는 데 문제가 있습니다. 내가 할 Theonly 것은, 나는 아파치 코 몬즈를 서블릿 코드를 사용하고 여기에 양식에 포함 된 이미지 : 나는 this post을 보았다FormPanel의 필드 값 받기

// Create a new file upload handler 
     ServletFileUpload upload1 = new ServletFileUpload(); 

     // Parse the request 
     FileItemIterator iter; 
     try { 
      iter = upload1.getItemIterator(req); 
      while (iter.hasNext()) { 
       FileItemStream item = iter.next(); 
       String name = item.getFieldName(); 
       InputStream stream = item.openStream(); 
       if (item.isFormField()) { 
        System.out.println("Form field " + name + " with value " 
         + Streams.asString(stream) + " detected."); 
       } else { 
        System.out.println("File field " + name + " with file name " 
         + item.getName() + " detected."); 
        // Process the input stream 

       } 
      } 
     } catch (FileUploadException e1) { 
      // TODO Auto-generated catch block 
      e1.printStackTrace(); 
     } 

하지만 정말 무엇을 설명하지 않았다

+1

FormPanel과 그 내부에 추가 한 입력 사항을 공유 할 수 있습니까? 그렇지 않으면 각 필드의 name 속성을 설정했는지 확인할 수 있습니까? –

+0

FireBug 또는 유사한 도구를 사용하여 요청을 분석하고 양식 필드 값이 요청에 포함되어 있는지 확인하십시오. 그런 다음 HttpServletRequest에 모든 매개 변수가 있으면 서블릿 코드를 디버그하고 검사하십시오. – Sithsu

+0

둘 다 감사합니다! 사실 나는 이름 속성을 넣지 않았다! 정말 고마워! –

답변

0

처럼 @ 콜린 Alworth, 이름 속성은 각 필드에 대해 설정해야한다고 말했다!

TextBox lastName = new TextBox(); 
lastName.setName("LastName");