Doesn't work correct: <tt>request.getParameter("select")</tt>
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nils_Wetterich
Posted On:   Wednesday, March 20, 2002 09:53 AM


Could you please help me? I have no idea why the passed parameter from the select box looks just like it should but I can't use it for an

if
decision. It's NEVER EVER true.



Here is my code:

			
String sTest = request.getParameter("select");

out.write(sTest);

if ( "theValue" == request.getParameter("select") ) {
out.write("Month to date"); }
else {
out.write("Year to date"); }




Thanks for EVERY help...

Re: Doesn't work correct: <tt>request.getParameter("select")</tt>

Posted By:   Rama_V  
Posted On:   Wednesday, March 20, 2002 10:51 AM

Don't use '==' for comaparing the strings.Use 'equals()' method.

Try the following code:

if ( "theValue".equals(request.getParameter("select"))) {

out.write("Month to date"); }

else {

out.write("Year to date"); }




Thx,

Rama
About | Sitemap | Contact