help needed on Integrating a Child Document with its parent

X-Application Version: 3.1.3, 3.1.2, 3.1.1
Tamino Version : 3.1.1
Platform : NT, Win2k, Solaris, …
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

Dear Moderator
i here with attached the .Zip consists of 4 files
rim.tsd is called as parent schema and it has a doctype called RegistryObjectList and organizationdev1.tsd has a doctype called Organization .create.jsp is the xapplication generated program and create1.jsp is a customized program done by myself

when i run the file create1.jsp i got a error like
java.lang.NullPointerException
at com.softwareag.xtools.xapplication.jsp.taglib.ElementActionTag.processAction(ElementActionTag.java:78)
at com.softwareag.xtools.xapplication.jsp.taglib.CommandTag.doAfterBodyCore(CommandTag.java:122)
at com.softwareag.xtools.xapplication.jsp.JspTag.doAfterBody(JspTag.java:188)
at create1_6._jspService(create1_6.java:1149)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:479)

can u help me on this asap
thanks in advance
query051102.zip (10 KB)

Hello,

for the generated page, the create.jsp cannot be invoked directly.
As I have seen, you have detected this problem and added an if - tag with directcommand

<xapp:if condition="notexist" select="/RegistryObjectList">
    <xapp:directcommand type="create" schema="RegistryObjectList" />
</xapp:if>
</pre><BR><BR>You have comments around this tags. However, be aware that the tags are executed. If you want to suppres their evaluation use<BR><BR><pre class="ip-ubbcode-code-pre">
<%--
<xapp:if condition="notexist" select="/RegistryObjectList">
    <xapp:directcommand type="create" schema="RegistryObjectList" />
</xapp:if>
--%>



My questions:

(1) Did you get the exception also when working with the generated application?

- invoking the search.jsp
- clicking to the link ‘create’

(2) If (1) works and you add the if tag with directcommand, is it possible to invoke the create.jsp directly?

(3) If (2) works where are the differences between
your create1.jsp and the modified create.jsp of (2)?

Thank you,
Bye Christian.

(1) Did you get the exception also when working with the generated application?

- invoking the search.jsp
- clicking to the link ‘create’

Ans: when i run the generated application from the search and click the create it throws error like

