I have a <rich:tabPanel/> and <rich:tab/> that display just fine, but the content inside the tab, i.e., the <a4j:include/> content, doesn't display anything at all. It displays completely empty. Note I'm using switchtype="ajax". Is the default selected tab when switchtype="ajax" supposed to automatically load when the page loads, or must the default tab be switchtype="client"?
Here's my code:
/*** tabs.jsp ***/ <f:subview id="tabs"> <h:form id="hdr"> <rich:tabPanel switchType="ajax"> <rich:tab label="Home"> Hi there </rich:tab> <rich:tab label="Shopping cart"> <a4j:include id="tab-content" viewId="/home.jsp"/> </rich:tab> </rich:tabPanel> </h:form> </f:subview>
I am doing the same as what you're doing. You can look at here http://jboss.com/index.html?module=bb&op=viewtopic&t=104970
I use facelets, so my view is clearer to see (IMHO). Could you try your application with the code I just fixed? I don't know the meaning of putting reRender, action and actionListener is the rich:tab tag, so I take them away.
Thanks, I will try that shortly. Based on your code, it looks like I'm using <rich:tabPanel/> and <rich:tab/> incorrectly. I thought for switchType="ajax", one must specify reRender="id" where id is the id of the <a4j:tabPanel/> whose content is updated each time a tab is clicked.
I couldn't find any examples showing how to use <rich:tabPanel/> and <rich:tab/> with switchType="ajax" except http://livedemo.exadel.com/richfaces-demo/richfaces/tabPanel.jsf. Unfortunately, that example uses hard-coded content--not <a4j:include/>. The http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone/docs/devguide/DeveloperGuide.html#tab also uses hard-coded content.
I'll post my results tomorrow. Thanks for the suggestion!
Wow, that posted wrong. I didn't realize this forum doesn't understand BBCode.
seems to me, your post is formatted Ok.
switchType="ajax" means that only one (active) tab is rendered. When user clicks another tab, one tab content is replaced with other tab content in Ajax mode (i.e. the page is updated partially). You do not have to set something extra. However, you can use reRender attribute if you want to re-render something in addition when tabs are switched.
My post is formatted OK, but a lot of the content is missing. This happened in my first post (on the ajax4jsf forum). I didn't understand exactly why, but now I do: this forum doesn't interpret BBCode... and editing of posts is disabled, so I can't go back and fix it up.
I was trying to say that all the examples show tabs with static (hard-coded) content. There aren't any examples which use dynamic content; i.e, <a4j:include/>.
It wasn't until I saw dxxvi's example above that I even realized <a4j:include/> must be a child of each <rich:tab/> with dynamic content. I thought I should use one <a4j:include/> outside <rich:tabPanel/> to be shared by all tabs. This makes more sense to me since only one tab is displayed at a time.
Anyway, thanks for the help!
If you need to apply this include to every tab - you must place it inside every tab. Every Tab must be defined with some nested content. And then switches between the tabs using headers.
I didn't noticed major problems while using a4j:include inside the tabs.
OK, I've changed the code to make it really simple, but I don't understand what's happening:
/*** tabs.jsp ***/ <f:subview id="tabs"> <h:form id="hdr"> <rich:tabPanel switchType="ajax"> <rich:tab label="Home"> <a4j:include id="tab-content" viewId="/home.jsp"/> </rich:tab> <rich:tab label="Studies"> <a4j:include id="tab-content2" viewId="/home.jsp"/> </rich:tab> </rich:tabPanel> </h:form> </f:subview> /*** home.jsp ***/ <f:subview id="homeView"> <h:form id="homeForm"> <f:verbatim><h3>hello</h3></f:verbatim> </h:form> </f:subview>
In other words, I have tabs which should display the exact same thing except for the labels. Here are screenshots:
Initial view ("Home" tab):
http://img340.imageshack.us/img340/453/capture3272007104218amho1.png Where's the a4j:include content?? Why is the screen blank?
After clicking "Studies" tab: http://img108.imageshack.us/img108/9555/capture3272007104232amgu4.png Where's the a4j:include content?? Why is the screen blank?
After clicking back to the "Home" tab: http://img479.imageshack.us/img479/152/capture3272007104240amsi9.png What happened to the tabs??
Thanks for any advice,
I added the issue http://jira.jboss.com/jira/browse/RF-38 yesterday. Where were couple other threads that pointed to the similar problem with tabPanel and a4j:include
P.S. Thank you for bumping up anyway. Your post is granted to be referenced from the jira issue also.
I couldn't reproduce the issue. I've attached screen capture to JIRA. Tested on trunk A4J & RF versions. Is the issue still reproducible?
Is the problem still actual?