Dear Siriporn,
Assume your form submits the following to the list.jsp:
name=somevalue
Then in your list.jsp the following happens:
line 8: String name = request.getParameter("name")
name is set to "somevalue"
line 11: <tolog:set var="<%= name %>" reqparam="id"/>
You instruct Ontopia to store a variable named 'somevalue' (the result of <%= name %>) with the value of whatever is stored in the 'id' request parameter (which is null): the tolog variable somevalue is set to null
line 19: <tolog:if query="id37(%name% : id159, $CI : id213)?">
You instruct Ontopia to query the topicmap for all associations of type id137 that have two roles. The constraint for the first role specifies the use of a variable 'name' which does not exist, because you haven't set it.
The reason why this happens is because you've set the variable 'somevalue' instead of 'name'. I guess that what you meant to do was:
<tolog:set var="name" reqparam="name"/>
With the provided example this would result in a variable 'name' being set to 'somevalue'. This will lead you to the next problem. Unless 'somevalue' is a valid id of a topic, the query will fail telling you it was expecting a topic but found a String.
If you truly want to query for the name of a topic I suggest a query like:
<tolog:query name="myquery">
topic-name($topic, $topicname),
value($topicname, "<%= request.getParameter("name") %>"),
id37($topic : id159, $CI : id213)?
</tolog:query>
<tolog:if query="myquery"> ... </tolog:if>
And finally: note that you can combine your two foreach tags into one:
<tolog:query name="myquery">
topic-name($topic, $topicname),
value($topicname, "<%= request.getParameter("name") %>"),
id37($topic : id159, $CI : id213),
id227($CI : id213, $CN : id191)
order by $CI, $CN?
</tolog:query>
<tolog:foreach query="myquery"> ... </tolog:foreach>
With regards,
Quintin Siebers
--
(+31) (0)6 - 11 06 16 27
Morpheus Kennistechnologie BV
<URL: http://www.mssm.nl >
postbus 69
3500 CD Utrecht
KVK 30 26 04 30