Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/07/2019, 06:39
dacroma
 
Fecha de Ingreso: mayo-2013
Ubicación: bogota
Mensajes: 157
Antigüedad: 10 años, 10 meses
Puntos: 2
a que se debe el error de

Nesecito utilizar un inputfile pero no me es posible.
este es el codigo
PruebaJSF.xhtml
Código Java:
Ver original
  1. <h:body>
  2.         <h:form enctype="multipart/form-data">    
  3.             <h:panelGrid>
  4. <h:inputFile value="#{pbBean.part}"/>
  5. <h:commandbutton value="enviar" action="#{pbBean.transferir()}"/>
  6. <h:outputText value="#{rtBean.setOtro}"/>
  7.            </h:panelGrid>
  8.         </h:form>
  9.     </h:body>

este es el bean pbBean.java
Código Java:
Ver original
  1. @Named
  2. @RequestScoped
  3. public class pbBean{
  4. Probaré Part Part;
  5. Public void setPart(Part part){
  6. Thais.part=part;
  7. }
  8. Public Part getPart(){
  9. Return part;
  10. }
  11. public void transferir() throws IOException, ServletException{
  12. FacesContext fc=FacesContext.getCurrentInstance();
  13.  rtBean rb=fc.getApplication().evaluateExpressionGet(fc, "#{rtBean}", rtBean.class);
  14.       Part part=this.part;
  15. Rb.setOtro(Part.getName());
  16. }

y este es el bean.rtBean.java
Código Java:
Ver original
  1. @RequestScoped
  2. @Named
  3. public class rtBean {
  4. private String otro;
  5. public String getOtro() {
  6.         return otro;
  7.     }
  8.  
  9.     public void setOtro(String otro) {
  10.         this.otro = otro;
  11.     }
  12. }
Y me lanza un error de ioexception.
y realmente no entiendo de donde viene el error ni como solucionarlo.

Última edición por dacroma; 11/07/2019 a las 05:30