-
1. Re: The Right Scope
fhh Jul 23, 2007 1:25 PM (in response to junkie)Are you rendering or redirecting to searchResultsPage?
Regards
Felix -
2. Re: The Right Scope
junkie Jul 23, 2007 2:14 PM (in response to junkie)Hi fhh,
as BookSearchAction.search is called from page 1 and displays page 2 after that I would call it a redirect... this is how page 1 and 2 look like:
Page 1:<h:form> <h:inputText value="#{searchRequest.keyword}" size="20"/> <h:commandButton value="#{msg.search}" action="#{bookSearch.search}" class="button"/> </h:form>
Page 2("searchResultsPage"):<h:dataTable class="dataTable" value="#{searchResults}" var="result" rendered="#{searchResults.rowCount>0}"> <h:column> <b><h:outputText value="#{result.title}"/></b> ...
-
3. Re: The Right Scope
junkie Jul 24, 2007 3:24 AM (in response to junkie)Dear Seam community, that should be an easy question for you...
-
4. Re: The Right Scope
ellenzhao Jul 24, 2007 7:22 AM (in response to junkie)You may want to try to make the searchResults list managed, i.e, remove the @DataModel annotation, write getter/setter for the searchResults list and do not forget to also write them in the business interface. Access searchResults using bookSearch.searchResults. (I assume the name of your action bean is "bookSearch", you may need to adjust it accordingly. )
-
5. Re: The Right Scope
junkie Jul 24, 2007 10:54 AM (in response to junkie)@ellenzhao:
That does not work, I've just tried it. bookSearch.searchResults is not available on page 2, even if I change BookSearchAction from a SLSB into a SFSB.
@All: Seam community, you know the solution, I'm sure. That has to work somehow, there must be a solution! This is _SEAM_! -
6. Re: The Right Scope
wise_guybg Jul 24, 2007 11:18 AM (in response to junkie)can you post here your pages.xml ;-)
-
7. Re: The Right Scope
wise_guybg Jul 24, 2007 11:24 AM (in response to junkie)I think you should find an example (eg.: hotel booking) of what you're trying to do and copy the working code.
I think you have to use conversation scope. Therefore you should @Begin a conversation with search(). Maybe with join=true -
8. Re: The Right Scope
junkie Jul 24, 2007 1:10 PM (in response to junkie)@wise_guybg:
The hotel booking example does not perform a redirect. The search is triggered from the same page where the results are rendered.
I need the results on a page that is not the page that the action was called from.
Should it really be so difficult?? -
9. Re: The Right Scope
wise_guybg Jul 25, 2007 1:28 PM (in response to junkie)Hi JUnkie,
You have not provided the code from pages.xml that I requested from you. I wanted you to post it here because yesterday a colleague was having a problem and the solution was fixing pages.xml
The solution you need should not be difficult, no. You have to understand what you have with Seam and how you can use it.
If the redirect is really a problem you might execute an action (MethodBinding) with your redirect. Something that will start your conversation. You haven't commented on the @Begin that I think you're missingI need the results on a page that is not the page that the action was called from.
My prescription would be: proper conversation handling and proper pages.xml
You have posted a session scoped bean and some jsf code.
I think that with minor modification the hotel booking example is also valid... -
10. Re: The Right Scope
junkie Jul 25, 2007 1:41 PM (in response to junkie)@wise_guybg:
Thanks for your reply! My pages.xml is empty (it's a brand new project).
Regarding "@Begin": I believe that cannot be used on a SLSB, is that correct? Then I would need to change to a SFSB (which I thought I could avoid somehow...)
If you have an idea, a cool entry in pages.xml or so, please let me know!
Thanks! -
11. Re: The Right Scope
wise_guybg Jul 25, 2007 1:59 PM (in response to junkie)Hi JUnkie,
I couldn't remember what SLSB and SFSB stood for so I searched on the Internet. Yes, I'm that dumb :) This is an article that might be interesting:
http://weblogs.java.net/blog/schaefa/archive/2003/10/slsb_sfsb_meani.html
Anyways, maybe you should have your SLSB but use it with a SFSB that will guide the conversation and eventually contain the info from the :@DataModel private List<SearchResult> searchResults;
I am not sure if you should separate logic this way though. I think this is what's commented in the article.
About pages.xml, I don't recall if there is anything that can help you.
There is also the option to manually work with conversations like this:<h:outputLink value="main.seam" target="_blank"> <s:conversationId/> <s:conversationPropagation propagation="join"/> <h:outputText value="Open New Tab"/> </h:outputLink>
but in my opinion this isn't applicable either.
So you have to @Begin a conversation somehow. -
12. Re: The Right Scope
smokingapipe Jul 25, 2007 2:49 PM (in response to junkie)My understanding is that conversation scope is almost always the right scope. If you're doing a search, you want conversations so that users can do multiple different searches in different tabs, right?
-
13. Re: The Right Scope
junkie Jul 25, 2007 2:52 PM (in response to junkie)@SmokingAPipe:
Thanks, I do not care for multiple different searches in different tabs yet, I just want the DataModel available on the page that I redirect to. -
14. Re: The Right Scope
junkie Jul 26, 2007 8:31 AM (in response to junkie)Okay, I found it. I used Ajax4JSF (org.ajax4jsf.Filter in web.xml) which destroys all Seam conversation (even a very short one like a simple redirect).
I have added SeamRedirectFilter to web.xml(org.jboss.seam.servlet.SeamRedirectFilter) which solved all my problems.
BUT WHY is SeamRedirectFilter deprecated??? It is needed for Ajaja4JSF, look here:
http://labs.jboss.com/jbossajax4jsf/docs/devguide/en/html/SettingsForDifferentEnvironments.html#JBossSeamSupport
Mr Gavin King: It took me days (and I worked into the nights) to find out why my first Seam app does not do what it should. Could you take 1 minute of your time and answer why the SeamRedirectFilter is deprecated?