last day (15 days later) » 

3:12 PM
0
A: Composite component with Error in JSF

TarikFirst, you must specify a method signature so that JSF knows its a method expression and not a value expression, your composite component should look like this: <composite:interface> <composite:attribute name="acaoDestino" required="true" method-signature="void actionListener()" ...

 
didn't work, i edited my post with new informations. I'm using JSF 2.2
 
@user2776409 please provide how are using your composite component in your xhtml page?
 
I edited my post
 
You have to use it like this: <jw:confirmButton acaoDestino="#{managedBeanName.removeSelected}" value="Remover Selecionados" />
 
I tried, same error !
 
3:12 PM
please remove the value attribute as you didn't declare it in your CC interface, i am using your same code and its working!
 
Hi
I'm using value attribute
i can't remove that
i didn't post it but i'm using before 'acaoDestino'
 
ok, so try to modify your method signature in your managed bean and in your attribute like i specified in the Second part
 
1 second, i will try
 
by adding the ActionEvent param
 
ok. wait
didn't work. see the error: Unable to find method [removeSelected] with [0] parameters
Look in my called:<jw:confirmButton
acaoDestino="#{cc.attrs.managedBeanName.removeSelected()}"
value="Remover Selecionados" />
and in composite component: <composite:attribute name="acaoDestino" required="true" method-signature="void actionListener(ActionEvent e)"
shortDescription="Método que será executado quando o usuário clicar no botão 'Sim'." />
 
3:21 PM
nn
wait
 
hey , i have teamviewer if you think better, you can access my pc
 
you didnt modify the acaoDestino attribute
acaoDestino="#{managedBeanName.removeSelected()}"
remove the cc.attrs. from the jw:confirmButton
 
itried acaoDestino="#{managedBeanName.removeSelected}" withou "()" and igot another error
 
ok lets use teamviewer
 
id: 806 773 064
pass: 8sfb62
 
 
2 hours later…
5:20 PM
Hi
I saw again the xhtml files i copied from you, as you are making a CC inside a CC, i want to see the xhtml file where you are using the outer CC
 
6:00 PM
Hi
i'm using in bancas.xhtml
look, bancas.xhtml uses crudButtons.xhml (composite) that uses confimButton.xhtml (another composite).
 
6:11 PM
can i see the snippet of code where you uses crudButtons.xhml
 
sure
look: <div class="panel-body">
<jw:crudButtons targetPage="manter_banca"
managedBeanName="#{bancaMB}" />
</div>
another thing...
i can't use removeSelecteD(ActionEvent e)
this didn't work
 
why
 
i will come back to old code
a lot of strange errors
 
the old code woked ?
 
/resources/jwebbuild/crudButtons.xhtml @29,35 acaoDestino="#{cc.attrs.managedBeanName.removeSelected}": Property 'removeSelected' not found on type br.com.cardoso.mb.BancaMBImpl
Look ...
Let me explain ...
 
6:17 PM
the bean bancaMB is the name of your br.com.cardoso.mb.BancaMBImpl bean ?
 
yeah
BancaMBImpl extends BasicCrudMBImpl
let me explain a thing. ... i think this is important to solution
The old code worked but ....
This removeSelected() was called twice, the first time everything works but in second time the error occurrs
I read in some place that can be because a binding that i'm doing.
but i dont have sure if binding can cause this problem
 
and why you are using a CC inside CC
why not just one
 
because confirmDialog.xhtml is a generic component for another uses.
I.E: I wanna create a confirm dialog for doing something, i can use this component
in this case, crudButtons.xhtml uses confirmDialog.xhtml because i need a confirm remove dialog
 
but to work around you can use only crudButtons
and add h:commandbutton instead of your confirmDialog
 
i can try ... but really i don't think this is the problem
I think the problem is because of twice called
 
6:22 PM
no but you may simplify the problem
 
ok .. i will try
give me a second
 
yep
 
I have a good and a bad news :D
The good news is that worked with just one CC, without CC inside CC
the Bad news is that just work in second click. i.e: when i click first time in "Yes" nothing happen, i open again and in second click everything works.
 
did you use it like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:jw="http://java.sun.com/jsf/composite/jwebbuild">

<composite:interface>
<composite:attribute name="targetPage" required="true"
and you call your CC like:

<div class="panel-body">
<jw:crudButtons targetPage="manter_banca"
managedBeanName="#{bancaMB}" acaoDestino= "#{bancaMB.removeSelected}" />
</div>
 
