Manipulating two doctypes at same time

X-Application Version: 3.1.1
Tamino Version : 3.1.1
Platform : Win2k
WebContainer : Tomcat 3.3a
JDK Version : 1.3.1_02


Hi all,

I need to create another document, as a log, when the user create a new document using the JSP environment.

The “log” document is in the same collection.

How can I do this?

Frederico

Hello Frederico,

you could try the following:

  • register the second schema in the web.xml configuration file (see documentation, chapter “Extended Tutorial Using Multiple Schemas”
  • use a document name for your “main” document (if not, current is implicitly used)
  • on the create page of the main document you need to create the second document using <bdm:directcommand type=“create” schema=“theLogSchema” document=“logDocument”/>.
  • in the commit action you need to include both documents in one transaction.
    Use <bdm:action type=“commit” form=“form1” document=“logDocument,mainDocument”>…link …</bdm:action>
  • you could use the JSP Logging facility (introduced with X-Application 3.1.2) to check on runtime for created documents, their document names, …

Check the

  • Documentation chapter “Working with Multiple Document Instances in one Application” => “Creating Multiple Documents” for the creation of multiple documents
  • Invoice example (xappdir/examples/jsp/invoice/modify.jsp) for the commit action of multiple documents

Tell me, if you don´t succeed (or if you succeed :wink: )

Regards, Harald

Thank you very much, Harald.
Everything is working fine.

Best regards,
Frederico

Hi again,

When I try to create a “log” document at same time delete a “main” document the “log” elements are stored empty.

There is a <bdm:directcommand type=“create” schema=“log” document=“documentoLog”/> in delete.jsp.

In create.jsp and modify.jsp everything is ok.

Frederico

Hi Frederico,

where do the values of the log document come from in case of create/modify?

If you create a document e.g. via directcommand the document is expected to be empty.
X-Application’s create command creates a new document and adds the mandatory structure of the document (== non optional elements) automatically .

If you need to copy some data from the main document to the log document I see some possiblities:
1. Use Javascript and 2 hidden fields
2. Use JSP Code and X-Application´s Java API
3. Encapsulate solution 2 in your own tag

If you need some hints on these solutions I could give more details.

Regards, Harald

Hi Harald,

I’m using possibilities 1 and 2 in create, modify and delete pages.
All of them are creating a new “log document”.

In create and modify everything is ok, but on delete the “log document” created is empty.

Any idea?
Frederico

Hi Frederico,

is it possible to post two jsp pages, e.g. modify.jsp and delete.jsp?
You could zip them together and attach the zip file to a post reply.

We could check, if we encounter any difference in the pages.

Regards, Harald

Here is.
multi.zip (3.38 KB)

Hello Frederico,

the form is not submitted in the delete page. That meands the data is not sent in the request.

I´ve attached a page delete.jsp that works within the /examples/jsp/invoice example. Just replace the existing delete.jsp.

I´ve tested it with X-Application 3.1.2 and the default value fix.

Changes done in this page:
31:
67: <a onMouseOut=“MM_nbGroup(‘out’);” ommit the href attribute

156-161: directcommand and edit fields.

Note: V3.1.2 checks that directcommand is placed inside a context tag. So you need to put the directcommand inside the form tag.

Please check the jsp tag reference documentation xapplication_312/documentation/XApplication/jspref.htm#jsp1act for more information on that.

Regards, Harald
delete.zip (1.83 KB)

Thank you very much, Harald.

That’s work fine.

Regards, Frederico