Hi Sylvain

the following snippet is from the WizardAction in the cocoon XMLForm Sample

public Map perform (){

    // get the actual model which this Form encapsulates
    // and apply additional buziness logic to the model
    UserBean  jBean = (UserBean) getForm().getModel();
    jBean.incrementCount();
 
    if ( getCommand().equals( CMD_NEXT ) &&
      getForm().getViolations () != null )
    {
      // errors, back to the same page
      return page( getFormView() );
    }
    else{  
      getForm().clearViolations();   
      String command = getCommand();
     
      String formView = getFormView();

     
      if ( formView.equals ( VIEW_USERID ) ) {
        if ( command.equals( CMD_NEXT ) ){
          return page( VIEW_DEPLOYMENT );
        }
      }
      else if ( formView.equals ( VIEW_DEPLOYMENT ) ){
        if ( command.equals( CMD_NEXT ) ){
          return page( VIEW_SYSTEM );
        }
        else if( command.equals( CMD_PREV ) )
          return page( VIEW_USERID );
      }
      else if ( formView.equals ( VIEW_SYSTEM ) ){
        if ( command.equals( CMD_NEXT ) ){
          return page(  VIEW_CONFIRM );
        }
        else if( command.equals( CMD_PREV ) )
          return page( VIEW_DEPLOYMENT );
      }
      else if ( formView.equals ( VIEW_CONFIRM ) )
      {
        if ( command.equals( CMD_NEXT ) ){

----->     here u can call ur Businees method that insert this data into DB for e.g :
----->    call the method :
        submitData(jBean);
          Form.remove( getObjectModel(), getFormId() );
          return page( VIEW_END );
        }
        else if( command.equals( CMD_PREV ) )
          return page( VIEW_SYSTEM );
      }
    }
    return page( VIEW_START );

  }

------> so u can implement this method in the SAME Action

private void submitData(UserBean bean){        
        if u want for e.g input the user data into DB:
        String fName = bean.getFirstName();
        String lastName = bean.getLastName();
        String age = bean.getAge();  
        String email =  bean.getEmail(); 

        then now u have the data entered by the User
        so u can map or insert these data in whatever mapping tool u have and then this tool will do the rest as I think.   
        (In my case I use EJB here to insert these data into DB but In OJB  I don't know how it is implemented)         
    }

BTW: u can find this action code in the cocoon source distribution  in the pacjage :  org.apache.cocoon.samples.xmlform
I wish this clarify ur needs

Thanx
Mohamed

[EMAIL PROTECTED] wrote:
Thank you Mohamed.
 
I don't use EJB but I use an RDBMS-object mapping tool named OJB.
 
I haven't enough know-how in XMLForm to apply easily what you said.
Have you a short example to demonstrate it?
 
Thank you
Sylvain

-----Message d'origine-----
De: Mohamed El-Refaey [mailto:[EMAIL PROTECTED]]
Date: mercredi, 30. octobre 2002 00:51
À: [EMAIL PROTECTED]
Objet: Re: xmlform and build


Hallo Sylvain

nice, that this help u :) .

ofCourse it is easy to extend this sample to write data entered in the XMLForms into persistance storage[DB]....

for e.g :

 if u use EJB as a persistance layer  in ur project , u can easily in the Perform() method in ur Action after u get ur   model Bean: 
DataBean  jBean = (DataBean) getForm().getModel();

u can extract the entered data from this bean,  and sned it in any way[Collection data type or whatever u accept the user data] along with a VO(value-object) to be entered into DB by the aid of EJB Class that take this VO and perform the Insert query or whatever the command u need to do with DB

I think this is a breif answer but I wish it give u the way 

Thanx
Mohamed

[EMAIL PROTECTED] wrote:


Yes it will help me, thank you Mohamed.



Do you know how to extend this sample to write data you entered in persistence storage (database)?



Sylvain



-----Message d'origine-----

De: Mohamed El-Refaey [ mailto:[EMAIL PROTECTED]]

Date: mardi, 29. octobre 2002 22:13

À:  [EMAIL PROTECTED]

Objet: Re: xmlform and build





Hallo Sylvain



Yes, it is bossible to compile the new Java files and put them under the 

WEB-INF classes directory under cocoon and the ramaing files relating to 

schematron and XMLForms files and stylesheets put them as a common web 

application under cocoon samples or whatever u want.



I wish this will help



Mohamed



[EMAIL PROTECTED] wrote:



  

hello,



I'm trying to write my first XMLForm form and I follow the doc example (wizard howto).



In the last step (step 5) you have to (re)build the entire Cocoon app using the command build ... webapp to have a new cocoon.war.



Is it possible to compile only the new java files and add the .class directly in the Tomcat webapps directory (without using the .war). And when you want the up-to-date .war, you make the command jar .... ??



Thank you for your suggestions and experiences.

Sylvain Thevoz





---------------------------------------------------------------------

Please check that your question  has not already been answered in the

FAQ before posting.       <http://xml.apache.org/cocoon/faq/index.html> <http://xml.apache.org/cocoon/faq/index.html>



To unsubscribe, e-mail:       <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

For additional commands, e-mail:     <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]>





 



    









---------------------------------------------------------------------

Please check that your question  has not already been answered in the

FAQ before posting.       <http://xml.apache.org/cocoon/faq/index.html> <http://xml.apache.org/cocoon/faq/index.html>



To unsubscribe, e-mail:       <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

For additional commands, e-mail:     <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]>





---------------------------------------------------------------------

Please check that your question  has not already been answered in the

FAQ before posting.       <http://xml.apache.org/cocoon/faq/index.html> <http://xml.apache.org/cocoon/faq/index.html>



To unsubscribe, e-mail:       <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

For additional commands, e-mail:     <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]>





  




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>


  


Reply via email to