java.lang.VerifyError: (class: create_1, method: _jspService signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V) Illegal target of jump or branch
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:232)
at org.apache.tomcat.facade.ServletHandler.getServlet(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.preInit(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.init(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:479)



(2) If (1) works and you add the if tag with directcommand, is it possible to invoke the create.jsp directly?
Ans: nop

(3) If (2) works where are the differences between
your create1.jsp and the modified create.jsp of (2)?

Ans: the reason why i need to comeup with the create1.jsp pls refer to fig
the rootnode is RegistryObjectList(ROL) but however i am not going to generate the pages for ROL but for its child Organization(Doctype).
pls refer the two schemas rim.tsd and organizationdev1.tsd

after generating the pages i will replace the rootnode from Organization to
its relative parent ROL pls compare the create.jsp and create1.jsp
(i.e) replacing the xpath for each and every element in Organization doctype to ROL doctype “/Organization/@accessControlPolicy” to “/RegistryObjectList/Organization/@accessControlPolicy

i would like to know is it feasible to in this way

when i run create1.jsp i got the error like

In a browser -
java.lang.NullPointerException
at com.softwareag.xtools.xapplication.jsp.taglib.ElementActionTag.processAction(ElementActionTag.java:78)
at com.softwareag.xtools.xapplication.jsp.taglib.CommandTag.doAfterBodyCore(CommandTag.java:122)
at com.softwareag.xtools.xapplication.jsp.JspTag.doAfterBody(JspTag.java:188)
at create1_12._jspService(create1_12.java:1019)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:479)

In a Tomcat Dos window warning like

Warning (LoopTag): A loop for sub-nodes of a non-existing field which might be o
ptional in readonly state has to be created.
If the path ‘/RegistryObjectList/xapp:seq()/xapp:chc(1)/xapp:child(10)/N
ame’ is correct and contains an optional field, you can ignore this warning.

Hello,

the reason for the error of the generated application is the number of jsp tags within the page. Unfortunately, Tomcat creates a single big method containing all the code to create the page. If this method contains to many lines of code, the Java “jumps” are invalid.

I tried out your example and had the same effect. The generator produces a structure.xml file. You can use a text editor and remove sub-elements from the tag of this file. I did this and created a new create.jsp with the regenerate option of the generator. This page could be compiled by Tomcat.

Nevertheless, I got another error. It seams to be a BUG for loops whose selected node is an optional node.

For example, the node ‘Name’ within the ‘Organization’ contains a loop for ‘LocalizedString’, but the ‘Name’ node is optional and there is no check if the node exists.

The general idea to generate the pages for the ‘Organization’ node and to modify them for ‘ROL’ should be ok.

You should provide an assurance that the ROL contains a ‘Organization’ node. For this, you could use if tag whithin a loop.

I will send a new post when I find out a workaround for your problem.

Bye,
Christian.

Hello
my program create2.jsp is working insert the record into Organization subtree but not the subtree’s like Name,Description,TelephoneNumber
pls find it out
thanks
create2.jsp (17.8 KB)

Hello,
In my Previous Post i am able to create child for ROL but not the child of Organization like Name,Description,Slot,Classification,ExternalIdentifier …Can u help me on this asap,because without this i am not able to proceed.

Hello,

what I found out is that the generator produces wrong pathes for optional node and you have a lot of optional node within your schema.

You will find an attached file where I adapted manually the create tag of the generated structure file. Some of the elements are disabled to make the resulting create.jsp smaller.

You can use this structure file to create the create.jsp. However, the create.jsp is attached also (see zip file). Since other pages (view, modify, delete) will have the same problem as the create.jsp, you could modify the corresponding tag entries in the structure.xml in the same way and regenerate the page.

For regeneration, just copy the new structure.xml into the webapps directory of your generated application. Start the generator, enter the directory of the structure.xml file, click the option ‘regenerate’ and start the generation.

Now, I will have a look at your second page and send the next post when I find you what the problem is and how to solve it.

Bye,
Christian.
adaptedCreate.zip (5.99 KB)

Hello,

I send you two pages and the structure files that I used to generate them. The first one ?create.jsp? is the page that creates a document of doctype RegistryListObject. The page was generated from structure_rim.xml. Within this file, I disabled fields and modified some names within the tag to make them better readable, e.g. the list to iterate the ROL Entries.

The page ?create.jsp? contains the functionality to add new nodes into the ROL Entry list. RegistryListObject is defined as a list of alternatives. By default the type of a new node is the first alternative. It is possible to switch the type of this node. If it?s an Organization, you can edit the values of the attributes of the Organization. At this place, I added a link referring to a sub-page ?editOrganization.jsp?.

        <xapp:elementaction type="select" base="ROL-Entries" form="form1">
          <a href="javascript:document.forms['form1'].action='editOrganization.jsp';document.forms['form1'].submit();">edit the organization entry</a>
        </xapp:elementaction>



The sub-page allows you to modify the Organization node. It was originally generated from structure_org.xml. The changes I made within the structure file:
(1) I corrected the paths for nodes
(2) I added missing loops
The resulting JSP ?create.jsp? was copied to the ROL application with the new name ?editOrganization.jsp?.

Within the generated page I made the following adaptation for it works as a sub-page
(1) I added a base attribute to the enclosing xapp:form tag
(2) I replaced absolute paths ?/Organization? b relative paths ?Organization?
(3) I replaced the reference to ?create.jsp? by ?editOrganization.jsp?.
(4) I replaced the commit action by a link action.

The pages are attached via zip file. You can extract them and try out by invoking the create.jsp directly. I added a check for an existing document.

This is a slightly other approach than yours. I did not check your JSP, for the incorrect paths of the loops. Can you live with the pages I send you?

Bye,
Christian.

PS: the structure file of my last post contains an error: paths for attributes of LocalizedString like ./@lang must be LocalizedString/@lang. It is corrected in structure_org.xml.
subpageCreate-2002-11-08.zip (70.3 KB)

HI Christian

after testing the codes that u send to me
when i run create.jsp i comeup with the error like

XException: id = 999
java.lang.NullPointerException
at com.softwareag.xtools.xapplication.jsp.taglib.ElementActionTag.processAction(ElementActionTag.java:78)
at com.softwareag.xtools.xapplication.jsp.taglib.CommandTag.doAfterBodyCore(CommandTag.java:122)
at com.softwareag.xtools.xapplication.jsp.JspTag.doAfterBody(JspTag.java:188)
at create_1._jspService(create_1.java:956)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:479)

so i would like to know whether the schema that i have and u have is it the same.
-------------------
another query is as like ur move
i have come up with the JSP called create3.jsp for ROL\Organization and create2.jsp for ROL\Organization\Classification when i run create3.jsp i got a error like
XException: id = 999
com.softwareag.xtools.xapplication.common.PreconditionViolation
the node ‘/RegistryObjectList/Organization’ does not contain a sub-node identified by the content ‘Classification’
at com.softwareag.xtools.xapplication.businessdocument.BusinessNodeImpl.iterate(BusinessNodeImpl.java:798)
at com.softwareag.xtools.xapplication.jsp.taglib.LoopTag.getIterationNode(LoopTag.java:513)
at com.softwareag.xtools.xapplication.jsp.taglib.LoopTag.createNewPage(LoopTag.java:439)
at com.softwareag.xtools.xapplication.jsp.taglib.LoopTag.doStartTagCore(LoopTag.java:185)
at com.softwareag.xtools.xapplication.jsp.JspTag.doStartTag(JspTag.java:142)
at create3_49._jspService(create3_49.java:1395)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:479)
if i change the schema, Classification occurence in organization to minoccur 1 and Maxoccur 1 and remove the loop tag,element action tag from create3.jsp it could work well to insert into the Schema
However the loop for TelephoneNumber can work well
query141102.zip (3.94 KB)

