0

I just stated with JSF2. I am stuck with creating a application model. I have tried out something like in here. With a Header, Body and footer. Now is it possible to change the content view, if a click on some button on header.

My approach was like i have menu in header and i want the body part change based on my selection.

[Menu] page1.XHTML

[Content] page2.xhtml

[Footer] page3.xhtml

I need page2 to change to page4.xhtml when i trigger some action from page1.xhml.

I'm totally blank if this approach is contra to JSF philosophy.

Saju
  • 402
  • 3
  • 11
  • 30
  • This can be done the usual way even though it is an Ajaxical update. What is the problem? – Tiny Jan 30 '15 at 05:56
  • @Tiny I cant figure out how can I change another page view from current page. I'm not sure how to search for such examples also. Please share any resource if you have. – Saju Jan 30 '15 at 06:00
  • 1
    Do you mean to say you want to load another different page in the contents portion (the center portion of the template which is usually meant for dynamic/changeable contents) of the template dynamically, when for example, you click a link in a given menu on the header part of the template? If so then, why do you want to do that? You should instead be updating the contents of that page instead of loading another completely different page dynamically. Or if you merely want to redirect to another page/URL, when a link in that menu is clicked, it can be done the usual way we make a redirect. – Tiny Jan 30 '15 at 06:11
  • 1
    If I were you I would create the (or just some random) database tables, install netbeans 8 and reverse engineer the tables as here: http://stackoverflow.com/questions/25410731/primefaces-built-in-crud/25411710#25411710. This will create the structures you want, everything you need is there, so you can either use it directly or just study it. There is much to learn. I still start like this on new projects – Jaqen H'ghar Jan 30 '15 at 06:19
  • I thought of that approach because, I don't want to add the menu to all the pages. Like you said, I simply want the middle page change based on my menu selection. – Saju Jan 30 '15 at 06:21
  • Web templates usually work in that way. They keep changing contents based on some actions instead of loading another completely new page in some portion of the template (header, footer, side bars - left and right) unless/until there are very special cases. – Tiny Jan 30 '15 at 06:25
  • Noted should be that this way the pages are not idempotently available. I.e. the enduser cannot bookmark/share/link page4.xhtml directly. Do you really need to go in this direction? – BalusC Jan 30 '15 at 08:58
  • @BalusC: I think that 'page' here is the individual .xhtml files. So they are most likely not actual pages (since page1 is in the menu and page3 in the footer). And you can still access page2 and 4 since jsf has bookmarkable urls now... – Kukeltje Jan 30 '15 at 09:22
  • Wow, BalusC commented on my post!!! I dont mind even of i cant bookmark my pages. But if I could achieve something like as described above, it could be wonderful. – Saju Jan 30 '15 at 09:23
  • Exactly. Please mark as dupe. And thanks for the answer there . :) – Saju Jan 30 '15 at 09:27

0 Answers0