-
1. Re: Action argument is null when it shouldn't be null
amitev Jul 16, 2007 4:16 PM (in response to grettke_spdr)Are you sure that when the action method is invoked the dto bean exists?
-
2. Re: Action argument is null when it shouldn't be null
grettke_spdr Jul 16, 2007 5:27 PM (in response to grettke_spdr)"amitev" wrote:
Are you sure that when the action method is invoked the dto bean exists?
That is a good question. The search results that carry the DTOs are inside of a session scoped component. -
3. Re: Action argument is null when it shouldn't be null
fmars Jul 16, 2007 8:38 PM (in response to grettke_spdr)i have the same problem in a different way. The parameter passed to method is null.
i have a <s:link> in a dataTable :<rich:dataTable value="#{genes}" var="gene" ....> .... <s:link action="#{tableviewer.displayTargetSequences(gene)}"> ...</s:link> .....</rich:dataTable>
tableviewer is stateless session bean for outjection the parameter and redirection.@Stateless @Name("tableviewer") public class TableViewerAction implements ITableViewer{ @Out private Gene selectedGene; public TableViewerAction() {} public String displayTargetSequences(Gene gene) { selectedGene = gene; return "/targetSequenceViewer.xhtml"; } }
This bean is used only here and constructed probably right after the user clicked on it. Is this the problem? -
4. Re: Action argument is null when it shouldn't be null
grettke_spdr Jul 17, 2007 12:29 AM (in response to grettke_spdr)"fmars" wrote:
i have the same problem in a different way. The parameter passed to method is null.
...
This bean is used only here and constructed probably right after the user clicked on it. Is this the problem?
I get the same problem if I just try passing in the dto itself, it evaluates to null.
I don't think it is a conversational problem because the dto is used to create the link tag itself (the account number), so I know exists somewhere.
Is this a lifecycle issue?
This is how the demo apps are written, but obviously I'm doing something wrong here ;) -
5. Re: Action argument is null when it shouldn't be null
amitev Jul 17, 2007 1:35 AM (in response to grettke_spdr)I had that problem before and i solved it with long running conversation.
-
6. Re: Action argument is null when it shouldn't be null
amitev Jul 17, 2007 1:36 AM (in response to grettke_spdr)could you paste your source code?
-
7. Re: Action argument is null when it shouldn't be null
gayatri.ramamurthi Jul 17, 2007 3:01 AM (in response to grettke_spdr)1) something that skips the attention is the configuration settings which requires that the below code be added to the application config
<view-handler>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</view-handler>
2) Secondly what i noticed while running a similar app is,
" #{accountMaintenanceAction.selectAccount(dto.accountNumber) } " this code generates a URL, with query string "actionMethod=example.xhtml:ccountMaintenanceAction.selectAccount(dto.accountNumber)"
whereas using #{accountMaintenanceAction.selectAccount('12345') } would generate the query string as "actionMethod=example.xhtml:ccountMaintenanceAction.selectAccount('12345')"
I think this proves that there is a problem either with the handler or any related config issue. -
8. Re: Action argument is null when it shouldn't be null
fmars Jul 17, 2007 5:14 AM (in response to grettke_spdr)<view-handler>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</view-handler>
I use Seam 2 and there is no more "SeamFaceletViewHandler".
methsearch.xhtml displays my table. The generated URL looks like this:http://localhost:8080/methcancerdb2/methsearch.seam? dataModelSelection=gene:genes[1]&cid=18&actionMethod=methsearch.xhtml:tableviewer.displayTargetSequences(gene)
dataModelSelection=gene:genes[1] : i've clicked link on the second row. so it is the second object in the list "genes". With gene:genes[1] is "gene" is set to genes[1]. what the rest of the url means, i don't know.
More Details:
I have this methsearch.xhtml for searching my database. there is a button "Show All", which displays all entries on the table with a <s:link> for more infos.
there is a statefull sb for this site, MethSearch.java. here is the relevant part of it:@Stateful @Name("methsearch") public class MethSearch implements IMethSearch{ .... @Out(required=false) private List<Gene> genes; public void showAll(){ genes = ((org.hibernate.Session)this.entityManager.getDelegate()).createCriteria(Gene.class).list(); } }
"genes" outjected as expected. the table displayed. only the var "gene" is not sent to method successfully. Any Idea? -
9. Re: Action argument is null when it shouldn't be null
grettke_spdr Jul 17, 2007 11:29 AM (in response to grettke_spdr)This type of construct (passing in a dto via el) works fine in the Seam 1.2.1GA demo app: "booking".
That said, what does this article imply?
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=104204 -
10. Re: Action argument is null when it shouldn't be null
grettke_spdr Jul 17, 2007 2:56 PM (in response to grettke_spdr)This code from the sample works just fine though:
<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/> -
11. Re: Action argument is null when it shouldn't be null
michaelcourcy Jul 17, 2007 4:51 PM (in response to grettke_spdr)"grettke_spdr" wrote:
This code from the sample works just fine though:
<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
Yes I ran into this problem until I unserstand that a link is a link and a post is a post ;)
Wich means that using such expression<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
make sens only if the #{hotelBookings} collection exist in one the available scope.
in you watch carefully the Scope of #{hotelBookings} in the seam-books example, it's a session scope.
It's really consistent, as you can engage many convesations inside a session. Session is the container of many conversations. Engaging many conversations without a session that reference them don't make sens.
When you use s:link with a one argument method you're passing a reference to an obect but you don't post this object.
But I agree on the fact that it would be more helpful if we could have an error message like : this object could not be found in any scopes (similar to struts) than having the method executed with a null argument.
I can't figure out in wich situation a developper would write<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
and expecting "hot" to be null ! -
12. Re: Action argument is null when it shouldn't be null
grettke_spdr Jul 17, 2007 4:54 PM (in response to grettke_spdr)Comparing my code with the example code I found one very important difference, the collection that populates the sample is annotated with @DataModel. This is my error!
I had used a plain property of my component, that was the wrong way to do it.