Hello,

I use the schema you sent with the first post. The NullPointerException is strange, since the pages are running on my machine.


For your problem with the Classification node use

<xapp:loop select="/RegistryObjectList/Organization/xapp:seq(1)/xapp:occ(1)/xapp:seq(1)" ...>
  ...
</xapp:loop>



It is necessary because the content model of organization has to nested loops:
(a) the optional sequence is a loop (0…1)
(b) the Classification is also within a loop (0…unbounded).
This is the reason because Classification is not detected within the schema.


If you select a node for this classifications list. The node registered by

“/RegistryObjectList/Organization/Classification”

because this is the name of the loop.

Therefore, the base of the xapp:form tag within create2.jsp must use this name. the attribute base is NO X-PATH expression. It is a name which has to be defined by a loop.

Furthermore, the paths within create2.jsp must be relative. Just remove “/Classification” by “Classification” or “.”.

These are the two things I found out when I looked at your JSPs but I did not invoke them.

Bye,
Christian.

Hi Christian
i come up with two jsps called create4.jsp for creating Organization Entry , as you know very well from our schema Organization has Classification child with 0 - unbound occurences. but when i would like to enter the data for the Classification record in a loop, i feel its better to call a separate jsp called searchClassificationScheme.jsp to search and select the respective value and bring it back to create4.jsp.
For this i have tried using javascript but i am not able to succeed bcoz the html generated by create4.jsp does not have html element but xhtml element
eg:-
if javascript cannot be used for this functionality can i use the jsp taglib by creating plugins.if it can be done in taglib can you help as on this by some sample codes.also from which class i have to inherit my plugin class .
query211102.zip (3.62 KB)

Hello,

When I understand you right, you want to edit the attribute /RegistryObjectList/Organization/Classification/@classificationScheme. This attribute is a reference to another document of doctype ClassificationScheme. The key value for this reference is /ClassificationScheme/Name/LocalizedString/@value.

If you want to offer a selection of existing values, I would propose the use of a ?xapp:select? tag within your page create4.jsp:

<xapp:edit select=?@classificationScheme?>
  <xapp:select text=?/ClassificationScheme/Name/LocalizedString/@value?>
    <select name=?? />
  </xapp:select>
</xapp:edit>
</pre><BR><BR>The effect is that xapp:select fills the HTML select with option elements whose values are defined by the query /ClassificationScheme/Name/LocalizedString/@value.<BR><BR>The HTML option of a select tag allows you also to have a name for a value. If you want use this option and display another name for the value have a look at X-Application?s documentation for the xapp:select tag and the simple example for the select.<BR><BR>I hope this helps you. However, I have not understand the problem between javascript and xhtml. If you write for instance<BR><BR><pre class="ip-ubbcode-code-pre">
<xapp:edit ?>
  <input onmouseover=?javascript:invokeFunction();? type=?text? />
</xapp:edit>



it should not be a problem. It is xhtml.

Bye,
Christian.

PS: I did not take the time to try out your page and the code I wrote within this post. I hope it works as described. It may include typos.

Hi Christian
if the Occurences of my classificationschemes are minimum in my DB then i could use this method.
i hope my ClassificationSchemes will grow atleast 1000 entries in this case i need to pop up a seaparete page and select on that page. that brings information to create4.jsp

regs
Roohul

Hello,

Since 1000 entries are not nice to have within a select box, I am currently locking for a solution of your problem. I want to try out the idea I have with our Property example before sending you an adapted version of your page. I hope I can post a solution comming Monday.

Bye,
Christian.

Hello,

I checked my solution with the Property example and it works. I adapted the JSP code of this example to your data. I hope, it works also in your environment.

You find your search page for classification schemes attached to this topic. If you check the JSP code, you will see the browse tag that is used to show the classification schemes. The document set for this browse tag is created by a query via xapp:directcommand.

This is the main idea of this page. The other stuff: creating an xapp:edit tag for the classification scheme attribute is not necessary. The reason for this is that I am not familiar with Javascript. If you can refer to an existing input field of another browser window, you can use this input field instead of my approach that uses a form with a hidden input tag.

You can check my page by using a simple link from you create4.jsp to my page

...
<TD width="43%" height="12" valign="top" align="left">
  <B><xapp:edit select="@classificationScheme"><input size="20" type="text" /></xapp:edit></B>
</TD>
<TD width="43%" height="12" valign="top" align="right">
  <a href="searchClassificationSchemeCF.jsp"><B>Select</B></a>
</TD>
...



If it works you can adapt it and integrate your Javascript code that opens a separate second window. Then, you can modify the update method of searchClassificationSchemeCF.jsp to set the value of input tag within your first window.

Bye,
Christian.
searchClassificationSchemeCF.jsp (2.45 KB)