You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by suhas <su...@techmas.hcltech.com> on 2000/07/03 11:18:06 UTC

Re: NotEqual or Present?

If u have a text field on the html form . When u submit that form without entering anything in textfield then in the servlet if u try to do  
String value = request.getParameter("nameOfTextField") , u will get  value =""   and  not null 

So no need of setting dataObjects values to "" explicitely 

   

  ----- Original Message ----- 
  From: Matt Raible 
  To: struts-user@jakarta.apache.org 
  Sent: Monday, July 02, 2001 8:07 PM
  Subject: Re: NotEqual or Present?


  We set all our values to "" in our dataObjects so the UI does not display null on the screen.  Does struts auto-convert a null to a "" for display?  If so, then we can get the getter/setters in our dataObjects (forms).
   
  Matt
    ----- Original Message ----- 
    From: Spencer Smith 
    To: struts-user@jakarta.apache.org 
    Sent: Monday, July 02, 2001 12:57 PM
    Subject: Re: NotEqual or Present?


     
    Why not default the value to null and use the Present/NotPresent methods?
     
    ie.
     
    String searchParam = null;
     
    <logic:present name="myForm" property="searchParam">
        show this if property "searchParam" is not present
    </logic:notPresent>

    This way, if the user never sets it, it will always be null (and notPresent).
     
      ----- Original Message ----- 
      From: Matt Raible 
      To: struts-user@jakarta.apache.org 
      Sent: Monday, July 02, 2001 11:53 AM
      Subject: Re: NotEqual or Present?


      If I do this, I get the following error - it seems to go away when I put a value in value="put value or space here"
       
      [02/Jul/2001 12:52:02:2] error: Exception: SERVLET-execution_failed: Error in executing servlet resourceList: java.lang.Exception: JSP Error: Setter method not provided for class org.apache.struts.taglib.logic.NotMatchTag, property class
      Exception Stack Trace:
      java.lang.Exception: JSP Error: Setter method not provided for class org.apache.struts.taglib.logic.NotMatchTag, property class
              at com.netscape.jsp.JSPTree.genAttributeAssignments(Unknown Source)
              at com.netscape.jsp.JSPTree.compileUserTag(Unknown Source)
              at com.netscape.jsp.JSPTree.compile(Unknown Source)
              at com.netscape.jsp.JSPTree.compileUserTag(Unknown Source)
              at com.netscape.jsp.JSPTree.compile(Unknown Source)
              at com.netscape.jsp.JSPTree.compileUserTag(Unknown Source)
              at com.netscape.jsp.JSPTree.compile(Unknown Source)
              at com.netscape.jsp.JSPTree.compileUserTag(Unknown Source)
              at com.netscape.jsp.JSPTree.compile(Unknown Source)
              at com.netscape.jsp.JSP.compile(Unknown Source)
              at com.netscape.server.servlet.jsp.JSPCompiler.JSPtoJava(Unknown Source)
              at com.netscape.server.servlet.jsp.JSPCompiler.compileJSP(Unknown Source)
              at com.netscape.server.servlet.jsp.JSPCompiler.compileOrLoadJSP(Unknown Source)
              at com.netscape.server.servlet.jsp.JSPCompiler.compileInstance(Unknown Source)
              at com.netscape.server.servlet.jsp.JSPCompiler.compileInstance(Unknown Source)
              at com.netscape.server.servlet.servletrunner.ServletRunner.createServletInfo(Unknown Source)
              at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown Source)
              at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
              at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
              at com.kivasoft.thread.ThreadBasic.run(Native Method)
              at java.lang.Thread.run(Thread.java:479)
        ----- Original Message ----- 
        From: Rama Krishna 
        To: struts-user@jakarta.apache.org 
        Sent: Monday, July 02, 2001 12:45 PM
        Subject: Re: NotEqual or Present?


        probably you should use match and notmatch tags
         
        <logic:notmatch name="myForm" property="searchParam" value="">
            show this if property "searchParam" is not equal to ""
        </logic:notEqual>

        rama.
          ----- Original Message ----- 
          From: Matt Raible 
          To: Struts User 
          Sent: Monday, July 02, 2001 11:17 AM
          Subject: NotEqual or Present?


          I am trying to check if the user entered a value for a search criteria in a results page.  My ActionForm sets a property to "" if the user did not enter a value.
           
          So in the following code, I want to only show it if the property does not equal "".  But the following does not work, should it?
           
          <logic:notEqual name="myForm" property="searchParam" value="">
              show this if property "searchParam" is not equal to ""
          </logic:notEqual>
           
          Thanks,
           
          Matt