6:44 PM
no, i make this:
In my bancas.xhtml:
in my composite:

<div class="btn-group" role="group" aria-label="...">
<h:button value="Cadastrar" rendered="#{cc.attrs.showButtonCadastrar}"
outcome="#{cc.attrs.managedBeanName.redirectCriarBean(cc.attrs.targetPage)}"
styleClass="btn btn-primary" />
<h:commandButton styleClass="btn btn-default" type="button" value="Remover Selecionados">
<f:passThroughAttribute name="data-toggle" value="modal" />
<f:passThroughAttribute name="data-target" value="#modalConfirmRemove" />
</h:commandButton>
</div>
 
in the code i sent to you i tried to remove "cc.attrs.managedBeanName." so that you can access the method directly from bancas.xhtml, could you try it .?
 
It's works guy
but it's a work around for me
anyway, this working now
the only problem is the works on second clicked
 
yes, but as it worked you maybe more comfortbale to debug your first implementation
still on second click ?
 
in first click the managedBean is not called
just in second click
 
add again your <f:ajax render="@all" execute="@all" />
to force the ajax call
 
7:00 PM
i will try. wait
didn't work. just in second click.
but
in first click i got error:

Caused by: java.lang.ClassNotFoundException: javax.enterprise.context.spi.Contextual
 
you ard working with CDI beans or managed beans ?
as this is related to CDI
 
i'm using ManagedBeans (JSF) + Spring for others class
i dont use CDI
 
what is the name of import fo your managed bean ?
 
javax.faces.bean.ManagedBean
 
thats weird
one second
 
7:07 PM
ok
 
check your import
which import use javax.entreprise
i think there is something wrong with your imports and you are using some CDI features
 
i search in all project and don't have references to: javax.entreprise
this error start after update jsf from 2.1 to 2.2.
 
which application server are you using
 
tomcat 7
 
this is related to CDI, and tomcat dont use it, could you send the whole stack
and please send me all your imports in that bean
 
7:15 PM
ok, look:
Fev 01, 2015 4:13:57 PM com.sun.faces.application.view.ViewScopeManager <init>
Informações: CDI @ViewScoped manager unavailable
java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Contextual
at com.sun.faces.application.view.ViewScopeManager.<init>(Unknown Source)
at com.sun.faces.application.view.ViewScopeManager.getInstance(Unknown Source)
at com.sun.faces.application.view.ViewScopeEventListener.processEvent(Unknown Source)
at javax.faces.event.SystemEvent.processListener(Unknown Source)
 
which jsf version
2.2. ?
 
2.2.9
the last
*lastest
 
ah ok as there was in issue in the 2.2.7 and 8
please send me your imports
 
my pom.xml ?
 
no
the imports in your managed bean
 
7:18 PM
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import javax.annotation.PostConstruct;
import javax.faces.component.html.HtmlDataTable;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;

import org.apache.log4j.Logger;

import br.com.jwebbuild.bean.AbstractBean;
import br.com.jwebbuild.bo.BasicBO;
import br.com.jwebbuild.exception.BOException;
this is in BasicCrudMBImpl
in BancaMBImpl i have:
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;

import br.com.cardoso.bean.Banca;
import br.com.jwebbuild.bo.BasicBO;
import br.com.jwebbuild.mb.BasicCrudMBImpl;
 
your errors obssesed me :=
could you send imports of BasicCrudMBImpl
 
i already send
are the first import
 
this issue is for 2.2.8 and 2.2.7, i can't understand why you get it
it was a bug in that versions
could you try to use sessionScope
just to be sure thats its the source of your problem
 
sure.. give me one second i'll try
with SessionScoped the error disappear
but i cant use SessionScoped
 
7:36 PM
yes i know, the problem is that was a bug in 2.2.7 and 2.2.8
they said its resolved
but apparently not!
 
if i change for JSF 2.2.5,4,3.. ?
i just updated to 2.2.9 because i need CUSTOM HTML ATTRIBUTES like data-target
i used 2.1 before
 
i heard that its working for 2.2.6
try this one
 
ok. 1seg
sec
almost there
the error dissaper with JSF 2.2.6
GREAT
 
thats great
:)
 
but ... the actionListener just work in second click
 
7:46 PM
so its working from the first click ?
oh
 
i putted a LifeCycleListener
 
even with the f:ajax
?
 
