Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
05. Aug 2008, 01:57 CET | Link

Hi,

I would like to use beanshell script functionality in pageflows. Especially, to show the user the progress of his operation: Page 1 of 4, Page 2 of 4 and so forth.

I already successfully realized it with Seam 1.1.6 last year, but now (2.0.2.SP1) I got following errors/warnings:

The pageflow I used with Seam 1.1.6:

<pageflow-definition name="createEmployee">

<event type="process-start" >

<script>

<expression>

int total = 3;

int current = 1;

</expression>

<variable name="totalPages" mapped-name="total" access="write" />

<variable name="currentPage" mapped-name="current" access="write" />

</script>

</event>

<start-page name="createEmployee" view-id="/editEmployee.xhtml">

...

</start-page>

<page name="createUser" view-id="/editUser.xhtml">

<redirect />

<transition name="cancel" to="cancelled" />

<transition name="save" to="enterRoles">

<script>

<expression>current++;</expression>

<variable name="currentPage" mapped-name="current" access="read,write" />

</script>

</transition>

</page>

...

</pageflow-definition>

I accessed these variables in JSF like this:

<s:div rendered="#{pageflow.inProcess}" styleClass="dialog">

Page #{pageflow.processInstance.contextInstance.variables['currentPage']} of #{pageflow.processInstance.contextInstance.variables['totalPages']}

</s:div>

If I reuse the pageflow in Seam 2.0.2.SP1 I got following error:

Caused by: org.jbpm.jpdl.JpdlException: [[ERROR] line 11: cvc-complex-type.2.4.a: Invalid content was found starting with element 'script'. One of '{"http://jboss.com/products/seam/pageflow":action}' is expected., [ERROR] line 31: cvc-complex-type.2.4.a: Invalid content was found starting with element 'script'. One of '{"http://jboss.com/products/seam/pageflow":condition, "http://jboss.com/products/seam/pageflow":action, "http://jboss.com/products/seam/pageflow":exception-handler}' is expected., [ERROR] line 48: cvc-complex-type.2.4.a: Invalid content was found starting with element 'script'. One of '{"http://jboss.com/products/seam/pageflow":action, "http://jboss.com/products/seam/pageflow":exception-handler}' is expected.]

Then I changed the script blocks in the pageflow by surrounding them with <action> blocks:

<event type="process-start">

<action>

<script>

<expression>

int total = 2;

int current = 1;

</expression>

<variable name="totalPages" mapped-name="total" access="write" />

<variable name="currentPage" mapped-name="current" access="write" />

</script>

</action>

</event>

In this case I receive the following warning:

01:50:27,625 WARN [JpdlXmlReader] process xml warning: action does not have class nor ref-name attribute <action xmlns="http://jboss.com/products/seam/pageflow" config-type="field" accept-propagated-events="true">

With this warning the script variables are not accessible in my JSF.

Do you know what I am doing wrong or what I have to change to make it work like with Seam 1.1.6?

Many thanks in advance, Manuel

1 Reply:
05. Aug 2008, 10:01 CET | Link

The jBPM docs provide the following example (see here):

<process-definition>
  <event type="process-end">
    <script>
      <expression>
        a = b + c;
      </expression>
      <variable name='XXX' access='write' mapped-name='a' />
      <variable name='YYY' access='read' mapped-name='b' />
      <variable name='ZZZ' access='read' mapped-name='c' />
    </script>
  </event>
  ...
</process-definition>

So, an <action> tag surrounding the <script> block is not required.

Could it be that the Seam pageflow DTD is somehow "incomplete"?

Meaning, that jBPM would support the XML construct mentioned above, but the pageflow DTD misses the <script> element...