[jboss-user] [JBoss Seam] - Re: Ajax and Pageflow very slow
pietermartin
do-not-reply at jboss.com
Wed Nov 28 07:20:40 EST 2007
Here is is my components.xml
| <bpm:jbpm>
| <bpm:process-definitions>
| </bpm:process-definitions>
| <bpm:pageflow-definitions>
| <value>signUpCustomer.jpdl.xml</value>
| </bpm:pageflow-definitions>
| </bpm:jbpm>
|
I start the pagefloe from capturePhoneDetails.page.xml with
<begin-conversation join="true" pageflow="signupCustomer"/>
here is the pageflow
| <?xml version="1.0"?>
|
| <pageflow-definition xmlns="http://jboss.com/products/seam/pageflow"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-2.0.xsd"
| name="signupCustomer">
|
| <start-page name="capturePhoneDetails" view-id="/signyouup/capturePhoneDetails.xhtml">
| <transition name="next" to="captureContactDetails">
| <action
| expression="#{webCustomerAction.moveTokenToCreateContact}" />
| </transition>
| </start-page>
| <page name="captureContactDetails" view-id="/signyouup/captureContactDetails.xhtml" no-conversation-view-id="/home.xhtml">
| <transition name="back" to="capturePhoneDetails">
| <action expression="#{webCustomerAction.moveTokenToChoosePhone}" />
| </transition>
| <transition name="next" to="captureContactSuccessful">
| <action expression="#{webCustomerAction.persistContact}" />
| <exception-handler exception-class="org.jbpm.JbpmException">
| <action expression="#{webCustomerAction.handleException}" />
| </exception-handler>
| </transition>
| </page>
| <decision name="captureContactSuccessful" expression="#{webCustomerAction.success}">
| <transition name="true" to="creditCheck"></transition>
| <transition name="false" to="failure"></transition>
| </decision>
| <page name="creditCheck" view-id="/signyouup/creditCheck.xhtml" no-conversation-view-id="/home.xhtml">
| <transition name="next" to="creditCheckSuccessful">
| <action expression="#{webCustomerAction.doCreateAccount}" />
| <action expression="#{webCustomerAction.doCreditCheck}" />
| <exception-handler exception-class="org.jbpm.JbpmException">
| <action expression="#{webCustomerAction.handleException}" />
| </exception-handler>
| </transition>
| </page>
| <decision name="creditCheckSuccessful" expression="#{webCustomerAction.success}">
| <transition name="false" to="failure"></transition>
| <transition name="true" to="capturePaymentDetails"></transition>
| </decision>
| <page name="capturePaymentDetails" view-id="/signyouup/capturePayment.xhtml" no-conversation-view-id="/home.xhtml">
| <redirect />
| <transition name="next" to="captureDeliveryDetails">
| <action expression="#{webCustomerAction.moveTokenToCaptureDeliveryDetails}" />
| </transition>
| </page>
| <page name="captureDeliveryDetails" view-id="/signyouup/captureDeliveryDetails.xhtml" no-conversation-view-id="/home.xhtml">
| <transition name="next" to="confirmTakePayment">
| <action expression="#{webCustomerAction.moveTokenToTakePayment}" />
| </transition>
| <transition name="back" to="capturePaymentDetails">
| <action expression="#{webCustomerAction.moveTokenToCaptureBankDetails}" />
| </transition>
| </page>
| <page name="confirmTakePayment" view-id="/signyouup/confirmTakePayment.xhtml" no-conversation-view-id="/home.xhtml">
| <transition name="next" to="salesOrderSuccessful">
| <action expression="#{webCustomerAction.doSalesOrder}" />
| <exception-handler exception-class="org.jbpm.JbpmException">
| <action expression="#{webCustomerAction.handleException}" />
| </exception-handler>
| </transition>
| <transition name="back" to="captureDeliveryDetails">
| <action expression="#{webCustomerAction.moveTokenToCaptureDeliveryDetails}" />
| </transition>
| </page>
| <decision name="salesOrderSuccessful" expression="#{webCustomerAction.success}">
| <transition name="false" to="failure"></transition>
| <transition name="true" to="success"></transition>
| </decision>
| <page name="success" view-id="/signyouup/success.xhtml" no-conversation-view-id="/home.xhtml">
| <end-conversation />
| <transition name="toBeginning" to="capturePhoneDetails" />
| </page>
| <page name="failure" view-id="/error.xhtml">
| <end-conversation />
| </page>
| </pageflow-definition>
|
Here is my backing bean
| package com.yannitech.virgin.selfcare.customer.manager;
|
| import java.text.SimpleDateFormat;
| import java.util.Date;
|
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Factory;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.faces.FacesMessages;
| import org.jboss.seam.log.Log;
| import org.jbpm.graph.action.SeamedAction;
| import org.jbpm.graph.exe.ExecutionContext;
|
| import com.yannitech.virgin.selfcare.common.enums.Contact_TypeEnum;
| import com.yannitech.virgin.selfcare.customer.entity.Contact;
|
| @Name("webCustomerAction")
| @Scope(ScopeType.CONVERSATION)
| public class WebCustomerAction extends SeamedAction {
|
| @Logger
| private Log log;
|
| @In
| private FacesMessages facesMessages;
|
| @In(create=true)
| private ContactManager contactManager;
|
| @In(create=true)
| @Out
| private Contact newContact;
|
| private boolean success = Boolean.TRUE;
|
| // @CreateProcess(definition="SignUpCustomerBP", processKey="syu#{syuProcessKey}")
| public void startBusinessProcess() {
| log.info("startBusinessProcess SignUpCustomerBP");
| }
|
| // @Transition("toCreateContact")
| public void moveTokenToCreateContact() {
| log.info("moveTokenToCreateContact");
| }
|
| // @Transition("toChoosePhone")
| public void moveTokenToChoosePhone() {
|
| }
|
| // @Transition("toFailure")
| public void moveTokenToFailure() {
|
| }
|
| public void persistContact() {
| log.info("persistContact");
| newContact.setType(Contact_TypeEnum.CONSUMER);
| // contactManager.persist(newContact);
| // BusinessProcess.instance().transition("toCreateAccount");
| }
|
| public void doCreateAccount() {
| log.info("doCreateAccount");
| // BusinessProcess.instance().transition("toCreditCheckContact");
| }
|
| public void doCreditCheck() {
| log.info("doCreditCheck");
| // BusinessProcess.instance().transition("toCaptureBankDetails");
| }
|
| public void moveTokenToCaptureDeliveryDetails() {
| log.info("moveTokenToCaptureDeliveryDetails");
| // BusinessProcess.instance().transition("toCaptureDelivery");
| }
|
| // @Transition("toCaptureBankDetails")
| public void moveTokenToCaptureBankDetails() {
| log.info("moveTokenToCaptureBankDetails");
| }
|
| // @Transition("toTakePayment")
| public void moveTokenToTakePayment() {
| log.info("moveTokenToTakePayment");
| }
|
| public void doSalesOrder() {
| log.info("doSalesOrder");
| // BusinessProcess.instance().transition("toComplete");
| }
|
| public Contact getNewContact() {
| return newContact;
| }
|
| public void setNewContact(Contact newContact) {
| this.newContact = newContact;
| }
|
| @Factory(value="syuProcessKey",scope=ScopeType.EVENT)
| public String getProcessKey() {
| SimpleDateFormat sdf = new SimpleDateFormat();
| return sdf.format(new Date());
| }
|
| public void handleException() {
| ExecutionContext executionContext = ExecutionContext.currentExecutionContext();
| facesMessages.add(executionContext.getException().getCause().getMessage());
| success=false;
| // BusinessProcess.instance().transition("toFailure");
| }
|
| public boolean isSuccess() {
| return success;
| }
|
| public void setSuccess(boolean success) {
| this.success = success;
| }
|
| }
|
my jsf page
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| xmlns:a="https://ajax4jsf.dev.java.net/ajax"
| template="../layout/template.xhtml">
|
| <ui:define name="body">
| <h:messages globalOnly="true" styleClass="message" />
| <h:form>
| <a:outputPanel id="phoneOutput">
| <s:decorate id="phoneMakeDecorate" template="../layout/edit.xhtml">
| <ui:define name="label">Phone Make:</ui:define>
| <h:selectOneMenu value="#{selectedPhoneMake}" converter="#{phoneManager.phoneMakeConverter}">
| <s:selectItems value="#{phoneMakes}" var="phoneMake"
| label="#{phoneMake.name}" noSelectionLabel="Please select" />
| <a:support event="onchange"
| actionListener="#{phoneManager.findWebPhoneModelsForMake}"
| reRender="phoneOutput" requestDelay="500" />
| </h:selectOneMenu>
| </s:decorate>
| <s:decorate id="phoneModelDecorate" template="../layout/edit.xhtml">
| <ui:define name="label">Phone Model:</ui:define>
| <h:selectOneMenu value="#{selectedPhoneSalesChannel}" converter="#{phoneManager.phoneConverter}">
| <s:selectItems value="#{phoneSalesChannels}" var="phoneSalesChannel"
| label="#{phoneSalesChannel.phone.phoneModel.name} #{phoneSalesChannel.phone.pack}"
| noSelectionLabel="Please select" />
| <a:support event="onchange"
| actionListener="#{phoneManager.selectPhoneSalesChannel}"
| reRender="phoneOutput" requestDelay="500" />
| </h:selectOneMenu>
| </s:decorate>
| <s:decorate id="phonePriceDecorate" template="../layout/display.xhtml">
| <ui:define name="label">Price:</ui:define>
| <h:outputText value="#{selectedPhoneSalesChannel.price}" />
| </s:decorate>
| <s:graphicImage rendered="#{picture ne null}" value="#{picture}">
| <s:transformImageSize width="200" maintainRatio="true" />
| </s:graphicImage>
| </a:outputPanel>
| <s:decorate id="installmentTermDecorate" template="../layout/edit.xhtml">
| <ui:define name="label">Installment Term:</ui:define>
| <h:selectOneMenu value="#{webSalesOrderManager.webProductOrderIssue.vm_Installment_TermEnum}">
| <s:selectItems value="#{vmInstallment_TermEnums}" var="installment" label="#{installment.name}" noSelectionLabel="Please select" />
| <s:convertEnum />
| <a:support event="onblur" reRender="installmentTermDecorate" requestDelay="500" />
| </h:selectOneMenu>
| </s:decorate>
| <s:decorate id="ratePlanDecorate" template="../layout/edit.xhtml">
| <ui:define name="label">Rate Plan:</ui:define>
| <h:selectOneMenu value="#{webSalesOrderManager.webProductOrderIssue.ratePlan}">
| <s:selectItems value="#{ratePlans}" var="ratePlan" label="#{ratePlan.name}" noSelectionLabel="Please select" />
| <s:convertEntity />
| <a:support event="onblur" reRender="ratePlanDecorate" requestDelay="500" />
| </h:selectOneMenu>
| </s:decorate>
| <s:decorate id="upfrontAmountDecorate1" template="../layout/edit.xhtml">
| <ui:define name="label">Upfront Amount:</ui:define>
| <h:inputText id="upfrontAmountId1" value="#{webSalesOrderManager.webProductOrderIssue.upfrontAmount}">
| <a:support event="onblur" reRender="upfrontAmountDecorate1" requestDelay="500" />
| </h:inputText>
| </s:decorate>
| <s:decorate id="upfrontAmountDecorate" template="../layout/edit.xhtml">
| <ui:define name="label">Upfront Amount:</ui:define>
| <h:inputText id="upfrontAmountId" value="#{webSalesOrderManager.webProductOrderIssue.upfrontAmount}">
| <a:support event="onblur" reRender="upfrontAmountDecorate" requestDelay="500" />
| </h:inputText>
| </s:decorate>
| <h:commandButton id="next" value="Next" action="next" />
| </h:form>
| </ui:define>
| </ui:composition>
|
I have removed all busines process stuff. The behavior is the same with or without the business process code.
The slowness is on any of the jsf elements with an ajax onblur event.
I changed the dvd example app to use some ajax and I see the same behavior there.
It is a lot faster though probably due to the db being in memory hypersonic whereas I am using mysql in my app.
Cheers
Pieter
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108426#4108426
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108426
More information about the jboss-user
mailing list