[jboss-user] [JBoss Seam] - help on s:fileUpload

kingcu do-not-reply at jboss.com
Mon Apr 2 16:21:47 EDT 2007


Seam version 1.2.1. 

I am always getting NULL value for the upload file. I tried using both InputStream and byte[]; I also tried putting the upload file property in a SLSB and a class that extends EntityHome, but neither worked. Anyway here is my code:


  |     <h:form enctype="multipart/form-data">
  |         <rich:togglePanel id="importFeeds" switchType="ajax" stateOrder="closed, import">
  |             <f:facet name="closed">
  |                 <h:panelGrid columns="1">
  |                     <rich:toggleControl for="importFeeds" value="Import Feeds &#187;" />
  |                 </h:panelGrid>
  |             </f:facet>
  |             <f:facet name="import">
  |                 <h:panelGrid columns="1">
  |                     <s:fileUpload data="#{widgetHome.feedDefFile}" />
  |                     <s:button id="importFeed" value="Import..." action="#{widgetHome.importFeeds}"/>
  |                 	<rich:toggleControl for="importFeeds" value="&#171; Close Import" />
  |                 </h:panelGrid>
  |             </f:facet>
  |         </rich:togglePanel>
  |     </h:form>
  | 


  | @Name("widgetHome")
  | public class WidgetHome extends EntityHome<Widget> {
  | 
  |         .... // other methods
  | 
  | 
  | 	@Logger
  | 	private Log log;
  | 	
  | 	// No matter whether it's byte[] or InputStream, it's always null
  | 	private byte[] feedDefFile;
  | 	//private InputStream feedDefFile;
  | 	
  | 	public void importFeeds() {
  | 		// I get an NPE exception on this, because feedDefFile is always null
  | 		log.info("feedDefFile.length = " + feedDefFile.length);
  | 	}
  | 
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033818#4033818

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033818



More information about the jboss-user mailing list