Tomahawk MyFaces File Upload Component not showing on screen - jsf

I am trying to use tomahawk MyFaces file upload component t:inputFileUpload. I followed the example at JSF 2.0 File upload, with one change-instead of copying files to /lib, I used maven. There are no errors or warnings, but the file upload component is not showing up. Only the submit button shows on the screen. Please help me

Check the rendered HTML page. Perhaps it still contains <t:inputFileUpload>. In this case you may have forgotten to add the namespace for the prefix t to your file like this:
xmlns:t="http://myfaces.apache.org/tomahawk"
If the prefix isn't defined, the tags are simply not processed and directly rendered to the output.

Related

Facelet present dynamically loaded PDF from DB

Based on the selection of a few form elements, I want to dynamically load a PDF file into an embed/object tag which is stored in a database.
Serving the PDF
I found this solution to serve a PDF from a servlet.
Is this the right approach when using Facelets? Because I thought when using facelets, I shouldn't need Servlets so how would I do that with a Bean?
As I load the PDF dynamically from a Database, I don't have access to a file on the file-system so in which way would I have to modify the response.setHeader?
Call from JSF
I thought that I would somehow first trigger a javascript function to update the content of the src attribute in the embed tag and then with the ajax tag from the jsf core library trigger the rerendering of the embed element.
Is this the right approach?
<embed src="#{pdfServlet.getPdf[desiredFileId]}"></embed>

Display image from some server directory

I save uploaded image files in tomcat or portlet temporary directory, and I want to display them. I know their path in server file system, but how generate a right path for displaying it on portlet's page? It must become from smth like:
opt/liferay/tomcat-7.0.27/temp/28-Image-portlet/WEB-INF/classes/intech/webpro/kegor/image/Clipboard02.jpg
to
http://test.com/web/guest/liferay-benefits?p_p_id=Image_WAR_Imageportlet&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_cacheability=cacheLevelPage&p_p_col_id=column-1&p_p_col_count=1&_Imag
How to get it?
I know how it is done from portlets resources folder:
#{resource['images:smiley.jpg']}
But how to display image from some server directory in portlet?
You can't access images from another server using #{resource['image']} ,
You can either
1) give the full image path in xhtml
2) Keep the image paths in CSSfile and use CSS classes in xhtml.
3) create a common util function or
ResourceHelper ApplicationScoped Bean that has something like
getResource(String imageName) which returns the correct URL. You
can then use it in your xhtml as
#{ResourceHelper.getResource('image.png')}
If you only need to display content (without permission check), you can use Tomcat. Put file into /webapps/portlet-name/html/ (or temp/portlet-name/html/) directory.
As a result: http://site.com/portlet-name/html/image.jpg

Where to put properties files in a JSF application and how to load it with f:loadBundle tag?

I tried to add properties files to my xhtml page in JSF by using f:loadBundle tag.
I tried do it many times in different ways but nothing works
(prop_files/logowanie, prop_files.logowanie).
I kept property files in WebContent/prop_files folder and xhtml files are in WebContent.
Please help me how to add properties to page.
Maybe I keep this files in wrong folder?
The basename of a f:loadBundle tag should be like a class name as the properties files is loaded by the class loader like this:
<f:loadBundle basename="com.examples.messages" var="msgs"/>
The file extension should be .properties.
So place the file in your classpath for example in your src/java/com/examples/messages.properties

Icefaces InputFile component

I've downloaded the ICEFaces 2.0.2 bin-files, but I cannot find the tag "inputFile"; I can only find a tag called "fileEntry"
What am I missing? I want to implement something like:
http://component-showcase.icefaces.org/component-showcase/showcase.iface
I've also added to my xhtml page the namespace:
xmlns:ice=http://www.icesoft.com/icefaces/component
But, netbeans tells that there's no library with that namespace.
Indeed, looking at the component-showcase in sample folder it says the following
Deprecation Notice:
The ice:inputFile component is deprecated in ICEfaces 2.
A next generation file upload component ('fileEntry') is available as
part of the ICEfaces Advanced Components.
For more information on the fileEntry component see the online
documentation.
Thanks anyway !

Can't Use PrimeFaces Component on the html page - They aren't rendered at all

I am using JSF1.2 and trying to integrate with PrimeFaces1.1. I added the primefaces-1.1.jar file to my META-INF\lib folder. I also added the namespace to the page with "xmlns:p="http://primefaces.prime.com.tr/ui". The page is working but primefaces components arent rendered. Also eclipse doesnt show me components when I write < p: (ctrl+space). How can I solve this problem ?
Thanks in advance,
Maybe it's a typo, but the jar should be put in WEB-INF/lib instead of META-INF/lib.

Resources