That example was only a fragment, minimal working view with trinidad and JSPs can look like:
uploadFile.jspx: <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:trh="http://myfaces.apache.org/trinidad/html" xmlns:tr="http://myfaces.apache.org/trinidad"> <jsp:directive.page contentType="text/html;charset=utf-8"/> <f:view> <tr:document title="InputFile Demo"> <tr:form usesUpload="true"> <tr:inputFile label="Label" value="#{bean.uploadedFile}" /> <tr:commandButton text="Submit"/> </tr:form> </tr:document> </f:view> </jsp:root> This should work and if it doesn't you have probably something badly configured. Please notice that there can be used only one upload system in your web application : trinidad or tomahawk. Mixing both together in one webapp isn't possible because of HTML multipart upload nature. And of course be aware of: org.apache.myfaces.trinidad.model.UploadedFile vs. commons-upload API. veena pandit píše v Út 03. 11. 2009 v 15:51 -0500: > Martin, > > Hi, I tried a small demo app and I followed your instructions; I get the > following errors: > > _submitFormCheck is not defined > http://localhost:8080/TrUpload/mypage.jsp line 34 > > _checkLoad is not defined > http://localhost:8080/TrUpload/mypage.jsp line 1 > > _submitForm is not defined > http://localhost:8080/TrUpload/mypage.jsp line 1. > > What am I doing wrong? > > Thanks, > > Veena > > On Tue, Nov 3, 2009 at 4:03 PM, Martin Kočí <martin.k...@aura.cz> wrote: > > > It seems that message "A file upload error has occurred, please verify > > your upload data and file name" occures on client and has nothing to do > > with server configuration. Can you please try a simple example: > > > > <tr:form usesUpload="true"> > > <tr:inputFile value="#{yourBean.uploadFile}" /> > > </tr:form> > > > > if it works - if not please look in Firefox at "Tools" -> "Error > > Console" if there is any error. > > > > > > veena pandit píše v Út 03. 11. 2009 v 14:56 -0500: > > > Hi Martin, > > > > > > I checked my web.xml and the ordering is already the way you state it > > should > > > be. Anything else I can check for? > > > > > > Thanks, > > > > > > Veena > > > > > > On Tue, Nov 3, 2009 at 3:24 PM, Martin Kočí <martin.k...@aura.cz> wrote: > > > > > > > Hi, > > > > > > > > it is a known limitation, it depends on filters ordering in web.xml. > > > > . > > > > Look in your web.xml and put something like: > > > > > > > > <filter-mapping> > > > > <filter-name>trinidad</filter-name> > > > > <servlet-name>faces</servlet-name> > > > > </filter-mapping> > > > > > > > > before > > > > > > > > <filter-mapping> > > > > <filter-name>MyFacesExtensionsFilter</filter-name> > > > > <servlet-name>faces</servlet-name> > > > > </filter-mapping> > > > > > > > > Filter declared first will "consume" file upload. > > > > > > > > > > > > Regards, > > > > > > > > Martin > > > > > > > > > > > > > > > > > > > > veena pandit píše v Út 03. 11. 2009 v 14:00 -0500: > > > > > I configured it according to the trinidad web page. > > > > > http://myfaces.apache.org/trinidad/devguide/fileUpload.html > > > > > > > > > > Trinidad and Tomahawk are working well together. I am using Trinidad > > for > > > > a > > > > > drop down and Tomahawk for file upload from BalusC's blog. But I > > just > > > > added > > > > > the Trinidad File upload functionality to the web application and > > that is > > > > > the only thing that is not working. I just thought I would use > > Trinidad > > > > for > > > > > both so I could have a common look and feel since this application > > will > > > > go > > > > > into production eventually. > > > > > > > > > > I could not find anything else specific to any problems with Trinidad > > > > file > > > > > upload. > > > > > > > > > > Thanks. > > > > > > > > > > Veena > > > > > > > > > > On Tue, Nov 3, 2009 at 1:51 PM, Matthias Wessendorf < > > mat...@apache.org > > > > >wrote: > > > > > > > > > > > are you sure that you have everything configured correct ? > > > > > > > > > > > > Trinidad and tomahawk ? > > > > > > > > > > > > I think i remember some issues on the upload case, when mixing them > > > > > > (trinidad and > > > > > > tomahawk). Perhaps searching the archives gives any hint ? I really > > > > > > don't remember it > > > > > > > > > > > > -Matthias > > > > > > > > > > > > On Tue, Nov 3, 2009 at 7:48 PM, veena pandit <v.kri...@gmail.com> > > > > wrote: > > > > > > > Well, I have both Tomahawk and trinidad in the same application > > for > > > > file > > > > > > > uploads. > > > > > > > I added commons.io to the web-inf/lib directory and now I dont > > get > > > > any > > > > > > error > > > > > > > messages in the log. I just get the popup error message once > > again. > > > > I > > > > > > am > > > > > > > using trinidad for another control in the same page. But I was > > also > > > > > > trying > > > > > > > to use trinidad for the upload as well. > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > Veena > > > > > > > > > > > > > > On Tue, Nov 3, 2009 at 1:45 PM, Matthias Wessendorf < > > > > mat...@apache.org > > > > > > >wrote: > > > > > > > > > > > > > >> This is not Trinidad, this is Tomahawk. > > > > > > >> > > > > > > >> The "NoClassDefFoundError" says that you don't > > > > > > >> have the "ServletFileUpload" from the given package > > > > > > >> in your classpath. This class is part of the Apache Commons > > > > > > >> Upload project, which is required by Tomahawk. > > > > > > >> > > > > > > >> -Matthias > > > > > > >> > > > > > > >> On Tue, Nov 3, 2009 at 7:38 PM, veena pandit < > > v.kri...@gmail.com> > > > > > > wrote: > > > > > > >> > A new development. Now I am getting this error in the log: > > > > > > >> > All I was getting before this is a popup error message. > > > > > > >> > Now here is the stacktrace: > > > > > > >> > > > > > > > >> > > > > > > > >> > SEVERE: Servlet.service() for servlet Faces Servlet threw > > > > exception > > > > > > >> > > > > > > > >> > java.lang.NoClassDefFoundError: > > > > > > >> > org/apache/commons/fileupload/servlet/ServletFileUpload > > > > > > >> > > > > > > > >> > at > > org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(* > > > > > > >> > ExtensionsFilter.java:321*) > > > > > > >> > > > > > > > >> > *Thanks,* > > > > > > >> > ** > > > > > > >> > *Veena* > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > >> > On Tue, Nov 3, 2009 at 1:33 PM, Matthias Wessendorf < > > > > > > mat...@apache.org > > > > > > >> >wrote: > > > > > > >> > > > > > > > >> >> do you have a little bit more information ? > > > > > > >> >> > > > > > > >> >> cfg, size of the file. error message, stack trace... > > > > > > >> >> > > > > > > >> >> -Matthias > > > > > > >> >> > > > > > > >> >> On Tue, Nov 3, 2009 at 7:26 PM, veena pandit < > > v.kri...@gmail.com > > > > > > > > > > > >> wrote: > > > > > > >> >> > Hi, > > > > > > >> >> > > > > > > > >> >> > I am having trouble making this work. I have configured > > the > > > > > > web.xml, > > > > > > >> >> > faces-config.xml > > > > > > >> >> > and followed the instructions on the following page: > > > > > > >> >> > > > > > > > >> >> > > > http://myfaces.apache.org/trinidad/devguide/fileUpload.html. > > > > > > >> >> > > > > > > > >> >> > I get a following popup error: > > > > > > >> >> > Message from webpage: > > > > > > >> >> > A file upload error has occured, please verify your upload > > data > > > > and > > > > > > >> file > > > > > > >> >> > name. > > > > > > >> >> > > > > > > > >> >> > Thanks, > > > > > > >> >> > > > > > > > >> >> > Veena > > > > > > >> >> > > > > > > > >> >> > > > > > > >> >> > > > > > > >> >> > > > > > > >> >> -- > > > > > > >> >> Matthias Wessendorf > > > > > > >> >> > > > > > > >> >> blog: http://matthiaswessendorf.wordpress.com/ > > > > > > >> >> sessions: http://www.slideshare.net/mwessendorf > > > > > > >> >> twitter: http://twitter.com/mwessendorf > > > > > > >> >> > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> -- > > > > > > >> Matthias Wessendorf > > > > > > >> > > > > > > >> blog: http://matthiaswessendorf.wordpress.com/ > > > > > > >> sessions: http://www.slideshare.net/mwessendorf > > > > > > >> twitter: http://twitter.com/mwessendorf > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Matthias Wessendorf > > > > > > > > > > > > blog: http://matthiaswessendorf.wordpress.com/ > > > > > > sessions: http://www.slideshare.net/mwessendorf > > > > > > twitter: http://twitter.com/mwessendorf > > > > > > > > > > > > > > > > > >