Lab Assignment 3
CS320, Spring 2004
[Q&A] (5pt) Suppose we are going to implement a custom tag <validate> using a Java class Validate. The tag will be used as <cs320:validate user="value1" course="value2"/>, e.g. with two attributes and no body content. Please write down your answers to the following questions on a piece of paper.
About Java Code
1. Which Java package(s) should you import in Validate.java?
2. Do you need to put the Validate class in a package?
3. Which Java class should Validate inherits from? and which method(s) should be overriden in Validate?
4. What method(s) do you need to implement in class Validate in order to support the two attributes user and course?
5. Suppose you want to output "invalid user or course" if the values of the attributes user and course do not match some preset values. What statement(s) do you use in Validate.java?
6. In order to compile Validate.java, which class library should be included in the classpath? and where is this class library on the cs server?
About TLD
1. What does TLD stand for?
2. The uri attribute in a TLD file is
A. The URL to the location where the tag library can be downloaded.
B. A unique identifier for the tag library.
C. A unique identifier for a tag in the tag library.
3. An attribute element in a TLD file has five possible attributes: name, required, rtexprvalue, type, and description. All these attributes are fairly self-explanatory except rtexprvalue, which could be either true or false. What does this attribute do?
4. Write the TLD file for <validate>.
About Deployment with a Jar file
1. What command do you use to create a jar file?
2. What command do you use to view the content of a jar file?
3. What command do you use to package your class file(s) and TLD file(s) in a jar file?
4. Assume your home directory on the cs.calstatela.edu server is $HOME.
In which directory do you put your jar file so your JSP files can use
the tag library?
About Deployment without a Jar file
Assume your home directory on the
cs.calstatela.edu server is $HOME.
1. In which directory do you put your .class file(s)?
2. In which directory do you put your TLD file(s)?
[Programming] (5pt) Modify your JSP file from Lab 2 such that instead of using a bean, it uses a custom tag <validate> to verify the user input.