1

I have a navigation define from one page to another like this.

<h:outputLink id="idLink"  value="Page1.seam" >
    <f:param name="m" value="n103" />
    <f:param name="mss" value="110" />
<h:outputText value="Return to Page 1" />
<a4j:support event="onclick" action="#{beanName.action}" limitToList="true" ignoreDupResponses="true" eventsQueue="que" ajaxSingle="true" immediate="true">
</a4j:support>
</h:outputLink>

The problem is there are sometimes that the view isn't changing to Page1.seam and remain in Page2.seam. Is there anyone who knows better ? Help will be greatly appreciated. Thanks.

Tiny
  • 27,221
  • 105
  • 339
  • 599
Ellie Fabrero
  • 791
  • 2
  • 16
  • 41
  • What do you do in beanName.action? Post some code. Do you get any error or logs when it fails? Check the action in your browser. Is he doing a post. You can check with firebug net section and see if and what post is performed when it fails – roel Jun 05 '12 at 09:12
  • can u try using a `` instead of `` – Mango Jun 05 '12 at 09:14
  • @roel - ill look for an error, but this happens at very low chance, so ill further investigate. – Ellie Fabrero Jun 05 '12 at 09:25
  • @Mango - nope does not work. it generates a post. :)) – Ellie Fabrero Jun 05 '12 at 09:25

1 Answers1

3

This construct makes no sense. Make it a normal link

<h:outputLink value="Page1.seam">
    <f:param name="m" value="n103" />
    <f:param name="mss" value="110" />
    <h:outputText value="Return to Page 1" />
</h:outputLink>

and to invoke an action on opening of the page, use <f:event type="preRenderView"> in the target view instead.

<f:event type="preRenderView" listener="#{beanName.action}" />

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • by the way i'm still using JSF 1.2 so there is no f:event, what do you think is a better alternative for this. thanks :) – Ellie Fabrero Jun 06 '12 at 05:32
  • Ah thus you also don't have a `` to set the parameters. Use the bean's constructor or `@PostConstruct` instead. – BalusC Jun 06 '12 at 12:14
  • @BalusC Can you please elaborate the reason when you say, `This construct makes no sense. Make it a normal link`. Why do you say so? – Vikas V Sep 09 '13 at 16:47
  • @Vikas: OP tried to send an idempotent request using ajax. This just doesn't make sense. – BalusC Sep 09 '13 at 16:51