This question already has answers here:
How to use PrimeFaces p:fileUpload? Listener method is never invoked or UploadedFile is null / throws an error / not usable
(11 answers)
How to upload file using JSF 2.2 <h:inputFile>? Where is the saved File?
(1 answer)
Load images from outside of webapps / webcontext / deploy folder using <h:graphicImage> or <img> tag
(4 answers)
Closed 3 years ago.
I have a entity attribute String for input a link_logo in my form , i want just to know what can i write on the view for input the logo.
The Attribute on entity (agency):
#Column(name = "Logo")
private String link_logo;
My save method it worked and the bean too. I searched in the showcase but no result.
there is my view code now :
<div class="ui-sm-12 ui-md-2 ui-lg-1">
<p:outputLabel value="Upload image:" for="img" />
</div>
<div class="ui-sm-12 ui-md-4 ui-lg-5" >
<p:graphicImage id="img" value="#{agenceFormBean.agence.link_logo}" style="width:100%" />
</div>
any solutions please ?
You can use this the show image with url
<p:graphicImage id="img" value="#{yourView.link_logo}" style="width:100%" />
Related
This question already has answers here:
Show progress image while executing JSF managed bean action
(1 answer)
JSP processing message
(1 answer)
Closed 3 years ago.
I am having a run button with action as an execution called from mybean. Once button executed running gif should display.
Which action should trigger the running.gif to be displayed?
Here is my code
<h:commandButton value="Run" action="#{mybean.execute()}" class="btn btn-success btnWidth" style="margin-left:15px;margin-right:15px;"/>
<p:graphicImage url="/resources/icons/running.gif" height="20" width="20" />
This question already has answers here:
Is it possible to update non-JSF components (plain HTML) with JSF ajax?
(3 answers)
Closed 6 years ago.
I am trying to update the element "entryDiv" in my xhtml from a button inside a form like this:
<div id="entryDiv">
<div>
<h:form id="myForm">
<c:forEach items="#{foodPlanManagementBean.loadRestaurantsHistory()}" var="restaurantHistoryEntry">
<p:commandButton value="MyName" update="entryDiv"/>
</c:forEach>
</h:form>
</div>
Some more unrelated elements here...
</div>
However, this way all I am left with is a ComponentFoundException, tell me that the component could not be located:
Cannot find component for expression "entryDiv" referenced from "form:myForm:j_idt25".
I already read up a bit on SO and I found one solution proposing to put a : in front of the "entryDiv", but that doesn't turn out to give me any different results.
How could I fix this?
JSF can't see the id of your div if it is not a JSF component so you need to convert your div to a h:panelGroup
<h:panelGroup id="entryDiv" layout="block">
<div>
<h:form id="myForm">
<c:forEach items="#{foodPlanManagementBean.loadRestaurantsHistory()}" var="restaurantHistoryEntry">
<p:commandButton value="MyName" update=":entryDiv"/>
</div>
</c:forEach>
</h:form>
</div>
</h:panelGroup>
if you don't put layout="block" it will render a span instead of a div.
This question already has an answer here:
How to put image instead of text in h:commandLink value
(1 answer)
Closed 7 years ago.
Can someone please tell me how I would add an image value to this code instead of a text value?
<h:commandLink
action="#{gridHandlerXml.removeLinesFromGroups}"
render="quote-table, totalPanel, revisionTabs" execute="#this"
disabled="#{currentQuote.convertInProgress}"
onclick="#{rich:component('fcprocessing:processingpopup')}.show()"
oncomplete="#{rich:component('fcprocessing:processingpopup')}.hide()" />
Quite straightforward: Just embed an an h:graphicImage in the command link:
<h:commandLink action="#{gridHandlerXml.removeLinesFromGroups}">
<h:graphicImage url="resources/path/to/your/image"/>
</h:commandLink>
This question already has answers here:
How to validate if at least one of multiple input fields is entered?
(2 answers)
Closed 7 years ago.
i have three fields i use for my search , but only one 'em is required (at least one of'em should be submited so i tried to have a conditionned required as seen in code below , but takes no effect , as all three fields are all the time required when clicking the command button , even when one field has value . should i use jquery to resolve this on button click.
<h:form id="search_form">
<p:inputText name="field1" id="field1" type="text"
required="#{searchBean.SearchCriteria.field3==null and searchBean.searchCriteria.field2==null}" value="#{searchBean.searchCriteria.field1}"></p:inputText>
<p:inputText name="field2" id="field2" type="text"
required="#{searchBean.SearchCriteria.field1==null and searchBean.searchCriteria.field3==null}" value="#{searchBean.searchCriteria.field2}"></p:inputText>
<p:inputText name="field3" id="field3" type="text"
required="#{searchBean.SearchCriteria.field1==null and searchBean.searchCriteria.field3==null}" value="#{searchBean.searchCriteria.field3}"></p:inputText>
<p:commandButton id="search_button" ajax="false" title="#process="#form" action{#searchBean.search()}" />
</h:form>
Have your bean's search() method run the validation , return null and possibly add a facesMessage if none of those fields is filled up.
This question already has an answer here:
Component to inject and interpret String with HTML code into JSF page
(1 answer)
Closed 6 years ago.
Good morning all.
Is there any jsf control that escapes the html tags?
Imagine that i have the following string in resources:
text.String=lalala<br/>lelele
and i want to print it on Xhtml file with a simple control like:
<h:outputText value="#{messages['text.String']}" />
how do i get the result formatted with the html <br/> tag?
Result should be:
lalala
lelele
instead of:
lalala<br/>lelele
Thanks
the outputText control has an 'escape' property which controls that behaviour.
See here (outputText reference).
So basically:
<h:outputText escape="false" value="#{messages['text.String']}" />
should do the job.