when i click first time:
START PHASE RESTORE_VIEW 1
END PHASE RESTORE_VIEW 1
START PHASE APPLY_REQUEST_VALUES 2
END PHASE APPLY_REQUEST_VALUES 2
START PHASE PROCESS_VALIDATIONS 3
END PHASE PROCESS_VALIDATIONS 3
START PHASE RENDER_RESPONSE 6
END PHASE RENDER_RESPONSE 6
the INVOKE_APPLICATION is not called
in second click: START PHASE RESTORE_VIEW 1
END PHASE RESTORE_VIEW 1
START PHASE APPLY_REQUEST_VALUES 2
END PHASE APPLY_REQUEST_VALUES 2
START PHASE PROCESS_VALIDATIONS 3
END PHASE PROCESS_VALIDATIONS 3
START PHASE UPDATE_MODEL_VALUES 4
END PHASE UPDATE_MODEL_VALUES 4
START PHASE INVOKE_APPLICATION 5
INFO 01/02/2015 16:45:56 [br.com.jwebbuild.dao.BasicDAOImpl:196] - Deletando Bean br.com.cardoso.bean.Banca
Hibernate: select banca0_.id as id17_0_, banca0_.nome as nome17_0_ from banca banca0_ where banca0_.id=?
Yeah, i tried with f:ajax
and without f:ajax
in second click UPDATE_MODAL and IVOKE_APPLICATION is called
first click skip this phases i dont know why
 
you are not using any immediate
?
 
not
just binding
in dataTable
 
7:51 PM
do you have firebug ?
that may help you to see what ids in each request
 
yeah
 
maybe we can understand why there is 2 requessts
 
what you suggest ?
you can acess my system if you want
login: root
pass: 1234
 
what is the button i have to ckilck in ?
as i dont un derstand italy (i guess)
 
hehe
check some checkbox
after click in "Remover Selecionados"
will display a modal dialog
click in "Sim"
in first time nothing happens
after try this again, in second time the register should be deleted
 
8:01 PM
are you sure you the entire page to be reloaded after you click "sim"
as every thing reloads
maybe that will be better if you reload only the datable
it doesn't seem to be an ajax request !
no ajax request was sent
 
so, you suggest i use <f:ajax execute=@all render=myDatatable />
 
yes, to see if the ajax will be sent
 
ok . i second
one second
try now ..
the modal don't close but just in second click
the register is removed
i added the f:ajax
 
and tell me, do you have <h:head> in your bancas.xhtml or <head>
 
yeah
i have this: <h:head />
and don't <h:head><h:/head>
 
8:11 PM
do you have any h:messages tag ? i think something happens in valoidation faces which prevent update model from execution
normally you should have one as you are in dev mode
but try to add it if not
 
I have this in my template.xhtml <p:growl autoUpdate="true" />
from primefaces
 
i will end by removing all the stuff there
 
i am thinking about another workaround
 
hmm..
tell me
 
8:17 PM
but i dont see the interest
oine sec
that component <p:growl autoUpdate="true" /> checks validation errors tow ?
 
this component just show the messages that i sent from FacesContext
FacesContext.getCurrentInstance().addMessage(componentId, message);
 
please add h:messages and ui:debug,
the ajax request render dataTableListagem
while your client id for the datable
is
j_idt25:dataTableListagem
 
hmm ...
 
we need to expose the componene
 
i'm putting the debug
and messages
ctrl + shit + x
is debug mode
look now
 
8:28 PM
please give the composite component an id, and specify that id in the ajax render
 
i give an id but jsf put j_idt25 before
i cant prependId in commandbutton
 
ok we will come back to that, but i am wondering why when i click in sim the popup doesnt desapear
 
ok ... i cant see it after
but the biggest problem is that you need click twice
ops
i can see it later
 
but even if i click twice the popup is still here
 
yeah i know that
i can put render=@all
 
8:32 PM
something is wrong with validation
when do you call function faceletsDebug(URL)
?
 
never
i dont call this method
 
is it in the pop up or the page ?
 
it's a modal dialog
from bootstrap
this confirm dialog is a DIV inside page
 
because the server response dont include any update to your datatable
 
i putted render=@all and dialog closes again
 
8:37 PM
its closed because you send another request
you are not using ajax
and the problem persist
 
hmm ...
 
let try another way
add that to your CC interface <composite:actionSource name="someName" targets="your commandbutton id"/>
remove the f:ajax from your CC
 
