Friday 15 April 2011

file upload - How to send parameter to fileUploadListener in PrimeFaces fileUpload -


When I make a model, I would like to save the images for a model. I am using the primaryfaces file. When I save the pictures, I want to know which model is referred to a particular image. This is the reason why I need to send a model ID to support Bean.

Is there a possibility to send id to model of fileUploadListener ?

  & lt; H: form enctype = "multipart / form-data" & gt; & Lt; P: Panel grid column = "2" & gt; & Lt; H: output = for label = "hostname" value = "# {msg.hotelName}" /> & Lt; P: input text = "# {apartmentNew.name}" id = "hotel name" /> & Lt; H: output label = "hotel description" value = "# {msg.hotelDescription}" /> for & Lt; P: input text = "# {apartmentNew.description}" id = "hotel description" /> & Lt; H: for outputLabel = "hotel image" value = "# {msg.hotelImages}" /> & Lt; H: form enctype = "multipart / form-data" & gt; & Lt; P: fileUpload id = "Hotel image" file uploadList = "# {apartmentshidden image upload}" mode = "advanced" size item = "10000000" permission type = "/ (\. | \ /) (Gif | jpe? G | Png) $ / "& gt; & Lt; / P: FileUpload & gt; & Lt; / H: form & gt; & Lt; / P: panelGrid & gt; & Lt; P: command button id = "savement button" value = "# {msg.save}" action = "save" /> & Lt; P: Command Button ID = "Cancel App Button" value = "# {msg.cancel}" Action = "Cancel" /> & Lt; / H: form & gt;    

Not through the request parameters. You can do this through component attributes.

For example.

  & lt; P: upload file ... & gt; & Lt; F: attribute name = "foo" value = "bar" /> & Lt; / P: FileUpload & gt;   

with

  string foo = (string) event.getComponent (). GetAttributes (). Get ("foo"); // times    

No comments:

Post a Comment