JSF File Upload

M

Moiristo

Hi, I need your help again with this one.

I want to be able to upload a document (plain text) together with a name
and description. I've created the following jsf fragment for this:

<h:form id="createForm">
<table>
<tr>
<td><h:eek:utputText value="#{labels.name}"/>: </td>
<td><h:inputText id="name" value="#{Bean.name}" /></td>
</tr>
<tr>
<td><h:eek:utputText value="#{labels.desc}"/>: </td>
<td><h:inputTextarea id="description"
value="#{Bean.description}" /> </td>
</tr>
</table>

<h3><h:eek:utputText value="#{labels.data}"/></h3>
<h:form enctype="multipart/form-data">
<t:inputFileUpload value="#{Bean.data}"/>
</h:form>
</p>
<h:commandButton action="#{Uploader.uploadData}"
value="#{labels.send}" />

</h:form>

This does not work though. When I submit, nothing happens. I think there
is a problem with the nested multipart form, but I'm also not sure
whether the Tomahawk inputFileUpload tag will store the data in
Bean.data (byte[]).

I'd like to ask for this information all on one page. Is it for example
possible to split the forms have them both submitted with one
commandbutton? Any other ideas?
 
H

hiwa

Moiristo ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:
Hi, I need your help again with this one.

I want to be able to upload a document (plain text) together with a name
and description. I've created the following jsf fragment for this:

<h:form id="createForm">
<table>
<tr>
<td><h:eek:utputText value="#{labels.name}"/>: </td>
<td><h:inputText id="name" value="#{Bean.name}" /></td>
</tr>
<tr>
<td><h:eek:utputText value="#{labels.desc}"/>: </td>
<td><h:inputTextarea id="description"
value="#{Bean.description}" /> </td>
</tr>
</table>

<h3><h:eek:utputText value="#{labels.data}"/></h3>
<h:form enctype="multipart/form-data">
<t:inputFileUpload value="#{Bean.data}"/>
</h:form>
</p>
<h:commandButton action="#{Uploader.uploadData}"
value="#{labels.send}" />

</h:form>

This does not work though. When I submit, nothing happens. I think there
is a problem with the nested multipart form, but I'm also not sure
whether the Tomahawk inputFileUpload tag will store the data in
Bean.data (byte[]).

I'd like to ask for this information all on one page. Is it for example
possible to split the forms have them both submitted with one
commandbutton? Any other ideas?
Don't mix JSF actions with HTML tags. You shall get unpredictable
result.
For character size, use style element of JSF component.

Use a single form in a JSF view or use JSF sub-view.
You could do all of them in a single form, however.
 
M

Moiristo

hiwa said:
Don't mix JSF actions with HTML tags. You shall get unpredictable
result.
For character size, use style element of JSF component.

Are you talking about the table and h3 tag? I don't really see a problem
with this. But yes, it would be nicer to use as much jsf tags as possible.
Use a single form in a JSF view or use JSF sub-view.
You could do all of them in a single form, however.

Yes, few minutes after I posted this message, the Oracle of Google gave
me an example that showed me what to do. Thanks for the reply, however.
 
K

karthick.sundaram

Can you please share the link
Thanks
Are you talking about the table and h3 tag? I don't really see a problem
with this. But yes, it would be nicer to use as much jsf tags as possible.


Yes, few minutes after I posted this message, the Oracle of Google gave
me an example that showed me what to do. Thanks for the reply, however.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top