How to pass parameters panelgroup - binding, JSF [duplicate] - jsf

This question already has answers here:
How does the 'binding' attribute work in JSF? When and how should it be used?
(2 answers)
Closed 8 years ago.
I have a datatable that reads registers from a database.
In the datatable I have a panelgroup that is populated by binding
My problem is that I can not pass a parameter. I want to pass a value from the datatable variable, in that case preg, on each row I want to know the value of the register read to populate the panelgroup.
If I display the value it works fine for each row: #{preg.idpreg}
<h:dataTable var="preg" value="#{Pregbacking.list(Pregbacking.idenq)}">
<h:column>
#{preg.idpreg}
<h:panelGroup binding="#{Pregbacking.dynamicDataTableGroup(preg.idpreg)}"/>
</h:column>
</h:dataTable>
Does anybody know how can I solve this?

That should work just find but I believe that you need to make sure you are using a modern servlet spec (v3 I think). Use the latest Glassfish or Tomcat app server.

Related

commandLink does not call action method with correct backingBean [duplicate]

This question already has answers here:
commandButton/commandLink/ajax action/listener method not invoked or input value not set/updated
(12 answers)
Closed 5 years ago.
I am working with JSF trying to do a .xhtml as simple as :
<ui:composition ...>
<span class="fr">
<a4j:commandLink value="#{msg.label_return}"
action="#{backingBeanRef['navigateBack']()}"
rendered="#{backingBeanRef['returnValueStackBean']['returnValueStack']['size']() ne 0}"
render="#{render}"/>
</span>
</ui:composition>
so I can include it in several views. It works as expected in most of them but one, in which the action method is never called.
I have tried to call the method without parameterization (#{myBean.navigateBack()}) and it still doesn't works.
I have also tried to write #{backingBeanRef'navigateBack'} above the commandLink and the method is called so the backingBeanRef is correct and everything should work but it doesn't.
At this point I have no clue about what is happening, does anyone knows?
Thanks in advance
I had two <h:form> in my code. Once I removed one of these, this got fixed.

PrimeFaces dataTable method called many times [duplicate]

This question already has answers here:
Defining and reusing an EL variable in JSF page
(2 answers)
Closed 6 years ago.
I have a datatable with a column:
<p:dataTable value="#{cc.attrs.bean.model}"
...
<p:column style="width:#{bean.getWidth('colDate', 55)}px;"
It seems that the bean.getWidth method is called for every row in the table. Thus, when having 100 rows, the method is called a hundred times. I expected the method to be called only once.
Am I wrong?
No, it's right.
You can cache the value into your bean or use JSTL
<c:set var="width" value="#{bean.getWidth('colDate', 55)}" />
<p:dataTable value="#{cc.attrs.bean.model}"
...
<p:column style="width:#{width}px;"
You can find more infos here https://stackoverflow.com/tags/jstl/info.
Don't forget the namespace .
you can save result of getWidth in managed bean attribute then use this in column style

How can I add JSF code to xhtml in the attribute id? [duplicate]

This question already has answers here:
How to dynamically generate id in dataTable using ui:repeat tag
(4 answers)
How to use EL with <ui:repeat var> in id attribute of a JSF component
(1 answer)
Closed 6 years ago.
I am working with JSF 2.2 and I would like use JSF variables in the id attribute for to send individuals petitions for each list's element.
For example:
<ui:repeat value="#{bean.numbers}" var="number">
<h:inputText id="text#{number}"/>
</ui:repeat>
Thank you

Using rendered with JSF [duplicate]

This question already has an answer here:
Why do I need to nest a component with rendered="#{some}" in another component when I want to ajax-update it?
(1 answer)
Closed 7 years ago.
How does rendered work? It hides h:form content completely and does not show it if expression.list is not empty.
<h:form id="stackForm" rendered="#{not empty expression.list}">
<p:orderList id="stack" value="#{expression.list}"...
...
It doesn't hide it - it doesn't render it at all, if rendered condition evaluates to false. In your case, if #{expression.list} is empty, form will not be rendered. Or, when rendered is translated to plain English, read it as Render the form if expression.list is not empty.

primefaces commandbutton update does not work [duplicate]

This question already has answers here:
commandButton/commandLink/ajax action/listener method not invoked or input value not set/updated
(12 answers)
Closed 2 years ago.
I have minimized my code to better show you what is not working.
<h:body>
<f:view>
<h:form id="wbSelectForm">
<p:commandButton id="viewWorkbenchButton" icon="ui-icon-show"
title="View Workbench" update=":wbTestPanel"
actionListener="#{WorkbenchControllerBean.test}">
</p:commandButton>
</h:form>
<p:panel id="wbTestPanel">
Test: Active Wb: #{WorkbenchControllerBean.number}
</p:panel>
</f:view>
</h:body>
When i press the commandButton, i would expect that 'wbTestPanel' is being updated, which does somehow NOT happen. I know that because WorkbenchControllerBean.getNumber() is not called.
I am using primefaces 3.5. I already tried differend values for 'process'-attribute as well as putting RequestContext.getCurrentInstance().update("wbTestPanel")in WorkbenchControllerBean.test()-method.
I think that maybe the code is right, but there are any settings in the project or runtime environment (Java 7 + JBoss 7.1.1) that prevent primefaces from updating the other panel. Could you please give me a hint what to search for?
Thanks in advance!
Are you sure that test() method is invoked?
If yes, can you try with following update expression?
update="#([id$=wbTestPanel])"
Otherwise, it maybe the case that test() method is not called because of a validation error. If that is the case, you can inspect it with debug or firebug.
Use : before id
Remember
If you make a dialog.
Before Dialog old form tag should be closed.
Then dialouge content should be placed into another form.
Use update=":dialougeid, :dialougeFormId"

Resources