Products
About Guided Tour Requirements
Resources
Documents Configuration examples TagLib Reference Useful Links
Customer Support
Updates Contact Services
Sales
Licensing Sales FAQ Buy Online
 
 
 
buy online   |   about us   |   german version  

» 3. Provision of display data

Since our TabSetControl should switch between the tabs on the client-side, i.e. without the server, all the data must be loaded at the beginning. We use a Formbean for handing over to the JSP-Page. It provides the various tabs access to the display data.

import java.io.IOException;

import javax.servlet.ServletException;

import com.cc.framework.adapter.struts.ActionContext;
import com.cc.framework.adapter.struts.FWAction;
import com.cc.framework.adapter.struts.FormActionContext;
import com.cc.sampleapp.common.Messages;
import com.cc.sampleapp.common.User;
import com.cc.sampleapp.tabset.sample402.form.UserProfileEditForm;

public class UserProfileEditAction extends FWAction {

    /**
     * @see com.cc.framework.adapter.struts.FWAction#doExecute(ActionContext)
     */
    public void doExecute(ActionContext ctx)
        throws IOException, ServletException {

        try {
            // Generate a Default User for our Example
            User user = new User("FAS");
            user.load();

            initFormBean(ctx, user);
        }
        catch (Throwable t) {
            ctx.addGlobalError("Error while loading User Object", t);
            log.error("Error: ", t);
        }

        // Display the JSP
        ctx.forwardToInput();
    }

    /**
     * Initializ the Form with the User-Data
     * @param   ctx ActionContext
     * @param   user    User-Object
     * @exception   java.lang.Exception
     */
    private void initFormBean(ActionContext ctx, User user)
        throws Exception {
        UserProfileEditForm form = (UserProfileEditForm) ctx.form();

        form.setUserId( user.getUserId());
        form.setFirstName( user.getFirstName() );
        form.setLastName( user.getLastName() );
        form.setRole( user.getRole() );

        form.setGuitype( user.getSettings().getGuitype() );
        form.setDefprinter( user.getSettings().getDefprinter() );
    }
}

back   |   continue to step 4

Impressum | This product includes software developed by the Java Apache Project
Tours
ListControl TreeControl TreeListControl TabSetControl Form Tags MenuControl Print version Live Demo Configuration