... and JavaServer Pages.
Chapter 4,“XML and XSLT: Xerces and Xalan,” introduces Xerces, a DOM and a
SAX parser, and Xalan, an XSLT and XPATH processor.
Chapter 5,“BonForum Chat Application: Use and ... “.;c:\jakarta-tomcat\lib\servlet.jar;”
➥
de/tarent/forum/OutputChatMessagesTag.java -d /classes
javac -classpath “.;c:\jakarta-tomcat\lib\servlet.jar;”
➥
de/tarent/forum/OutputDebugInfoTag.java -d /classes
javac -classpath “.;c:\jakarta-tomcat\lib\servlet.jar;”
➥
de/tarent/forum/NoCacheHeaderTag.java ... Introduction and Requirements
2 An Environment for Java Software
Development
3 Java Servlets and JavaServer Pages:
Jakarta Tomcat
4 XML and XSLT: Xerces and Xalan
5 bonForum Chat Application: Use
and...
... c:\jakarta-tomcat\classes;c:\jakarta-
tomcat\lib\ant.jar;c:\jakarta-tomcat\lib\jaxp.jar;c:\jakarta-
➥
tomcat\lib\servlet.jar;c:\jakarta-tomcat\lib\parser.jar;c:\jakarta-tomcat\lib\we
➥
bserver.jar;c:\jakarta-tomcat\lib\jasper.jar;c:\jakarta-
➥
tomcat\lib\xalanservlet.jar;c:\jakarta-tomcat\lib\xerces.jar;c:\jakarta-
➥
tomcat\lib\xalanj1compat.jar;c:\jakarta-tomcat\lib\aaxalan.jar;c:\jdk1.3\lib\too
➥
ls.jar
2001-05-23 ... c:\jakarta-tomcat\classes;c:\jakarta-
tomcat\lib\ant.jar;c:\jakarta-tomcat\lib\jaxp.jar;c:\jakarta-
➥
tomcat\lib\servlet.jar;c:\jakarta-tomcat\lib\parser.jar;c:\jakarta-tomcat\lib\we
➥
bserver.jar;c:\jakarta-tomcat\lib\jasper.jar;c:\jakarta-
➥
tomcat\lib\xalanservlet.jar;c:\jakarta-tomcat\lib\xerces.jar;c:\jakarta-
➥
tomcat\lib\xalanj1compat.jar;c:\jakarta-tomcat\lib\aaxalan.jar;c:\jdk1.3\lib\too
➥
ls.jar
2001-05-23 ... this watermark.
54
Chapter 3 Java Servlets and JavaServer Pages: Jakarta Tomcat
Take a look at this API page, and you will see the top-level logical design of Java
servlets and JSPs.
3.7.2 Learning...
... realized that it was easier to create a different JSP page to
handle each three-part command than it was to continually revise a Java servlet so that
it could parse each command and act accordingly.The ... database management system
because handling chat data is an obvious job.We decided against that for several rea-
sons. One is that we did not want to assume that all our readers are familiar ...
value=“<tree><topic>Chess Players
Chat</topic><moderator>Harvey
Wilkinson</moderator></tree>”>
Notice that...
... for a bonForum user to become a host by starting a chat and
then re-enter the same chat as a guest.The problem is that that user then loses the
capability to again be a host of that chat. Having ... Displaying and Selecting Chat Subjects
As you have read, our implementation began as a system involving many JSP docu-
ments, which used custom tags to access an XML data-interface object and an ...
bonForumXML
(a
ForestHashtable
) as a string.
Now we decided to make it the input XML stream for the Xalan XSLT processor as
part of our
TransformTag
class.
Displaying the available chats would mean...
... the applet parameters right on
the _robot page? Using the same target parameter as we did in the last section as an
example, that would mean doing this:
<jsp:param name=”target” value=”display”/>
The ... to each JSP-produced page of a bonForum
instance.
The incoming request parameters are validated and made available to the Web
application in whatever scope is appropriate.We will give two examples ... can be associated with a particular destination and
bonForumCommand
processing.
That will help create more complex combinations of the bonForum chat logic, by
making one more variable available...
...
// (and equal to chatSubject)
nameAndAttributes = “sessionID_”;
nameAndAttributes += sessionId;
nameAndAttributes += “_”;
nameAndAttributes += creationTimeMillis;
nameAndAttributes += “ chatTopic=\””;
nameAndAttributes ... changeChatActorRating( ) Method
A command available to chat hosts (and someday to guests as well) allows them to rate
other actors in their chat.The
TransformTag
is used to display XSLT-generated ... there are two such XSLT classes, one for Xalan-Java 1 and one for Xalan-
Java 2.
Simplifying greatly, here are the statements called by the
TransformTag
class to get
its XML database in a string:
private...
... will assume as it translates the tag that
these variables are available as page attributes. Later, when we look at the translated
Java code for a Tag Handler instance, you can see where the value ... bean from Tag Handler classes, and there are different ways to manage that.
A bean can even be made into a tag handler itself, simply by implementing the
Tag
interface.We make our bean available ...
bonForumStore
application attribute from inside the
tag-handler classes for the
outputPathNames
,
outputChatMessages
, and transform tags.
We do that only once per Tag Handler class using a static variable...
... system_executes_command.jsp. Note that if you have
Xalan-Java-2
,
you can also set
xalanVersion
to
Xalan Java 1
, as long as the compatibility JAR file
is accessible, for example, as TOMCAT_HOME\lib\xalanj1compat.jar.
Let’s ... two
classes to encapsulate the steps required for either
Xalan-Java 1
or
Xalan-Java 2
.The
classes are called
Xalan1Transformer
and
Xalan2Transformer
. Each has one method
called
transform
, which ...
nodeNameHashtable
for each session. Using the unique
nodeKey.aKey
was a natural
choice because
BonForumEngine
was already getting that back from the database when-
ever any node was added.Then...
... this watermark.
426
Chapter 11 XML Data Storage Class: ForestHashtable
tested for escaped quotes and also catches some errors such as no closing quotes in an
attribute value and an
attributeName
argument ... created by the following
statement from the file ForestHashtable.java:
public NodeNameHashtable nodeNameHashtable = new NodeNameHashtable();
Notice that a class called
NodeNameHashtable
has ... this watermark.
416
Chapter 11 XML Data Storage Class: ForestHashtable
attribute to a chat element.We will also try using it to allow a chat host to change the
rating of a guest in a chat.
Warning
The...
... sessionId;
nameAndAttributes += “_”;
nameAndAttributes += creationTimeMillis;
nameAndAttributes += “ chatTopic=\””;
nameAndAttributes += chatTopic;
nameAndAttributes += “\””;
content = “”;
forestHashtableName ... behavior of “visitor starts
chat” when chat exists
// 1. always warn user and ask again for new subject
and/ or new topic
// 2 if actor was in it, always join with previous
status, else warn and ... its parent is found
// using the pathNameHashtable.
// The parent nodeKey is there
// with a key which is its pathName
// (and equal to chatSubject)
nameAndAttributes = “sessionID_”;
nameAndAttributes...
... now, caller is responsible for that!)
*
* @param childNodeName String naming this node
* @param childNodeAttributes String containing all attributes
concatenated (name=value name=value )
* @param ...
break;
}
case ‘&’: {
str.append(“&”);
break;
}
case ‘“‘: {
str.append(“"”);
break;
}
case ‘\r’:
case ‘\n’: {
str.append(“&#”);
str.append(Integer.toString(ch));
str.append(‘;’);
break;
}
default: ... select an XSLT
processor.
* Currently, three values: “Xalan Java 1”, “Xalan Java 2”, or
“xalanVersion”.
* If type is “xalanVersion”, the tag object looks for an application
* attribute of the same...