Manage tabs

Basically, there is ONE state for the page. But for tabs, you could give a state for each tab. You could display one tab wich display her content with READ state (all inputs are READ-ONLY) :

and another tab which display her content with CREATE state (all inputs are READ-WRITE).

This example use JSPTabControl, Taglib for manage Tabs. It's interesting to use this Taglib with FormView, because it can manage roles and states for each tab. You can find JSPTabControl here.

So with formView, you can manage state for particulary piece of your page. For tabs, piece of your page are tab. To indentify area which manage with state, you must use subFormId attribute of taglib formview:page.

JSP of this tabs looks like :

<jsptabcontrol:tabControl name="FORMVIEW_WITH_JSPTABCONTROL" ...>
  <jsptabcontrol:tabPage name="PROJECT_TABPAGE" ...>
    <formview:page subFormId="PROJECT_TABPAGE" >
  <jsptabcontrol:tabPage name="DEVELOPERS_TABPAGE" ...>
    <formview:page subFormId="DEVELOPERS_TABPAGE" >

In your action, you can save state and save formview by filling subFormId (PROJECT_TABPAGE), like this :

  // 1. Update State of tab page (with JSPTAbControl) => tabPage = PROJECT_TABPAGE
  WEBFormViewUtil.saveState(request, getServlet().getServletContext(), "READ", "PROJECT_TABPAGE");  

  // 2. Save form view of subFormId=PROJECT_TABPAGE
  WEBFormViewUtil.saveFormView(request, getServlet().getServletContext(), mapping.getPath(), "PROJECT_TABPAGE");