barnarp
asked on
JSP Empty String Problem
hi,
I have two edits on my first jsp page, which values I send via form submit to the second page.
I want to test on my second page whether these values is empty, and if they are, forward to another page.
The problem is that when the values are empty, the jsp engine regards them as "not empty"?? and doesnt go into the fowarding
if statement.
I have even tested the values by displaying them in the second page, but no luck.
If I go and set these values to "" before i execute the if, it works!
I must be missing something obvious.
--page 1--
<input type="text" name="edtItemNumber">
<input type="text" name="edtStoreLocation">
--page 2--
String item = request.getParameter("edtI temNumber" );
String location = request.getParameter("edtS toreLocati on");
if ((item == "") || (location == ""))
{application.getRequestDis patcher("/ oraerror.j sp?ErrorSt r=Please complete Item number and Store Location." ).forward(request,response );}
Please help.
I have two edits on my first jsp page, which values I send via form submit to the second page.
I want to test on my second page whether these values is empty, and if they are, forward to another page.
The problem is that when the values are empty, the jsp engine regards them as "not empty"?? and doesnt go into the fowarding
if statement.
I have even tested the values by displaying them in the second page, but no luck.
If I go and set these values to "" before i execute the if, it works!
I must be missing something obvious.
--page 1--
<input type="text" name="edtItemNumber">
<input type="text" name="edtStoreLocation">
--page 2--
String item = request.getParameter("edtI
String location = request.getParameter("edtS
if ((item == "") || (location == ""))
{application.getRequestDis
Please help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Pierre,
Try:
http://java.sun.com/docs/books/tutorial/java/data/strings.html
And of course the good old javadoc :-)
http://www.objects.com.au
Brainbench MVP for Java 1
http://www.brainbench.com
Try:
http://java.sun.com/docs/books/tutorial/java/data/strings.html
And of course the good old javadoc :-)
http://www.objects.com.au
Brainbench MVP for Java 1
http://www.brainbench.com
ASKER
Do you know of any reference on the net, where I can learn more about string functions etc ?
Pierre