CS320b@yahoogroups.com, or click here.Use the mailing list to ask questions about the class. Don’t be embarrassed to ask questions. For the most part, questions you have are questions others have as well.
Please help each other. If someone asks a question that you can answer (even partly), please reply.
cs.calstatela.edu.
(See RemoteServer.html for information about uploading your homeworks to the remote server.)
Each student now has an assigned student id, which is linked to a directory and website on the remote server. See abbott.calstatela.edu/Courses/CS320b/StudentIDs.html for the assigned student ID's.
My version is here. You can also get my version by ftp if you use "CS320b" as User ID and Password.The book's version is here. Scroll down to WebClient.
I have already made these first two changes in my version. Just set
useOriginal to false.
GET" and "HTTP/1.0"
from the Path field and insert them yourself in the code before you send
the request to the server. The user will just enter a Path in that field.
When you eliminate a tag, add a new line ("\n") to the output if the tag would normally generate a new line. For example, a <p> tag would generate a new line, so replace it with a new line in the output. A <b> tag would not generate a new line, so just delete it.
Don't forget to delete the ending tags, </ ... >.
EchoServerThread or
NetworkServerThread. Have your server look at the request
line it gets from the browser. If the URL the user puts into the browser's
address field is
http://localhost:8088/someFilethe
request line will be
GET /someFile HTTP/1.1
<some number> + <some number>
<some number> - <some number>
<some number> * <some number>
<some number> / <some number> .
http://localhost:8088/5+3.
Simple Expression Evaluator | ||||
| 5 | + | 3 | => | 8 |
form
to make a primitive 4-function calculator with memory.
(It would certainly be more efficient to implement this completely
on the client side in Javascript, but this is a course in server-side
programming.)FORM looking something
like this.
|
| |
(You may copy my HTML if you like. You will have to add your own
FORM tags. See chapter 18 for information on FORMs.)
Alternate the METHOD used, first GET, then
POST, then GET, etc.
memory and an operation and clicks the Go button. (Note that as constructed, it is impossible for the user to send
invalid input. There is always a digit and an operation selected. Since the
Accumulator and Log are set to be readonly, the user can't
foul them up.)
+, -, *, /), it performs the operation on the current value of the accumulator and the user's selection (either the digit or the memory) and puts the result back into the accumulator.C, it sets the accumulator to 0.
ME, it exchanges the values between
the memory and the accumulator. (Note, the memory is never displayed; it is
implemented with a hidden input field.)
+3, *4, -2, ME, +5, *memory, ME, C, +2, ME, /memory25, the memory will contain 2,
and the log of operations will look something like this.
+3 --> 3, 0
*4 --> 12, 0
-2 --> 10, 0
ME --> 0, 10
+5 --> 5, 10
*memory --> 50, 10
ME --> 10, 50
C --> 0, 50
+2 --> 2, 50
ME --> 50, 2
/memory --> 25, 2
Please name this assignment calculator.java
Here is some help in setting up Tomcat to run a Servlet. Running a Servlet with Tomcat.
Please name this assignment calculatorWithCookie.java
Also, print out the log data as a separate entry (not part of the calculator), and associate a time stamp with each log entry. For example:
|
|||||
For some examples of cookies and session data, see CookiesAndSessionData.html.
Please name this assignment calculator.jsp and put it at the top level of your %TOMCAT-HOME% directory.
For some examples of JSP pages, see JSP.html.
<jsp:include ... > directive.
Please name this assignment calculatorInclude.jsp
Write instructions on your page for using the calculator. Then put the calculator itself in an included page. (See include.html for an example.)
In your included page, don't generate redundant <head> and <body> tags. That was just an accident of the example we used to illustrate the <jsp:include ... > directive.
Please name this assignment calculatorBean.jsp.
<jsp:setProperty name="calculatorModel" property="*" />doOperation() that, when called, will perform the operation and update the model's state.
doOperation()
Your calculator's jsp will look something like this.
...
<jsp:useBean id="calculatorModel" class="CalculatorModelBean" />
<jsp:setProperty name="calculatorModel" property="*" />
<% calculatorModel.doOperation() %>
<form ... >
...
<!-- You might do something like this to generate the accumulator. -->
<input readonly
size=21
value='<jsp:getProperty name="calculatorModel" property="accumulator" />'
style='text-align:right'
>
...
</form>
...
The advantage of a structure such as this is that it separates the formatting of the calculator from the implementation of its inner workings. A graphic designer could work on the formatting to make it look pretty, while a programmer could work on the model to make it more efficient or provide additional functionality.
<jsp:useBean ... scope="application">Of course all users must understand that this is the intended use of the calculator. Otherwise they will interfere with each other's calculations.
Please name this assignment sharedCalculator.jsp.
See sharedBean.html for an example of sharing a JavaBean among a number of clients.
|
|||||
Please name this assignment rainbowCalculator.jsp.
Create a custom jsp tag to do this work. See tagLibs.html for a discussion of tab libraries. Also see the HeadingExample.jsp example in the text (pp 1027 - 1031).
xt.exe, an executable xsl transformer.
xt perennials.xml perennials.xsl perennials.html
where perennials.html is a new file, which will contain the output of the transformation.