Search code examples
javajspstruts

struts 1.0 logic tag choice - if/else logic


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 %>" >

Solution

  •   <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" %>