This content has been marked as final. 
    
Show                 7 replies
    
- 
        1. Re: invoke a action method everytime a page is accessed FROMpmuir Jan 11, 2007 4:49 AM (in response to antispart)I think that the @RequestParameter will only be not-null when you have an f:param specified. So use an action method run through pages.xml, check for not-null, and act accordingly. 
- 
        2. Re: invoke a action method everytime a page is accessed FROMantispart Jan 11, 2007 5:42 PM (in response to antispart)Thanks petemuir. 
 I have the following code:
 actionBean@Begin(join=true) public void foo() { if(player!=null) log.debug("set"); } public void setBar(String bar) { this.bar= bar; } public String getBar) { return bar; }
 pages.xml<page view-id="/players/plays.xhtml" action="#{playerPlayAction.foo}"/>
 xhtml<s:link ... > <f:param name="bar" value="test"/> </s:link> 
 While foo() gets called every time the page is accessed. the setBar() method is never called.
 If I add:<param name="bar" value="#{actionBean.bar}"/>
 to the pages.xml then the setBar() is called, BUT.
 Once i've navigated to the page 1 time from the s:link now the bar property is always not-null (note that this is a conversation scoped bean).
 Is there any solution to this?
- 
        3. Re: invoke a action method everytime a page is accessed FROMnorman.richards Jan 11, 2007 9:18 PM (in response to antispart)If you need a very peculiar strategy, why not just look up the value as a request attribute directly? 
- 
        4. Re: invoke a action method everytime a page is accessed FROMpmuir Jan 12, 2007 5:00 AM (in response to antispart)1) If you put a <param name="bar" value="#{actionBean.bar}"/>into pages.xml it causes the param to be propagated.
 2) Try this in the action bean (without param in pages.xml)@RequestParameter private String bar; @Begin(join=true) public void foo() { if(player!=null) log.debug("set"); }
- 
        5. Re: invoke a action method everytime a page is accessed FROMantispart Jan 12, 2007 10:00 AM (in response to antispart)petemuir, 
 I tried:
 action bean:@RequestParameter private String bar; @Begin(join=true) public void foo() { if(bar!=null) log.debug("set"); }
 xhtml:<s:link ...> <f:param name="bar" value="testtest"/> </s:link> 
 pages.xml:<page view-id="/players/plays.xhtml" action="#{playerPlayAction.foo}"/>
 Now, when foo() gets called with the s:link the @RequestParameter bar is never set. But if i use an h:outputLink or just type the url string myself then the @RequestParameter does get set. Is this expected behavior?
 The advantage of s:link is that I could continue a conversation (add "join=true" to the foo() method) AND pass in params via a @RequestParam.
 Is this not meant to work with s:link or am I do something wrong?
- 
        6. Re: invoke a action method everytime a page is accessed FROMpmuir Jan 12, 2007 10:03 AM (in response to antispart)Now, when foo() gets called with the s:link the @RequestParameter bar is never set. But if i use an h:outputLink or just type the url string myself then the @RequestParameter does get set. Is this expected behavior? 
 Not sure, sorry. You could just use a commandLink with s:conversationPropagation I think.
- 
        7. Re: invoke a action method everytime a page is accessed FROMantispart Jan 12, 2007 11:30 AM (in response to antispart)Thanks. Your help is always appreciated. 
 
     
    