On "bookcatalog.jsp" file of "bookstore5" project,
I tried to get the value of <onsale> subelement of <book> element
using the JSP code below
and got nothing. Neither "true" nor "false" was returned. This is as I
came up against.
<x:forEach var="book" select="$applicationScope:booklist/books/*">
<tr>
<td> <x:out select="$book/onsale"/></td>
</tr>
</x:forEach>
Let me show my speculation on this fact with reviewing the contents of
related files.
The contents of "parsebooks.jsp" file are:
<c:if test="${empty applicationScope.booklist}" >
<c:import url="${initParam.booksURL}" var="xml" />
<x:parse doc="${xml}" var="booklist" scope="application" />
</c:if>
and "web.xml" conatains :
<context-param>
<param-name>booksURL</param-name>
<param-value>http://localhost:8080/bookstore5/books.jspx</param-value>
</context-param>
In this environment, "http://localhost:8080/bookstore5/books.jspx"
shows correct XML contents such as:
<books>
<book id="208">
<surname>Tru</surname>
<firstname>Itzal</firstname>
<title>Duke: A Biography of the Java Evangelist</title>
<price>45.0</price>
<onsale>false</onsale>
<year>2001</year>
<description>What a cool book.</description>
<inventory>20</inventory>
</book>
<book id="205">
<surname>Novation</surname>
<firstname>Kevin</firstname>
<title>From Oak to Java: The Revolution of a Language</title>
<price>10.75</price>
<onsale>true</onsale>
<year>1998</year>
<description>What a cool book.</description>
<inventory>20</inventory>
</book>
...
</books>
Nevertheless, I could not get the value of <onsale> element by means
of <x:out select="$book/onsale"/>.
I guess this might suggest <x:parse doc="${xml}" var="booklist"
scope="application" /> didn't work as was expected.
Is there anything wrong with me in this speculation?
How can I get the value of <onsale> subelemnt of <book> element?
Thanks in advance,
---Hiroshi
--
You received this message because you are subscribed to the Google Groups
"JPassion.com: Web Programming Basics" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jpassion_web?hl=en.