> Hello,
> I make a HTML document,it has two buttons,it likes:
> ......
> <input type="Submit" name="okbutton" value=" OK " >
> <input type="Submit" name="cancelbutton" value=" Cancel ">
> ......
> My servlet is follows:
> String action=request.getParameter("Submit");
> ...
> System.out.println("You pressed "+action+" button");
> ...
> When I run it,and I press OK button,but I got:
> You pressed null button
> Why?
The javadoc (http://jakarta.apache.org/tomcat/tomcat-4.0-
doc/servletapi/index.html) for getParamter() says:
Parameters:
name - a String containing the name of the parameter whose value is
requested
When your code calls getParameter(), what is it that you are passing?
(Hint: you are not passing the name.)
> I have another two questions:
> 1)How to close IE?
Usually you don't want to close a browser for a user. If you really think
you need to, there are various Javascript or VBscript method calls you can
make. For Javascript there is window.close, self.close(), top.close()
among others. I do not know the VBscript commands, but would guess close()
called on the appropriate object would probably do it.
> 2)I want to show Input ID with red color,How to modify the statement?
> <Input ID input type="Text" name="ID" align="left" size=15>
Font color is usually set with a <font> tag. The <font> tag surrounds the
object whose color you want to change.
Kevin Mukhar
http://home.earthlink.net/~kmukhar
Co-Author Beginning Java Databases