Right, but does it output '1', or '1 ' or something else? '1 ' isn't equal to '1'. Even if rs.question_type is an arbitrary object, it will be converted to a String via a call to toString() automatically. (You're comparing it to a String, not a number; conversion of arbitrary objects to numbers will fail, but String is useful as a mediator.)
-- Shawn Bayern "JSTL in Action" http://www.jstlbook.com On Fri, 2 Aug 2002, Dave Anand wrote: > it outputs 1 > > I think it has to do the fact 'rs.question_type' the type is an object. > > In the older version of JSTL, I have do some thing like this > > <c:if test="$rs.get('question_type').toString().equals(temp.toString())"> > > > ----- Original Message ----- > From: "Shawn Bayern" <[EMAIL PROTECTED]> > To: "Dave Anand" <[EMAIL PROTECTED]> > Cc: "Tag Libraries Users List" <[EMAIL PROTECTED]> > Sent: Friday, August 02, 2002 2:06 PM > Subject: Re: is there a better way to do this without JSP Script var > > > > What does > > > > '<c:out value="${rs.question_type}" />' > > > > output? (The outer quotes are there to make spaces more noticeable.) > > > > -- > > Shawn Bayern > > "JSTL in Action" http://www.jstlbook.com > > > > On Fri, 2 Aug 2002, Dave Anand wrote: > > > > > Thanks for Responding; Well I did something like this, But the test > always > > > gave me false > > > > > > <c:forEach var="rs" items="${question.rows}"> > > > <c:if test="${rs.question_type== '1'}"> > > > <c:set var="controlType" value="radio" /> > > > </c:if> > > > > > > <c:if test="${rs.question_type=='2'}"> > > > <c:set var="controlType" value="checkbox" /> > > > </c:if> > > > </c:forEach> > > > > > > ----- Original Message ----- > > > From: "Shawn Bayern" <[EMAIL PROTECTED]> > > > To: "Dave Anand" <[EMAIL PROTECTED]> > > > Cc: "Tag Libraries Users List" <[EMAIL PROTECTED]> > > > Sent: Friday, August 02, 2002 1:46 PM > > > Subject: Re: is there a better way to do this without JSP Script var > > > > > > > > > > On Fri, 2 Aug 2002, Dave Anand wrote: > > > > > > > > > Is there a better way to do this without JSP Script var > > > > > > > > > > <c:forEach var="rs" items="${question.rows}"> > > > > > <c:set var="qType" value="${rs.QUESTION_TYPE}" /> > > > > > <% String sqType = pageContext.getAttribute("qType").toString(); > > > %><br> > > > > > > > > > > <%if (sqType.equals("1")) { %> > > > > > <c:set var="controlType" value="radio" /> > > > > > <%} else if (sqType.equals("2")) {%> > > > > > <c:set var="controlType" value="checkbox" /> > > > > > <%} else if (sqType.equals("2")) {%> > > > > > <c:set var="controlType" value="select" /> > > > > > <c:out value=" <select> "/> > > > > > <%} %> > > > > > > > > > > </c:forEach> > > > > > > > > The following should work: > > > > > > > > <c:forEach var="Rs" items="${questions.rows}"> > > > > <c:set var="qType" value="${rs.question_type}" /> > > > > <c:choose> > > > > <c:when test="${qType == 1}"> > > > > ... > > > > > > > > and so forth. > > > > > > > > -- > > > > Shawn Bayern > > > > "JSTL in Action" http://www.jstlbook.com > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: > > > <mailto:[EMAIL PROTECTED]> > > > > For additional commands, e-mail: > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
