Struts-logic, notEqual, compare null variable

I would like to request advice using struts-logic. I have Jakarta-struts-1.0.2 working with JavaBeans on Tomcat 4.1 / W2K.
The tags below should not print the value if the value (from a database) is null.
The following tags:
<logic:notEqual name ="bookdetails" property="auth_2_surname" value="">
<br><jsp:getProperty name="bookdetails" property="auth_2_surname" />
</logic:notEqual>
generate this error:
JasperException: Cannot compare null variable to value
Is there a way to use struts-logic when the value to be compared is null?
Thank you for your help.
James

try to use i think <logic:notEmpty> strut tag instead

Similar Messages

  • Struts' logic:notEqual

    i have two objects inside my form previousCustomerDetails and CustomerDetails
    i want to compare the previousName entered with the newName if it has changed then i wish to print it.
    <logic:notEqual name="previousCustomerDetails" property="custName" value="<%= previousCustomerDetails.getCustName() %>">
          sdsd
          </logic:notEqual>Is there anyway to do this without scriptlet tags?
    i have tried
    <logic:notEqual name="previousCustomerDetails" property="custName" value="<bean:write name="previousCustomerDetails" property="custName" />">
         sdsd
         </logic:notEqual>
    but i get equal expected??
    I have defined previousCustomerDetails and CustomerDetails in the jsp using bean:define...
    Message was edited by:
    spear_arrow

    try to use i think <logic:notEmpty> strut tag instead

  • JSP - Nested Jakarta Struts Logic Tags

    Hi,
    Simple question....
    Can Jakarta Struts Logic tags be nested when coding JSP's
    i.e.
    ==========================================
    <logic:iterate id="searchSizeTracker" name="searchSizeTracker" type="uk.co.troutlure.bom.SearchTrackerObject" scope="request">
    <logic:greaterEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <logic:lessEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getMaxPage()%>'>
    <logic:equal name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <jsp:getProperty name="searchSizeTracker" property="page_no"/>
    </logic:equal>
    <logic:notEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <a href="<%=request.getContextPath()%>/performSearch.do?pageRequired=<bean:write name='searchSizeTracker' property='page_no'/>&action_id=<bean:write name='searchActionForm' property='currentActionId'/>&searchType=<bean:write name='searchActionForm' property='searchType'/>&currentScreen=search_reorder"><jsp:getProperty name="searchSizeTracker" property="page_no"/>
    </a>
    </logic:notEqual>
    </logic:lessEqual>
    </logic:greaterEqual>
    </logic:iterate>
    =========================================
    The above code sample seems to fail to get past the first <logic:greaterEqual tag even though the conditions are met. And the iterator just loops throught the rest of the SearchTrackerObjects.
    I'm not sure whether logic tags can be nested as shown???
    Thanks in advance.

    Yes you should be able to nest logic tags like that.
    However you seem to be wanting to limit the values that are iterated through using the greaterEqual and lessEqual tags.
    I would suggest you use the offset and length attributes on the logic:iterate tag:
    something like:
    <logic:iterate id="searchSizeTracker" name="searchSizeTracker" type="uk.co.troutlure.bom.SearchTrackerObject" scope="request" offset ="<%searchActionForm.getCurrentPage()%>" length="<%searchActionForm.getMaxPage() - searchActionForm.getCurrentPage()%>">Cheers,
    evnafets

  • How can I evaluate if a collection is empty or not with struts logic tag?

    How can I evaluate if a collection is empty or not with struts logic tag?
    I tried with logic empty tag. but the tag evaluated if a collection is null or not.
    I would like to do like this below.
    List list = new ArrayList();
    set(list);
    <logic:XXXX name="someForm" property="list">
    The list size is 0.
    </logic>thanks in advance.

    U can use :
    <logic:present name="urform" property="urlist">
    </logic:present>
    to check "urlist" is empty or not

  • New to Struts - logic:if error - am I not properly defining a bean?

    I am going through what are for the most part simple Struts examples and tutorials on my company's Intranet. The example below should be testing against the pre-defined <logic:if> and <logic:or> statement values and spitting out either the 'one or more conditions are true' or 'none of the conditions are true' depending.
    That said, I am getting an error with the following block of code (at line 11) just before the first logic:if statement and I am hoping for help in determining where I have gone astray.
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ taglib uri="/tlds/marketmaker.tld" prefix="abc" %>
    <%@ taglib uri="/tlds/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/tlds/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/tlds/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/tlds/jdo.tld" prefix="jdo" %>
    <%@ taglib uri="/tlds/string.tld" prefix="str" %>
    <abc:page>
         <h3>logic:if</h3>
           <logic:if name="calendarBean" property="month" op="equal" value="March">
           <logic:or name="calendarBean" property="year" op="lessEqual" value="2012"/> <!-- Note self-closing -->
           <logic:or name="calendarBean" property="day" op="equal" value="Friday"/>
             <logic:then>
                <p>At least one condition above is true.</p>
              </logic:then>
              <logic:else>
                <p>None of the conditions are true.</p>
              </logic:else>
           </logic:if>
    </abc:page>Again, the error is at line 11, occurring at or just before the <logic:if> statement. I presume it is because a bean must be properly defined.
    I tried the following variations of <bean:define> and keep coming up with the same error.
    <bean:define id="calendarBean" name="myCalendarBean" value="March" />
    <bean:define id="calendarBean" name="calendarBean" value="March" />
    <bean:define id="calendarBean" name="calendarBean"/>
    <bean:define id="calendarBean" name="myCalendarBean"/>
    <bean:define id="myCalendarBean" name="calendarBean"/>
    <bean:define id="calendarBean" value=""/>
    <bean:define id="calendarBean" value="false"/>
    <bean:define id="calendarBean"/>Am I right about defining a bean first? If yes, what am I doing incorrectly in the aforementioned <bean:define> declarations listed above?
    If you see something entirely different (and wrong) please do let me know.
    Edited by: 924359 on Mar 29, 2012 1:03 PM

    Try a Struts forum. This isn't one. Locking.

  • How to use struts Logic tags in weblogic8.1

    hi
              i have used jakarta struts in JDeveloper there i used logic tags
              but the same i have to use in weblogic8.1 ,how should i use it
              i am new to weblogic platform
              it is very urgent
              please

    Hi harish,
              Procedure for using a Struts Tag Libraries in weblogic 8.1 :
              â€¢Copy the tag lib jar files under WEB-INF/lib ( if tag handler supplied as
              classes without package a jar file then we need to copy the classes
              under WEB_INF/classes.
              â€¢ Copy the tld files files under WEB-INF or create a directory under
              WEB-INF and copy tld files under this directory.
              â€¢ We need to give the information about the tag libraries in web.xml by
              adding the following lines to it as,
              <taglib>
              <taglib-uri>bean</taglib-uri>
              <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
              </taglib>
              <taglib>
              <taglib-uri>html</taglib-uri>
              <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
              </taglib>
              <taglib>
              <taglib-uri>logic</taglib-uri>
              <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
              </taglib>
              To use tags in jsp file we need to add taglib directive as ,
              <%@ taglib uri="logic" prefix=“logic"%>
              <%@ taglib uri="html" prefix=“html"%>
              <%@ taglib uri="bean" prefix=“bean"%>
              Every tag can support zero or more number of attributes and a tag may or
              may not support body content
              Every Tag Library Uniquely identified by uri defined in web.xml.
              we can use the tags in jsp according to the tags and attributes which are defined in *.tld files.
              if we look at .tld files we can find several tags and its attributes.
              note :any jar files that are related to struts framework ,place under the lib directory of the webapplication.
              ----- Anilkumar kari

  • Struts logic:equal problem

    Hi,
    I'm having trouble with the following:
    <logic:equal name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    even when the page_no value of searchSizeTracker and the currentPage property of searchActionForm both = 1, the logic doesn't display the contents of the logic:equal tags???
    I've included a JSP fragment below.
    Thanks.
    ==============================
    JSP Fragment
    ==============================
    <logic:present name="searchActionForm" scope="session">
    <bean:define id="searchActionForm" name="searchActionForm" scope="request"/>
    </logic:present>
    <tr>
    <td align="center" colspan="4">
    currentPage = <bean:write name='searchActionForm' property='currentPage'/>
    <br>
    currentActionID = <bean:write name='searchActionForm' property='currentActionId'/>
    <br>
    <logic:iterate id="searchSizeTracker" name="searchSizeTracker" type="uk.co.troutlure.bom.SearchTrackerObject" scope="request">
    <logic:equal name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <strong>
    <jsp:getProperty name="searchSizeTracker" property="page_no"/>
    </strong>
    </logic:equal>
    <logic:notEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <a href="<%=request.getContextPath()%>/performSearch.do?pageRequired=<bean:write name='searchSizeTracker' property='page_no'/>&action_id=<bean:write name='searchActionForm' property='currentActionId'/>&searchType=2&currentScreen=search_reorder"><jsp:getProperty name="searchSizeTracker" property="page_no"/>
    </a>
    </logic:notEqual>
    </logic:iterate>
    </td>
    </tr>
    ==============================

    Hi
    You have made a small mistake in the coding of your JSP. You please replace
    <logic:equal name='searchSizeTracker' property='page_no' value='
    <%searchActionForm.getCurrentPage()%>'>
    with
    logic:equal name='searchSizeTracker' property='page_no' value='
    <%=searchActionForm.getCurrentPage()%>'>

  • Metadata for namespace '/WEB-INF/tld/struts-logic.tld' is not loaded

    hi all,
    I keep getting these kind of errors in JDeveloper for JSPs which have this included:
    Metadata for namespace '/WEB-INF/tld/struts-logic.tld' is not loaded.
    What should I do to resolve this error?

    I did exactly that, but since client I work for is using /tld subdirectory, everything is the same as below, only /tld is added after /WEB-INF:
    1.Copy the TLD file struts-logic.tld to the WEB-INF directory.
    2. In the web.xml add <taglib/> element
    <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
    </taglib>
    3. In the JSP add
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    struts libs have been added to the WEB-INF/lib directory too, but the problem persists.
    Maybe the reason is invalid ant build.xml file which is invoked from JDev when building project? In build.xml I found this part:
    <!--Set the classpath-->
    <path id="classpath">
    <fileset dir="${lib.dir}">
    <include name="**/*.jar" />
    <exclude name="xercesImpl.jar"/>
    </fileset>
    </path>
    Maybe I need to add this to the <path>:
    <fileset dir="${tld.dir}">
    <include name="**/*.tld" />
    </fileset>
    after defining the directory
    <property name="tld.dir" value="${web.dir}/WEB-INF/tld"/>
    But the thing is other developers are using the same build.xml file from their IDEs (Eclipse and IntelliJ) and nobody seem to have this problem?

  • How to COmpare two variable in BPEL

    Hi ,
    I have two compare two variable ( EIN field ) one from input variable of a BPEL process and other one the output variable of a invoke .
    My requiremet is like this :
    If the the value of both EIN field is same then I have to assign Name field of Invoke output parameter to Output variable of BPEL process .
    If the value doesn't match then i have to assign ' No Data Exist ' expression to Output variable of BPEL process .
    How can i do this .
    Please help me regarding this as early as possible .

    You can do this in a switch statement. Perform a comparision to check if the values are the same, if case is not important (because users will enter anything) wrap the code in a case expression, e.g. upper(user_date) = upper(file_data)
    What version of SOA Suite and JDev are you using. Make sure that these versions are in sync.
    cheers
    James

  • Nulling variables

    Hi developers!
    Today was a really hard day...a lot of works, programming...I was coding, and I took a class developed by someone at my work. This class has these lines below:
    Socket socket = new Socket();
    socket.close();
    socket = null; //<-- does this line make some difference?I wanted to delete this line of code, because for me garbage collector does everything for us. So, we don�t need to worry about setting variables to null. But, I have to be sure about my conclusions before do that. Besides, this code is not mine, so if I decide to change that, I�ll have to give explanations probably. So I decided to search in internet (using Google, of course, always). And I found a lot of interesting information about that. Well, at least for me these informations are very interesting, perhaps for some of you they are, too!
    This link shows that sometimes nulling variables can help the garbage collector.
    http://www.javaspecialists.co.za/archive/Issue060.html
    Other very interesting use of nulling variables:
    http://www.glenmccl.com/perfj_010.htm
    Would it be just a superstition?
    http://bossavit.com/thoughts/archives/000776.html
    The "superstition" part is that setting the connection to null can have absolutely no useful effect; being a local variable, "conn" will become eligible for garbage collection as soon as it goes out of scope anyway, which the most rudimentary analysis of flow control reveals it will immediately after being set to null.
    The next link is a interesting suggestion of improvement in finally block.
    http://yost.com/computers/java/finally-throwable-2005-01-10.html
    About all these reading, I decided not change anything of that code yet. LOL!!!!!!!

    socket.close();
    socket = null; //<-- does this line make some
    difference?In many situations I have encountered this strange thing quite often. It hardly has any effect on the GC, if it does have any. It seems to belong to a league of programmers who like to be explicit with their code. ;)

  • Preprocessor command, assigned the variable and then compare the variable to int. How can I get around this?

    #define ON 1
    #define OFF 0
    in seperate code
    int variable = ON;
    variable is globally define for that module.
    in seperate code
    if (variable == ON)
    the complier errors off on the if (variable==ON)
    My guess variable is variable in of type int and ON is a preprocessor command. Therefore it is a mismatch and complier doesn't like it. How can I get around this.
    thank
    Mahen

    Mahen
    What is the exact message of the compiler?
    I think the error is, that the compiler does not find the definition of ON
    and OFF. Is it in the same source file?
    If not, try to put it into an .h file and include it where you need it.
    Stephan
    "Mahen" schrieb im Newsbeitrag
    news:[email protected]..
    > Preprocessor command, assigned the variable and then compare the
    > variable to int.
    >
    > How can I get around this?
    >
    > #define ON 1
    > #define OFF 0
    > in seperate code
    >
    > int variable = ON;
    > variable is globally define for that module.
    > in seperate code
    > if (variable == ON)
    > {
    >
    >
    > }
    >
    > the complier errors off on the if (variable==ON)
    > My guess variable is variable in of type int and ON is a preprocessor
    > c
    ommand. Therefore it is a mismatch and complier doesn't like it. How
    > can I get around this.
    > thank
    > Mahen

  • Using Strut Logic Iterate tag in JavaScript

    Has anyone tried this or experienced this problem.
    I have JSP pages with JavaScript imbedded. Not my web page but an out of the box portal we bought from a vendor. The JavaScript uses the Logic Iterate Strut tag but gives an error in Nitro:
    "feature is not resolved" on the lines where getLink() and getID() are called. I have put the code in other editors and it does not give me any error. Does any one have a clue to why this error occurs or is this something that NitroX can not handle?
    Thanks,
    Zim 8)
    Some of Code:
    function selectFolder(folderName,doExpandPath)
                        if (typeof(doExpandPath) == 'undefined')
                             doExpandPath = true;
                        var form = document.forms['TreeForm'];
                        // unselect old one
                        var cell = document.getElementById(selectedId);
                        if (null != cell)
                             cell.className = '';
                        // select new one
                        if ('/' == folderName.charAt(folderName.length-1))
                             folderName = folderName.substring(0,folderName.length-1);
                        var targetCellId = 'cellLabel./Documents'+folderName;
                        var isContentFolderBrowser = true;
                        try {
                             var sideBarSelected = top.frames['main'].window.sideBarSelected;
                             isContentFolderBrowser = '/getfolderitems.do' == sideBarSelected;
                             if (!isContentFolderBrowser) {
                             <logic:iterate id="feature" name="userinfobean" property="sideBarFeatures"
                                       type="com.actuate.activeportal.functionality.config.Feature">
                                       if (sideBarSelected == '<%= feature.getLink()%>' )
                                            targetCellId = 'cellLabel./<%= feature.getID()%>';
                                  </logic:iterate>
                        } catch (e) {
                        cell = document.getElementById(targetCellId);

    May I ask why have you done it?
    If it is related to printing of the list then it is of no use.But it IS of use. The objects compEmployees is in scope.
    It has the list we want to print out.
    With logic:iterate:
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <logic:iterate name="compEmployees" property="totalEmps" id="emp">
              <tr>
                <td>
                  <bean:write name="emp" property="empNo"/>
                </td>
                <td>
                  <bean:write name="emp" property="empName"/>
                </td>
              </tr>
         </logic:iterate>
    </table>or alternatively with JSTL and c:forEach
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <c:forEach items="${compEmployees.totalEmps}" var="emp">
              <tr>
                <td>
                  <c:out value="${emp.empNo}"/>
                </td>
                <td>
                  <c:out value="${emp.empName}"/>
                </td>
              </tr>
         </c:forEach>
    </table>Cheers,
    evnafets

  • Struts action forward is NULL

    Hi,
    I have a Index jsp page. Ihave defined IndexAction as action class for this. I have defined it as <welcome-file> in web.xml.
    Also I have action tab in struts-config file:
    <action path="/index" type="com.cec.cll.webclient.logical.clr.actionclass.IndexAction" scope="request" validate="false">
    < forward name="index" path="/index.jsp"/> </action>
    So when I open my application and this jsp page, it goes to action class and fetch the results from database but when action class return the forward, its coming NULL.
    forward = mapping.findForward("index");
    I could not find why it is not getting mapping for index . Any ideas?

    Action class:
         public ActionForward execute(ActionMapping mapping,
                   ActionForm form,
                   HttpServletRequest request,
                   HttpServletResponse response) throws Exception {
              HttpSession session = request.getSession(true);
              List searchList = null;
              ActionForward forward = null;
              try {
                   searchList = RingUtilizationHelper
                   .getGigERingUtilizationForRing(null);
              logger.info("inside Index Action...ends");
                   // sort the result
                   List orderedUList = sortResult(searchList);
                   session.setAttribute("results", orderedUList);
                   forward = mapping.findForward("index");
              } catch (Exception ex) {
                   logger.debug("execute: exception : ", ex);
              logger.info("inside Index Action...forward :"+forward);
              return forward;
         }

  • OBIEE 10g - Can I use logical SQL to set variable?

    I am trying to set value of a session variable in the Advanced tab Prefix box of a request.
    Assigment of absolute value like this is working good:
    SET VARIABLE MYVAR=1;
    Can I set the variable using logical SQL? Something like:
    SET VARIABLE MYVAR = (SELECT table1.col1 from catname where table1.col2=1)
    Thanks in advance.

    Hi,
    You can create a session variable or dynamic variable in the RPD and try using it in here at the Advanced Tab prefix.
    But still check yourself if you need multiple values returning in the SQL statement.
    Hope this is helpful/ useful.
    Regards
    MuRam

  • Struts logical path problem

    HI,
    I am using struts in my web application deployed on OC4J server.
    I am hitting a problem that the "sub page" gets incorrect url.The details are as follows:
    in my struts config the mapping is defined as :
    1) "parent.do" is mapped to /WEB-INF/mypages/parent.jsp
    2)"child.do" is mapped to /WEB-INF/mypages/child.jsp
    My page "parent.jsp" contains two frames one having some a page with static images and the other frame having the src as "child.do"
    Now if I invoke the http://myserver/myapp/parent.do
    the first frame loads correctly while for second it throws an error 404 that "http://myserver/myapp/WEB-INF/mypages/child.do" not found.
    It seems to me that that the subpage does not get the correct information about the context.
    Any suggestions will be greatly appreciated.
    Regards.

    When you are not in development, you can assign a different physical path to the same logical path in your staging system via the file transaction. As long as you use the logical path name in your code, it will be interpreted correctly with the setup in the system.

Maybe you are looking for

  • Payment program Customizing steps(for the program RFFOUS_T )

    Hello all, we are planing to generate ACH file for the Remitanace advice, when we run the payment program( F111 - to pay payment orders) I dont know the required customizing that i need to do in FBZP, to get ACH file when we generate payments for a s

  • Controlling resolution on dual monitor configurations

    We have a situation where we use a screen capture process that is having trouble when someone plugs in a dual monitor to a Macbook (Air, I think, but it applies elsewhere). The resolution on the external monitor ends up being higher than our screen c

  • Micro with M

    My brother loves my Micro (as do I) and wants to pick one up. But I am also about to buy him a new Mac mini for his college duties (I feel bad for giving him my old, old, old Celeron ) and I realized that the Micro only works with Windows. Is there a

  • ORA-1142 in alert log file

    hello everybody, I am getting the following ORA error in my Alert Log file......... alter tablespace SYSTEM end backup Sun Apr 13 01:42:58 2008 ORA-1142 signalled during: alter tablespace SYSTEM end backup.. what is this error??

  • Yet another "MacBook Air vs. Pro" question, now with specifics!

    I'm upgrading from an older Mac Mini 2GB purchased in '08.  I've looked at some recent comparicson threads here, but help me clarify my thinking for my specific situation... I'm strongly considering the 13" MacBook Air. Aside from Web surfing and ema