Hi, here is my full code.
----------------------------------------------------------------------------------------------
fileUpload.xhtml
<tr:form usesUpload="true" id="id1">
<tr:inputFile id="id2" columns="50"
value="#{shopBuildDataBean.fileToBeUploaded}"
valueChangeListener="#{shopBuildServiceBean.fileUpload}"/>
<tr:commandButton id="id3" text="save data" />
</tr:form>
portion of Data Bean - ShopBuildDataBean.java
import org.apache.myfaces.trinidad.model.UploadedFile;
protected UploadedFile fileToBeUploaded;
public UploadedFile getFileToBeUploaded() {
return fileToBeUploaded;
}
public void setFileToBeUploaded(UploadedFile fileToBeUploaded) {
System.out.println("File Name -> " +
fileToBeUploaded.getFilename());
this.fileToBeUploaded = fileToBeUploaded;
}
portion of Service Bean - ShopBuildServiceBean.java
public void fileUpload(ValueChangeEvent event){
UploadedFile file = (UploadedFile) event.getNewValue();
if (file != null)
{
System.out.println("Successfully uploaded file " +
file.getFilename() +
" (" + file.getLength() + " bytes)");
}else{
System.out.println("FILE IS NULL");
}
}
portion of - web.xml
<context-param>
<!-- Maximum memory per request (in bytes) -->
<param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_MEMORY</param-name>
<!-- Use 500K -->
<param-value>512000</param-value>
</context-param>
<context-param>
<!-- Maximum disk space per request (in bytes) -->
<param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE</param-name>
<!-- Use 5,000K -->
<param-value>5120000</param-value>
</context-param>
<context-param>
<!-- directory to store temporary files -->
<param-name>org.apache.myfaces.trinidad.UPLOAD_TEMP_DIR</param-name>
<!-- Use a TrinidadUploads subdirectory of /tmp -->
<param-value>/home/</param-value>
</context-param>
<filter>
<filter-name>trinidad</filter-name>
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>trinidad</filter-name>
<servlet-name>faces</servlet-name>
</filter-mapping>
----------------------------------------------------------------------------------------------
Please guide me why it is not even binding the file upload trinidad
component with the data bean's variable.
GTrivedi wrote:
>
> Hi,
>
> Thanks for reply... But still its not working for me.. Can you please
> see the code and let me know if anything is wrong from my side or not ?
>
>
> Matthias Wessendorf-4 wrote:
>>
>> Hi,
>>
>> two notes...
>> a) this is a user type of question, please use the user list
>> b) no need to send the email twice
>>
>> I did a very quick check at the demo:
>> http://irian.at/adfFaces
>>
>> and it just works.
>>
>> -Matthias
>>
>> On Wed, Sep 10, 2008 at 4:42 AM, GTrivedi <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> Hi,
>>>
>>> Here is my code :
>>>
>>> <tr:form usesUpload="true">
>>> <table>
>>> <tr>
>>> <td>
>>> <tr:inputFile columns="50"
>>> value="#{shopBuildDataBean.fileToBeUploaded}"
>>> valueChangeListener="#{shopBuildServiceBean.fileUpload}" />
>>> <tr:commandButton text="save data" />
>>> </td>
>>> </tr>
>>> </table>
>>> </tr:form>
>>>
>>> -------------------------------------------------------------------
>>> But it doesn't even calling the setter method of data bean and even not
>>> calling the "fileUpload" method of service bean on click of button.
>>>
>>> Even if I write command button code as below it doesn't work
>>>
>>> <tr:commandButton text="save data"
>>> action="#{shopBuildServiceBean.fileUpload}" />
>>>
>>> I don't know where I am wrong. When I click on the button, it submits
>>> the
>>> page and shows the same page but in background it is not doing any
>>> process...
>>>
>>> Please guide me ASAP. Thanks in advance.
>>>
>>> -----
>>> Gautam Trivedi
>>> Programmer Analyst
>>> --
>>> View this message in context:
>>> http://www.nabble.com/%3Ctr%3AinputFile-doesn%27t-work-tp19411759p19411759.html
>>> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>>
>>
>
>
-----
Gautam Trivedi
Programmer Analyst
--
View this message in context:
http://www.nabble.com/%3Ctr%3AinputFile-doesn%27t-work-tp19411759p19433871.html
Sent from the My Faces - Dev mailing list archive at Nabble.com.