-
1. Re: Command Links and Seam
ryanwaggoner Mar 16, 2009 10:31 PM (in response to ryanwaggoner)So working with this a little bit more, I got it to work...but I don't know why it is working.
My stateful bean provinceBean has an entity province that looks like...
@DataModelSelection("provinceList") @Out(required = false) @In(required = false) private SiProvince province;
My province had these annotations
@Entity @Name("state") @SuppressWarnings("all")
And the page looked like...
<s:span id="provinceTaxRates"> <rich:dataTable value="#{state.taxItems}" var="stateTax" rowClasses="seamDisplayTableRowOne,seamDisplayTableRowTwo" rules="cols"> <h:column> <f:facet name="header">Name</f:facet> <h:outputText value="#{stateTax.siName}"/> </h:column> <h:column> <f:facet name="header">Rate</f:facet> <h:outputText value="#{stateTax.siTaxRate}" /> </h:column> <h:column> <f:facet name="header"> Edit </f:facet> <a:commandLink value="Edit" action="#{stateBean.editTax}" reRender="newTaxInput" /> </h:column> </rich:dataTable>
My Command link was not populating my text boxes until I added the annotation
@Scope=(value="ScopeType.CONVERSATION")
to my province entity class,
Can someone explain to me why?
Thanks!
-
2. Re: Command Links and Seam
gonorrhea Mar 16, 2009 11:08 PM (in response to ryanwaggoner)1) @DataModelSelection injects. you don't need @In as well.
Injects the selected value from the JSF DataModel (this is the element of the underlying
collection, or the map value).2) default scope for JPA entity is conversation.
EJB stateful session bean: Conversation
JPA entity class: Conversation
EJB stateless session bean: Stateless
EJB message driven bean: Stateless
JavaBean (POJO): Event -
3. Re: Command Links and Seam
gonorrhea Mar 16, 2009 11:11 PM (in response to ryanwaggoner)you are reRendering newTaxInput component but where is that component in your xhtml snippet you posted? If it doesn't exist, nothing will happen, no error either.
-
4. Re: Command Links and Seam
ryanwaggoner Mar 17, 2009 3:14 PM (in response to ryanwaggoner)That part looks like...
<!-- New Tax Table --> <s:div id="newTaxInput"> <h:panelGrid columns="1"> <rich:panel> <f:facet name="header"> <h:outputText value="New Tax for #{state.siStateCode}" /> </f:facet> <h:column> <h:outputText value="Name: " /> <h:inputText value="#{stateTax.siName}" /> </h:column> <h:column> <h:outputText value="Tax Rate: " /> <h:inputText value="#{stateTax.siTaxRate}" /> </h:column> <h:column> <a:commandButton value="Add Tax" eventsQue="foo" action="#{stateBean.addTax}" reRender="provinceTaxRates" /> </h:column> </rich:panel> </h:panelGrid> </s:div>
What I don't understand is, since the entity's default scope is conversation, why does it not work without the @Scope? (Initially)
-
5. Re: Command Links and Seam
gonorrhea Mar 17, 2009 4:36 PM (in response to ryanwaggoner)You need to show all your code for ppl to help here. Otherwise, it's difficult to follow.
1) in the above xhtml snippet, note that there are three different Seam components referenced: state, stateTax, and stateBean. Show all of those (don't worry about showing local interface(s) if it's SLSB/SFSB).
2) show all your xhtml code, i'm not understanding the overall purpose and logistics of this code
3) you can try using
<a:outputPanel ajaxRendered="true">
to auto-reRender the enclosed area (so add that and remove the<s:div></s:div>
). -
6. Re: Command Links and Seam
ryanwaggoner Mar 17, 2009 7:44 PM (in response to ryanwaggoner)Sorry Ron,
I was hoping there would have been an easy explanation for the problem I was having, and thus I thought the other code would be irrelevant.It is currently working, and I am not too worried about it, I just wasn't sure why it was working.