-
1. Re: ajax request to change and display a second table on the same page
bleathem Jul 4, 2013 12:54 PM (in response to jobame)Any output on the browser error console, or in the server log? Are you able to get that commandLink/action to work outside of the datatable?
-
2. Re: ajax request to change and display a second table on the same page
jobame Jul 5, 2013 1:40 AM (in response to bleathem)There is no error and in the server log nothing is printed - although I have a print statement in the method I would like to call (getMoreDetailsOnSubscription).
Without the table I can get the example to work, sure (see e.g. http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=commandLink&skin=blueSky):
<h:form> <h:panelGrid columns="3"> <h:inputText value="#{detDeb.testSubscription}" /> <a4j:commandLink value="Submit" action="#{detDeb.getMoreDetailsOnSubscription()}" render="out" execute="@form" /> </h:panelGrid> </h:form> <a4j:outputPanel id="out"> <rich:dataTable value="#{detDeb.account}" var="account" rendered="#{detDeb.account != null}"> <rich:column> <f:facet name="header">#{msgs.detailsId}</f:facet> <h:outputText value="#{account.id}" /> </rich:column> ... </rich:dataTable> </a4j:outputPanel>
However, in the above example I have to use an inputText field to get the value into the bean. So two fields are displayed but only one field - the link - should be displayed and I couldn't find a possibility to pass a value into the bean only via a4j:commandLink. Is there? If not, is there another solution?
-
3. Re: ajax request to change and display a second table on the same page
jobame Jul 5, 2013 4:44 AM (in response to jobame)Aargh. My bean was in request scope and tables refer to a bean which is kept in memory (e.g. session scoped). However, another question comes up:
With CDI always javax.inject.Named hast to be used so the bean is available via EL and the injected beans are put into the appropriate CDI scope which would be e.g. javax.enterprise.context.RequestScoped, javax.enterprise.context.SessionScoped, javax.enterprise.context.ApplicationScoped or javax.enterprise.context.ConversationScoped.
Now I would like to used the bean in ViewScope which is not available for CDI. I first tried to use javax.faces.bean.ViewScoped with javax.inject.Named but that wouldn't work since the backing bean cannot be put into that scope (since it doesn't exist for CDI) and hence to value cannot be placed from the JSF page into the backing bean (which is an assumption...).
Next, I used javax.faces.bean.ViewScoped with javax.faces.bean.ManagedBean. That seems to be working. However, the dependency injection in the backing bean still works. How come? The backing bean is in jsf view scope. But in which scope are the injected beans being put by CDI into the backing bean? And if CDI works with those two annotations why does it not work when using javax.faces.bean.ViewScoped with javax.inject.Named?
Even though it is working is it wrong to use javax.faces.bean.ManagedBean and javax.faces.bean.ViewScoped together with CDI?
Add-on: I am using AS7.
-
4. Re: ajax request to change and display a second table on the same page
bleathem Jul 5, 2013 12:21 PM (in response to jobame)You do not want to mix CDI scopes with JSF scopes. The Apache DeltaSpike (http://deltaspike.apache.org/) has a CDI implementation of the View Scope, then you can use CDI all-around.