> this doesn't work,,why? I thought this would be a simple
> procedure, but no.
> The IF test doesn't work,,,, it ignore the parameter field1 and laways
> prints
> the first thing "you didn't ....." regardless... why?
It doesn't work because you're not testing the right thing.
Remember, in Java, String is a subclass of Object. "==", "!="
etc operators are testing equality (or nonequality) of the object
references, not semantic equality of what the objects represent.
> String title = "Deans First Example";
> if(request.getParameter("field1") !="dean"){
Change the "if" to:
if ( request.getParameter("field1").equals("dean") ) {
Or if you want to be even more explicit about what's going on:
if ( ((String) request.getParameter("field1")).equals("dean") ) {
It is very important that you understand what objects are in java
and the differences between testing equality of object references
and testing for semantic equality of objects.
== Rich
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets