How to get two values to the JSF - jsf-2

I have a requirement to show two bean variable in the same line in h:outputText. Please advise the various ways to accomplish the same
Thanks in Advance

<h:outputText value="#{ebookController.infoMessage} #{ebookController.description}"></h:outputText>

Related

Unique ID for JSF composite component inside dataTable

I am using PrimeFaces 3.2 with JSF 2 in a glassfish 3.1.2.
I have a <p:dataTable> which displays search results containing information on different issues (the issues are assigned to users).
If somebody clicks on the icon of the assigned user a <p:dialog> pops up.
The user icon and the according dialog are implemented using a composite.
Inside the composite I am using some jQuery functions which need a unique ID for each dialog component - I am not able to find a way to solve this problem.
My investigations so far:
I need to set the widgetVar attribute, which works fine as long as I have only one user in the list but it seems that inside a dataTable the widgetVar is not unique for many composites.
Since the user can be displayed more than one time inside the search result, I am not able to setup an widgetVar like this:
<ui:param name="myWidgetVar" value="widget_#{user.id}" />
and use it this way
<p:dialog widgetVar="#{myWidgetVar}">
also using #{cc.id} does not resolve the problem 'cause it only returns the id of the widget without the naming-container part which is always the same.
I need the complete id as displayed in html (e.g.: form:jdt123:dialog:456) - how can I get this?
Does anyone know what to do?
Thanks Pete
My solution is using #{cc.clientId} which I did not know yet.
This gives me the complete html element id constisting of the series of identifiers glued with the UINamingContainer#getSeparatorChar (e.g.: form:jdt123:dialog:jdt456)
Thanks for the answer. You solved my unrelated problem, but I think I stumbled on another solution for your problem.
From the PrimeFaces user guide (http://primefaces.org/documentation.html):
8.2 EL Functions
PrimeFaces provides built-in EL extensions that are helpers to common use cases.
Common Functions
Component
<h:form id="form1">
<h:inputText id="name" />
</h:form>
//#{p:component(‘name’)} returns ‘form1:name’
WidgetVar
<p:dialog id="dlg">
//contents
</p:dialog>
<p:commandButton type="button" value="Show" onclick="#{p:widgetVar(‘dlg’)}.show()" />
It looks like you would be most interested in the WidgetVar implementation.

Issue with Struts2 checkbox tag

Issue with Struts2 checkbox tag
<s:checkbox name="user.secondaryContactRequired" />
Here secondaryContactRequired is a boolean type in User Entity. When I click on check box value of secondaryContactRequired is true.
But when I uncheck the checkbox then secondaryContactRequired is taking as true only, but I want this value as false
Why this is happening? Please advise me what's wrong with this.
Thanks in advance
I have included interceptor...Now its' working...Thanks to all for sharing your valuable solutions

Richfaces: a4j:commandLink with both onclick and actionListener

I am using Richfaces 4.1.0.Final.
I have a problem similar to this post, however the remedy (return true;) does not work for me.
It may be the version of Richfaces I'm using, but upgrading is very difficult for me and I'd like to verify that's the problem first or preferably find a workaround.
I have an a4j:commandLink link in a rich:column in a rich:dataTable in a rich:tab within a rich:tabPanel. I'd like to click the link, have the column data saved to the backing bean (e.g. via f:setPropertyActionListener) and then have the user switched to another tab for editing (using: #{rich:component('TabPanel')}.switchToItem('EditTab');)
If I use oncomplete for the javascript piece, the handler fires, but the switchToItem piece doesn't work. If I instead use onclick for the javascript piece, the handler doesn't fire, but the switchToItem piece does work. I need both.
Does anyone know of a solution? Is this a known problem in this version of Richfaces? Does anyone know how I can work around this problem using other components?
I apologize in advance, but I cannot post my code.
Thanks,
John
Update:
I upgraded to Richfaces 4.2.2.Final, but there was no improvement. Apparently it is impossible to use a4j:commandLink with a f:setPropertyActiopnListener if you also use the oncomplete to switchToItem another tab.
Ok,
I added a second f:setPropertyActionListener to set the TabPanel's activeItem to EditTab. Then I added oncomplete="location.reload(true);" to refresh everything and redraw with the correct active tab.
It works, but I'd still like to hear a better approach.
I tried it with RichFaces 4.2.2.Final and it worked for me when I used onclick:
<rich:dataTable value="#{model.simple}" var="item">
<rich:column>
<a4j:commandButton value="click me" onclick="#{rich:component('tabPanel')}.switchToItem('tab3');" action="#{bean.action}">
<a4j:param assignTo="#{bean.parameter}" name="param" value="#{item}"/>
</a4j:commandButton>
</rich:column>
</rich:dataTable>
<rich:tabPanel id="tabPanel">
<rich:tab name="tab1">tab 1 content</rich:tab>
<rich:tab name="tab2">tab 2 content</rich:tab>
<rich:tab name="tab3">tab 3 content</rich:tab>
</rich:tabPanel>
Regards,
Palo

primefaces dataTable:how to hide column

I want to hide some columns in a dataTable(e.g id,serial),the columns will be rendered because javascript need access the value of the columns.
Any idea?
You can use display: none or visibility: hidden. You can find the difference in here: What is the difference between visibility:hidden and display:none?
Whatever you use, you will have access with javascript to those elements.
Also you can find here a interesting point of view regarding the usage of display:none.
Just set the "rendered" attribute to "false":
<p:column rendered="false">
...
</p:column>
Did you try this:
<p:column style="display: none" //...
If you are using Prime NG, for angular, in p-column you can add attribute [hidden]="true". That solved my issue. Also, that column will show up in export CSV function which is kind of cool.

not able to find multi select dropdown, only h:selectManyListbox is present

I am looking for a dropdown something like this
I am not able to find any component that suits my need.Only following component is present, but this component is not fulfilling my needs as the data is not showing like a dropdown with multi-select capabilites in it.
<h:selectManyListbox id="option">
<f:selectItems value="#{supportData.states}" />
</h:selectManyListbox>
Please suggest , what shall I do?
you can use SelectCheckboxMenu in primefaces
The primefaces will help you and the showcase is here.
http://www.primefaces.org/showcase/ui/selectCheckboxMenu.jsf

Resources