You should use two different request-map entries pointing at the same view:

  <request-map uri="CreatePersonForm">
      <security https="true" auth="true"/>
      <response name="success" type="view" value="createPerson"/>
  </request-map>


used when you visit the page; and:

  <request-map uri="createPerson">
      <security https="true" auth="true"/>
      <event type="service" invoke="createPerson"/>
      <response name="success" type="view" value="createPerson"/>
  </request-map>



used when you post data

Jacopo

On Feb 10, 2009, at 9:51 PM, Roel Veldhuizen wrote:

I've added the IN parameters but still I get the error. I think I know
what happens but don't know how to fix it.

I get the error on the moment I enter the page. When I fill the
firstname en lastname field and press submit the error disappears and
the person is added to the database. So, I think that the service is
also called on the moment I enter the page.

Could my analyses be right? And how can I fix it?




2009/2/10 Divesh Dutta <[email protected]>:
Hello Roel,
In Your Service Definition you have not defined the in Parameters.
Also In controller entry you dont need to make enrty for Handlers and
Pre-processors as you have included common-controller and this entries are already their. Please see my amendment inline. Also write code for creating Party first and then go for creating Person.Also see example component for
reference as suggested by Pranay.
-Divesh

Hereby, the service and the controller

Service:
  <service name="createPerson" default-entity-name="Person"
engine="entity-auto" invoke="create" auth="true">
      <description>Create a Person</description>
  </service>


<attribute type="String" mode="IN" name="firstName" optional="false"/>
<attribute type="String" mode="IN" name="lastName" optional="false"/>

Controller:
<?xml version="1.0" encoding="UTF-8" ?>

<site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/site-conf.xsd ">

      <include
location="component://common/webcommon/WEB-INF/common- controller.xml"/>

  <description>CRM Configuration File</description>
  <owner>Open For Business Project (c) 2005 </owner>
  <errorpage>/error/error.jsp</errorpage>

  <handler name="java" type="request"
class="org.ofbiz.webapp.event.JavaEventHandler"/>
  <handler name="soap" type="request"
class="org.ofbiz.webapp.event.SOAPEventHandler"/>
  <handler name="service" type="request"
class="org.ofbiz.webapp.event.ServiceEventHandler"/>
  <handler name="service-multi" type="request"
class="org.ofbiz.webapp.event.ServiceMultiEventHandler"/>
  <handler name="simple" type="request"
class="org.ofbiz.webapp.event.SimpleEventHandler"/>

  <handler name="ftl" type="view"
class="org.ofbiz.webapp.ftl.FreeMarkerViewHandler"/>
  <handler name="jsp" type="view"
class="org.ofbiz.webapp.view.JspViewHandler"/>
  <handler name="screen" type="view"
class="org.ofbiz.widget.screen.ScreenWidgetViewHandler"/>

  <handler name="http" type="view"
class="org.ofbiz.webapp.view.HttpViewHandler"/>

  <preprocessor>
<!-- Events to run on every request before security (chains exempt)
-->
      <!-- <event type="java"
path="org.ofbiz.webapp.event.TestEvent" invoke="test"/> -->
      <event type="java"
path="org.ofbiz.securityext.login.LoginEvents"
invoke="checkExternalLoginKey"/>
  </preprocessor>
  <postprocessor>
      <!-- Events to run on every request after all other processing
(chains exempt) -->
      <!-- <event type="java"
path="org.ofbiz.webapp.event.TestEvent" invoke="test"/> -->
  </postprocessor>


  <!-- Request Mappings -->

  <!-- normal mappings -->
  <request-map uri="main">
      <security https="true" auth="true"/>
      <response name="success" type="view" value="main"/>
      <response name="error" type="view" value="main"/>
  </request-map>

  <request-map uri="person">
     <security https="true" auth="true"/>
     <response name="success" type="view" value="person"/>
     <response name="error" type="view" value="main"/>
  </request-map>

  <request-map uri="createPerson">
      <security https="true" auth="true"/>
      <event type="service" invoke="createPerson"/>
      <response name="success" type="view" value="createPerson"/>

  </request-map>

 <!-- end of request mappings -->

 <!-- View Mappings -->

 <view-map name="main" type="screen"
page="component://crm/widget/CrmScreens.xml#main"/>
 <view-map name="person" type="screen"
page="component://crm/widget/CrmScreens.xml#person"/>
 <view-map name="createPerson" type="screen"
page="component://crm/widget/CrmScreens.xml#createPerson"/>
 <!-- end of view mappings -->

</site-conf>

2009/2/9 Divesh Dutta <[email protected]>:


Could you please post the code snippet of service which you are using?

Divesh


Could you please post the controller.xml entries?

Jacopo

On Feb 9, 2009, at 11:59 AM, Roel Veldhuizen wrote:



I made a form to add a basic person ( firstname, lastname). But
(Although the main functionality of the form works, it's adding a
person) the following errors occur:

The Following Errors Occurred:
The following required parameter is missing: [IN]
[createPerson.firstName]
The following required parameter is missing: [IN]
[createPerson.lastName]

Why do they occur?

Form:
<form name="createPerson" type="single" target="createPerson">
    <field name="firstName"><text/></field>
    <field name="lastName"><text/></field>
    <field name="submit"><submit/></field>
</form>

Widget:
<screen name="createPerson">
    <section>
        <widgets>
            <decorator-screen name="main-decorator"
location="${parameters.mainDecoratorLocation}">
                <decorator-section name="body">
                    <include-form name="createPerson"
location="component://crm/widget/CrmForms.xml"/>
                </decorator-section>
            </decorator-screen>
        </widgets>
    </section>
</screen>

Thanks in advance,

Roel Veldhuizen






Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to