0

Here is my second attempt (hopefully this time it is better then previous) at briefing my structure :

I have two views for index.xhtml :

View 1: Header.xhtml DefaultPage.xhtml Footer.xhtml

In my Header.xhtml, I have menubar which holds reference to index.xhtml with different GET parameter values. Based on my GET parameter value(content_page_to_render), I generate second view as follows :

View 2 : Header.xhtml Page2.xhtml Footer.xhtml

Here are the sample codes for Index.xhtml and Page2.xhtml :

Index.xhtml :

<insert id="header">
 <include src="header.xhtml">
</insert>

<insert id="content">
    <if test="${content_page_to_render == body1.xhtml}">
      <include src="body1.xhtml">
    </if>
    <if test="${content_page_to_render == body2.xhtml}">
      <include src="body2.xhtml">
    </if>
</insert>

And my body2.xhtml looks like this : < form id="formId" class="form-horizontal" role="form"> < commandButton action="#{backingBean.method}" value="Submit"/> < /form>

This backing bean method is not being called. However the moment I move this commandButton to index.xhtml (i.e. outside of the included page) then it is working (i.e. the backing bean method is called).

P.S. : 1. Tried to change the action value to garbage and it has no effect, the above behavior doesn't change implying that the action value is not considered at all for some reason. 2. I tried to create a sample JSF project with basic include without multiple views and it worked fine. However, in my actual project the include is not working.

Would request you to help me with the same.

Thanks & Regards, Ravikiran Mane.

  • Post the code of `method` in the `backingBean` bean class so we can help you better. – JMSilla Apr 28 '16 at 07:14
  • @BalusC: I did go through the detailed post / answer provided in the suggested post (by BalusC). It did help me get better understanding of the communication happening in JSF and also remove other missing pieces. Thanks for the detailed answer BalusC! I believe the points 1, 2, 3, 5, 11, 12 ,13, in the referred post, may be applied to my case given the constructs I am using. For Point 5, I am unsure of how to ensure that the rendered attribute is evaluated to true. Rest of the points I believe I confirmed and look insync with the suggestions. – user1290666 Apr 29 '16 at 03:24
  • @BalusC and JMSilla : Have edited my question to paint a better picture of my project / scenario. Thank you very much for looking into the issue! – user1290666 Apr 29 '16 at 03:44
  • Code is not in MVCE flavor, so it's hard to naildown the cause, but I believe you're essentially trying to achieve the same as asked here: http://stackoverflow.com/q/7108668 – BalusC Apr 29 '16 at 07:52
  • @BalusC: Thank you very much for your inputs! I'll do some further troubleshooting and update the post once I overcome it. Thanks! – user1290666 Apr 30 '16 at 14:01

0 Answers0