Foros de discusión

t:inputFileUpload not showing on my portlet! :(

IGC SA, modificado hace 12 años.

t:inputFileUpload not showing on my portlet! :(

Junior Member Mensajes: 80 Fecha de incorporación: 8/06/11 Mensajes recientes
I have read about a lot of people having problems with MyFaces' File Upload but never heard about the upload button not showing up!!

This is my code:

view.xhtml:

<h:form id="MyForm" enctype="multipart/form-data">
			<br><br><br><br><strong>web.xml</strong><br><pre><code><context-param>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
		<param-value>server</param-value>
	</context-param>
....
<filter>
        <filter-name>ExtensionsFilter</filter-name>
        <filter-class>
            <!--  org.apache.myfaces.component.html.util.ExtensionsFilter -->
            org.apache.myfaces.webapp.filter.ExtensionsFilter
        </filter-class>
        <init-param>
	        <description>
	            Set the size limit for uploaded files.
	                Format: 10  - 10 bytes
	                        10k - 10 KB
	                        10m - 10 MB
	                        1g  - 1 GB
	        </description>
            <param-name>uploadMaxFileSize</param-name>
            <param-value>10m</param-value>
        </init-param>
        <init-param>
	        <description>
	            Set the threshold size - files below this limit are stored 
	            in memory, files above this limit are stored on disk.
	                Format: 10  - 10 bytes
	                        10k - 10 KB
	                        10m - 10 MB
	                        1g  - 1 GB
	        </description>
            <param-name>uploadThresholdSize</param-name>
            <param-value>100k</param-value>
        </init-param>
        <!-- Directorio donde se guardan los archivos subidos -->
        <init-param>
			<param-name>uploadRepositoryPath</param-name>
			<param-value>/tmp</param-value>			
		</init-param>
    </filter>
    <filter-mapping>
        <filter-name>ExtensionsFilter</filter-name>
        <servlet-name>FacesServlet</servlet-name>
    </filter-mapping>
    <filter-mapping>
		<filter-name>ExtensionsFilter</filter-name>
		<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
	</filter-mapping> 
	<!-- extension mapping for adding , <link/>, and other resource tags to JSF-pages  -->
	<filter-mapping>
	    <filter-name>ExtensionsFilter</filter-name>
	    <url-pattern>*.jsf</url-pattern>
	</filter-mapping> 
	<filter-mapping>
        <filter-name>ExtensionsFilter</filter-name>
        <url-pattern>/faces/*</url-pattern>
	</filter-mapping>   
...
<servlet>
		<servlet-name>FacesServlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
...
<servlet-mapping>
		<servlet-name>FacesServlet</servlet-name>
		<url-pattern>/faces/*</url-pattern>
	</servlet-mapping>	</code></pre><br><br><strong>ImportComunidadBean.java</strong><br><pre><code>
...
public class ImportComunidadBean {
	private UploadedFile uploadedLARPrv; //LAR cargado de la parte privada
...getters and setters etc...</code></pre><br><br><strong>portlet.xml</strong><br><pre><code>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemalocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
	<portlet>
		<portlet-name>importcomunidades</portlet-name>
		<display-name>Importar comunidades</display-name>		
		<portlet-class>org.apache.portals.bridges.portletfilter.FilterPortlet</portlet-class>
        <init-param>
            <name>portlet-class</name>
            <value>blahblahblahblah.portlet.MyFacesFaceletsPortlet</value>
        </init-param>
        <init-param>
            <name>portlet-filters</name>
            <value>jp.sf.pal.facesresponse.FacesResponseFilter,jp.sf.pal.tomahawk.filter.ExtensionsPortletFilter</value>
        </init-param>
</portlet></portlet-app></code></pre><br><br><strong>List of jars:</strong><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><table>
				<tbody><tr>
....

</tr><tr>
					 <td>			
						<h:outputtext value="#{msgs.enter_optional_lar_pub}" /><h:outputtext value="&nbsp;" />
					</td>
					<td>	        		
		            	<t:inputfileupload id="myFileId2" value="#{import.uploadedLARPub}" />
		            </td>
	            </tr>
...(Maybe it's not shown because of the &lt;table&gt; , &lt;tr&gt; and &lt;td&gt; tags?)bridges-myfaces-0.8.jarcommons-el.jarcommons-fileupload-1.2.2.jarcommons-io-2.0.1.jarel-api.jarel-ri.jarfaces-response-filter-0.2.jarjsf-facelets.jarlog4j.jarmyfaces-api-1.1.5.jarmyfaces-impl-1.1.5.jarportals-bridges-portletfilter-1.0.4.jartomahawk-1.1.5.jartomahawk-bridge-0.9.jarutil-bridges.jarutil-java.jarutil-taglib.jarPlease help, I'm having quite a nightmare here trying to find out what's wrong.I guess that there must be some sort of issue with the page (.xhtml).... other buttons and texts (h:commandButton and h:outputText) are showing correctly.</tbody></table></h:form>
IGC SA, modificado hace 12 años.

RE: t:inputFileUpload not showing on my portlet! :(

Junior Member Mensajes: 80 Fecha de incorporación: 8/06/11 Mensajes recientes
I just tried another tomahawk tag and it isn't showing either...
So it has to be some sort of problem with tomahawk (h: and f: tags are showing correctly)

Any ideas?

<f:view> <f:loadbundle basename="Language" var="msgs" /> <h:form id="MyForm" enctype="multipart/form-data"></h:form></f:view>
IGC SA, modificado hace 12 años.

RE: t:inputFileUpload not showing on my portlet! :(

Junior Member Mensajes: 80 Fecha de incorporación: 8/06/11 Mensajes recientes
I read that myfaces and other libraries have several unresolved issues when working with portlets, so I decided to stick to JSF using as a template for my application the jsf-upload-portlet-5.1.2.1.war and everything's working fine so far. No tomahawk, no myfaces and not any other JSF-derived framework, just plain JSF with f: and h: tags on the interface.

I hope that helps others when dealing with these frameworks in Liferay.

Cheers.
Mitja Šturm, modificado hace 11 años.

RE: t:inputFileUpload not showing on my portlet! :(

New Member Mensajes: 3 Fecha de incorporación: 13/06/12 Mensajes recientes
Hi

Can you please let me know how did you solved the "t:inputFileUpload" problem without tomahawk but with plain JSF?
I have the same problems and hate frameworks even more.

Mitja