ok 1 second
 
dont execute yetr
 
8:40 PM
add in yourr cc impl the insertChildren tag whithout any attribute
 
ok 1 second
which the subject of "actionSource"
i don't know this component
 
and go to your and in the bancas.xhtml and use it like this:
<div class="panel-body">
<jw:crudButtons targetPage="manter_banca"
managedBeanName="#{bancaMB}" >
</div>
sorry
not that
 
one second
sorry i mixed everything
we dont have toi use the actionsource
 
8:45 PM
what i want to do
is to remove the f:ajax from the button
 
yeah i already removed
i putted insertChildren too
 
and make it inside the bancas like tha:
<div class="panel-body">
<jw:crudButtons targetPage="manter_banca"
managedBeanName="#{bancaMB}">
<f:ajax render="dataTableListagem"/>
</jw:crudButtons>
</div>
yes let insertchildren
dont remove it
 
ok i second
i already understand your idea
 
:)
 
<composite:insertChildren /> should be inside commandButton ? Like this:

<h:commandButton
actionListener="#{cc.attrs.managedBeanName.removeSelected()}"
class="btn btn-primary" value="Sim">
<composite:insertChildren />
</h:commandButton>
?
i already did it
 
8:49 PM
no
 
but the error: /core/banca/bancas.xhtml @33,49 <f:ajax> Error: enclosing composite component does not support event null
 
just inside the implementaion
 
inside <composite:implementation>
 
i tried but the error continue
eclosing composite component..
access the page and see
 
8:51 PM
yes we have to add event = "click"
in the f:ajax
 
we didn't specify it before because its defaults to click for commandbutton
 
ready
same error
ops, really: enclosing composite component does not support event click
 
give ùme one min
 
8:58 PM
in the composite:interface add:
<composite:clientBehavior name="click" event="action" targets="#{cc.clientId}:commandButtonId"/>
please change commandButtonId with the id you specified for the h:commandButton
 
ok
ready
now even in second click dont works
 
hhh
sorry
that makes me lauphing :)
 
:(
lauphing ?
what did you mean
 
just kidding
sorry
tell me did you specified the render in f:ajax
and also the event
 
yeah ... look
<jw:crudButtons targetPage="manter_banca"
managedBeanName="#{bancaMB}">
<f:ajax event="click" render="dataTableListagem"/>
</jw:crudButtons>
in CC:

<composite:clientBehavior name="click" event="action" targets="#{cc.clientId}:commandButtonRemoverSelected"/>
...

<h:commandButton id="commandButtonRemoverSelected"
actionListener="#{cc.attrs.managedBeanName.removeSelected()}"
class="btn btn-primary" value="Sim">
</h:commandButton>
 
9:05 PM
even if its not good practice
but try to add
j_idt25:dataTableListagem
instead of dataTableListagem
 
just to see if its that the pb
 
ready
but didnt work too :(
 
wow
one sec
but this time the response was great
see the firebug
it includes changes for datatable
 
how did you see that in google chomr
e?
google chrome
?
 
9:09 PM
no using firefox
 
the wiget you are using
are you sure it doesn't execute any JS
and that JS doesn't return false at the end ?
 
hmm
i'm using bootstrap.
so i dont know if bootstrap do something
but ... now i need to go
we can continue later
because i've to go
 
this is server response
<partial-response id="j_id1">
<changes>
<update id="j_idt14"><span id="j_idt14"></span><script id="j_idt14_s" type="text/javascript">$(function(){PrimeFaces.cw('Growl','widget_j_idt14',{id:'j_idt14',sticky:false,life:6000,escape:true,msgs:[]});});</script></update>
<update id="j_idt25:dataTableListagem"><table id="j_idt25:dataTableListagem" class="table table-hover"> <thead> <tr> <th class="smallColumn" scope="col"><input id="j_idt25:dataTableListagem:j_idt34" type="checkbox" name="j_idt25:dataTableListagem:j_idt34" onclick="mojarra.ab(this,event,'valueChange','@form','@all')" /></th> <th s
ok
 
thanks for you help
you help me soo much
 
9:11 PM
no problem
you are welcome
even if we didn't resolved the pb
 
but you help me resolve a lot of problems
:D
i had about 4
now i have just one to solve
 
good then
and tryu to track the javascript
good luck
 
i will try
thanks again
i will give point for you in stackoverflow
 
ok bye
 

  last day (15 days later) »