<FORM ACTION="/servlet/myservlets.ServletX">
FromCity <input type="text" name="fCity">
<input type="submit" value="Submit" >
In ServletX I have this:
if (request.getParameter("fCity") != null) {
System.out.println("fCity = " + param.toString() + "end of line");
If I do not enter a value for parameter fCity, the console displays this:
fCity = end of line
If I change the name of the parameter passed from the jsp from "fCity" to "xxx", the console displays this:
fCity = nullend of line
My problem: I need to test if the user has entered a value in the jsp for "fCity". I've tried these:
if (request.getParameter("fCity") != null) {
System.out.println("fCity = " + param.toString() + "end of line");
if (request.getParameter("fCity") != "") {
System.out.println("fCity = " + param.toString() + "end of line");
if (request.getParameter("fCity") != "") {
System.out.println("fCity = " + param.toString() + "end of line");
In all 3 cases, the console shows "fCity = end of the line" It seems that the value of "fCity" is neither null
nor a blank nor is it nothing at all. What is it? How do I test its value? Have I lost my mind?
I'm running J2EE 1.4 with j2sdk1.4.2_07.
Get this- I am using Eclipse 3.0.1 with MyEclipse 3.8.4. In the MyEclipse Application Developer Guide, there is the MyEclipse J2EE Enterprise Application Projects - Quickstart. In that they have a sample EJB application called TraderX. In the web portion of it is EXACTLY the problem I describe above. I've run it in debug mode and seen it fail. My mouth fell open. Again, how does a person test for what request.getParameter("parmX") returns when parmX is a parameter but the user entered no value for it in the html or jsp??
THANK YOU in advance-