struts 1.0 logic tag choice - if/else logic

20,160
  <c:choose>
     <c:when test="${the number}">
         Both are equal.
     </c:when>
     <c:otherwise>
         Both are not equal.
     </c:otherwise>
     </c:choose>

this is jstl tag

you need to use
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Share:
20,160
bouncingHippo
Author by

bouncingHippo

where code bounces off me - literally!

Updated on March 28, 2020

Comments

  • bouncingHippo
    bouncingHippo about 4 years

    What I have is a dropdown list. When the user selects a certain option, where each option represents a specific String on the Java server side.

    Right now, the Java server side able to check which option is selected, and the number to correspond. At the moment, I am able to output the value in Java backend, not on the JSP page.

    Is there an if/else tag for Struts 1.0?

    I am not sure which logic tag is the best to pass a Java value for frontend processing:

    JSP page

    if(value = 666)
       this textbox is readonly
    else
      this textbox row is active
    

    My research so far:

    Looking at logic:equal, it seems to pass a value on the JSP page using taglibs like below. This doesn't work for me, because I want to pass the value FROM a Java class on the server side.

    <logic:equal name="name" property="name" value="<%= theNumber %>" >
    
  • bouncingHippo
    bouncingHippo about 11 years
    is ${the number} jQuery? would you have a javascript version?
  • PSR
    PSR about 11 years
    no it is action variable.we are using in struts2 like this.this might work in struts1.0 as well
  • Dave Newton
    Dave Newton about 11 years
    @bouncingHippo jQuery?! It's standard JSP EL notation.