Kathy Wang

Greenhorn
+ Follow
since Sep 06, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kathy Wang

I am pretty new to JSTL. It seems for me it is a combination of scripting language and tag ligrary. Hope I can get a chance to read your book! Aand use what you teach in the book sometime. Thanks
19 years ago
JSP
Javaranch mock exam question NO.24
Which is a correct entry in the Deployment Descriptor for role-name used in the security-constraints placed on your webapp.
1)<web-app>
<security-role>
<constraint-name>Manager</constraint-name>
<security-role>
....
2)<web-app>
<security-role>
<role-name>Manager</role-name>
<security-role>
....
3)<web-app>
<security-constraint>
<role-name>Manager</role-name>
<security-constraint>
....
The correct answer is 2).
According to servlet spec. 12.3 the parent element of <role-name> is <security-role-ref>; Also in Alx Dark's note 6.2, the parent element is <auth-constraint>. Can anyone please tell me where I can find a reference to this question? Or can I say this question is wrong? Any of your input is highly appreciated!
Thanks Manjunath and Sandeep,
My myUtils is not a servlet or a bean. It is just a java object. I will try Sandeep's first mehod. Thanks again!
20 years ago
JSP
I know this question may be stupid, but please forgive me, I am new to JSP. Here is what I what:
I have a myapps/index.jsp file and a myapps/web-inf/classes/myUtils.java file. In the index.jsp file, I want to use myUtils.class, what should I do to realize this? I tried <%@ include file="/servlet/myUtils.class" %> and also <%@ include file="/web-inf/classes/myUtils.class" %>, they all gave class not found exception.
Thanks for your reply!
20 years ago
JSP
Thanks Dave and BK!
BK, I did run the sample servlet, they did not run either. You mean I need to add: set classpath=c:\tomcat4; ?
If there were a book "Tomcat Installation for Dummies", I will do the same thing as you. But right now, I will follow your advice and keep reading the tomcatdocs. Thanks again.
20 years ago
Hi,
I have downloaded Tomcat4 and have got it run. But when I tried to compile Java servlet file, it gave errors like
HelloWorld.java:4: package javax.servlet does not exist
import javax.servlet.*;
my jdk is in c:\jdk1.3.1, tomcat is in c:\tomcat4, JAVA_HOME=c:\jdk1.3.1 and TOMCAT_HOME=c:\tomcat4. And I already setup CLASSPATH=.\;C:\JDK1.3.1\LIB\TOOLS.JAR\;
I searched this site's related threads, they talked about setting up classpath also to CLASSPATH=c:/tomcat/lib/servlet.jar
,But I can not find the servlet.jar file in the correspond directory c:/tomcat4/lib/, What should I do? Can you please give me some advice?
Any reply is highly appreciated!
20 years ago
Thanks Jose. Your explaination do clear me out. Thanks again.
Kathy
Thanks Jose,
But I am confused by your explanation too. Is that what you mean: Barry Boone exam 1, Q6 answer should not include d?
You said "Each digit in an hex number represents 4 bits", do you get the conclusion from Unicode in 4 digits? Could you please explain in detail?
Thanks alot.
Any long literal can be expressed in hexadecimal. Just pretend that the value is converted to the decimal value, and then it is simply a long literal. Then apply the usual rules of arithmetic promotion.
Geoffrey
Thanks Geoffrey.
But I am quite clear, can you explain further? Decimal long 1 can be expressed in hexadecimal, so it is expressed as 0x0001 or 0x01? Thanks again.
In RHE chapter 1, Literals, only integral literal hexadecimal is touched. It is said 28 in Hex is 0x1c.
In Barry Booneexam 1,
Question 6: Which assignments are legal?
Select all valid answers.
a. long test = 012;
b. float f = -412;
c. int other = (int)true;
d. double d = 0x12345678;
e. short s = 10;
Answer are abde.
My opinion: according to answer d,because double is 64 bits, so hexadecimal is 8 numbers not including "0x". If things work like this, the integral literal default is int type, so the hexadecimal for it should be in 4 numbers? But in RHE it is said in 2 numbers. I know RHE is barely wrong, but I am confused here, can anybody clear me out? What is the rule for hexadecimal? Can double and float be expressed in hexadecimal?
Any of your opinion is highly appreciated!!
Hi, Fisher ,
I found a lot of places mentioned JLS, could you please tell me where can I get it? Thanks
Hi,
I took two related questions from different website,and I foud they seem a little conflicted, can anyone clear me out? Thanks alot!
Q40 from RHE final exam:
Which of the following is/are true?
A.A static method maybe overriden by a static method.
B.A static method maybe overriden by a non-static method.
C.A non-static method maybe overriden by a static method.
D.A non-static method maybe overriden by a non-static method.
Ans: D.
Explaination from book is: A and B are false because static method may noe be overriden.
Question 31) from Marcus' mock exam 2
1) What will happen when you attempt to compile and run the following code
import java.io.*;
class Base{
public static void amethod()throws FileNotFoundException{}
}
public class ExcepDemo extends Base{
public static void main(String argv[]){
ExcepDemo e = new ExcepDemo();
}
public static void amethod(){}
protected ExcepDemo(){
try{
DataInputStream din = new DataInputStream(System.in);
System.out.println("Pausing");
din.readChar();
System.out.println("Continuing");
this.amethod();
}catch(IOException ioe) {}
}
}
1)Compile time error caused by protected constructor
2) Compile time error caused by amethod not declaring Exception
3) Runtime error caused by amethod not declaring Exception
4) Compile and run with output of "Pausing" and "Continuing" after a key is hit
Ans: 4).
Here the static method amethod() has been overriden! I am confused here.
Thanks for your reply!
Thanks you guys' reply.
I hope what we thought is right, but just in case,I tried to find this book's errata, but failed. Does anyone know if there is a correspond errata?