The query variable seems to be set because I print it out and it’s there. And it looks like the query is actualy being performed, BUT the contents of the returned element within the xapp:browse/ tag are not displayed. If I pass an invalid ID to this page I get a StoredException : element not found in database. So its something with the tag I’m guessing.
Any ideas what could be causing this behaviour ? Thanks…
-joey
X-Application Version: 4.1.1 Tamino Version : 4.1.1 Platform : Win2k WebContainer : Tomcat 4.1.24 JDK Version : 1.4.1
you are using a ‘read’ command. This command requests a single document from the Tamino Server and stores this document within the workspace. The name of the document is ‘CapabilityDocument’.
You can access the document by defining a document context via the xapp:form tag. Therefore, could you replace the browse tag by
I see what the problem was. I reaplced the browse tag with a form tag and a document=“CapabilityDocument” attribtue and that fixed the problem. Now the query is performed and the result is display properly.
Thanks again!!
–joeycz
X-Application Version: 4.1.1 Tamino Version : 4.1.1 Platform : Win2k WebContainer : Tomcat 4.1.24 JDK Version : 1.4.1
You want to use a request parameter within a query. Request parameter are transferred per default to the variables handler.
So, you could check this for your parameter ‘cap_id’. If you add a tag
<xapp:getvar name="cap_id" />
</pre><BR><BR>on the page, the value of the request parameter should be displayed.<BR><BR>Therefore, you could also define your query referrencing this variable.<BR><BR><pre class="ip-ubbcode-code-pre">
<xapp:setvar name="cap_query_by_id"
value="for $x in input()/Capability where $x/@id = ${cap_id$} return $x" />
</pre><BR><BR>And then, you could use your directcommand<BR><BR><pre class="ip-ubbcode-code-pre">
<xapp:directcommand type="read"
collection="${NMPCollection$}"
document="CapabilityDocument"
arg="${cap_query_by_id$}" />
If this proposal works, you can skip the Java code of your JSP.
awsome… i didnt know that the variables handler has access to request parameters… very cool…
this method is much more elegant then the JSP code approach. Although i did make one minor correction to the query veriable. quotes are requierd arround cap_id.
<xapp:getvar name="cap_id" />
<xapp:setvar name="cap_query_by_id">
for $x in input()/Capability where $x/@id = "${cap_id$}" return $x
</xapp:setvar>
Thanks very much… this is realy helpful
btw… is this document anywhere in the XApplication documentation ? It would be very usefull to maybe add such a thing to the documentation of the next release of XApplication.
there is a chapter ‘Defining and Processing XQueries’. It contains examples how define a query based on input fields. Input fields of a HTML form are request parameters that are send when HTML form is submitted.
However, we don’t have a section within the documentation where the mechanism of the request handling is explained. Could be a task for a next version