josephine chen

Ranch Hand
+ Follow
since Oct 29, 2002
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 josephine chen

I am new to servlet and HTML and I am trying to learn them on my own . So my Ques may sound silly!!!
What is header info for a particular page? Can u give me a small
example.
Thanx

20 years ago

<pre>
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Hello extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException {
// Set the Content-Type header
res.setContentType("text/html");
// Return early if this is a HEAD
if (req.getMethod().equals("HEAD")) return;
// Proceed otherwise
PrintWriter out = res.getWriter();
String name = req.getParameter("name");
out.println("<HTML>");
out.println("<HEAD><TITLE>Hello, " + name + "</TITLE></HEAD>");
out.println("<BODY>");
out.println("Hello, " + name);
out.println("</BODY></HTML>");
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doGet(req, res);
}
}
</pre>
what does this st do??
if (req.getMethod().equals("HEAD")) return
20 years ago
I think
Runnable r = A.handOff();
should be
Runnable r = PublicClass.handOff();
Jim am i correct or missing some thing.....
I am getting the applet but the problem is i am not able to close it.
What should I do to close it?
20 years ago

<pre>
import java.awt.*;
import java.awt.event.*;
class TextBox extends Frame implements KeyListener{
TextField t1;
void createtext(){
System.out.println("create text");
t1 = new TextField();
add(t1);
setLayout(new FlowLayout());
setVisible(true);
setSize(200,400);
t1.addKeyListener(this);
}
public void keyPressed(KeyEvent e){
if (e.getKeyCode() == 10){
System.out.println("fdaSD");
}
}
public void keyReleased(KeyEvent e){ }
public void keyTyped(KeyEvent e){ }


}
class box extends java.applet.Applet{
public void init(){
System.out.println("hai");
TextBox t = new TextBox();
t.createtext();
System.out.println("helloi");

}
}

</pre>
I am getting message saying applet started but my textbox doresnot appear why???
20 years ago
How will I validate the date enterd by the user???
ie he must enter only in mm/dd/yyyy format How should i do this
How to display dates ???
How to check for the date formats???
20 years ago
I have two text boxes in my Awt program.
For each text box the code inside keypress is different.
For the first text box it has to check the user entered values
which must be only digits and for the second i have to check
that the user enters only characters.
If this is the situation how can I handle events ??
I am able to do creating anonymous classes.
but in this case i have to craete the interface twice
using new KeyListener().If i have say, some 10 text boxes
I think this is tedious ??? There must be some other way which i am not able to figure out ???
I tried implemnting the inteface but iam not knowing
how to say for which textbox the following code must fire
on it's keypress event???
Is there a way to do this???

20 years ago
I have created a very small piece of Awt program which i need to place on the web so that all have access to it .How should i do this???
I liked Tony 's Site ... I think u can help me.....
20 years ago
These are the outputs ..
I am not sure why bas.one() called is repeated twice
here?? Expalin please...
with comments
static block of test called
base.one() called
base.one() called
1
If the comment is removed??
static block of test called
base.one() called
static block of sub called
sub.one() called
10
Awt
What does this weightx and weighty do?? I tried but i could'nt make out any visible diff ???
Similarly I could'nt find out any visible change when
I tried to work with insets

Am I correct???
Insets-- The space between the components
ipadx and ipady--- It is the space between the cell and the component area

AWT
How will I know which component has the focus or the cursor ???
How to print an output with single quotes
like this.
'SHAN'
Button b = new Button("ok");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
System.out.println("dsAS");
}
});
What exactly is this doing???
How is this equivalent to the normal way of coding we do
by implementing the interface and implemnting the method???

I feel c is also wrong for the same reason mentioned by Anna