tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Bayern <bay...@essentially.net>
Subject Re: is there a better way to do this without JSP Script var
Date Fri, 02 Aug 2002 20:31:25 GMT
No problem!  Glad to hear it works,

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com

On Fri, 2 Aug 2002, Dave Anand wrote:

> Nevermind, it was my stupid mistake
> 
> >      </c:>
> 
> this never ever gave me an error,  eveything was blank after that.
> 
> fixing this, fixed my problem, now the
> code:
> 
>     QUESTION_TYPE:[<c:out value="${rs.QUESTION_TYPE}"/>] <br>
>       <c:if test="${rs.QUESTION_TYPE == '2'}">
>         <c:out value="checkBox"/> <br>
>     </c:if>
> 
> output:
> 
> QUESTION_TYPE:[2]
> checkBox
> 
> I am real sorry about this, to wast your time.
> Thanks Again,
> 
> Dave
> ----- Original Message -----
> From: "Dave Anand" <anand@columbus.rr.com>
> To: "Tag Libraries Users List" <taglibs-user@jakarta.apache.org>
> Cc: "Tag Libraries Users List" <taglibs-user@jakarta.apache.org>
> Sent: Friday, August 02, 2002 3:06 PM
> Subject: Re: is there a better way to do this without JSP Script var
> 
> 
> > Again this is the code:
> >       QUESTION_TYPE:[<c:out value="${rs.QUESTION_TYPE}"/>]
> >       <c:if test="${rs.QUESTION_TYPE == '2'}>
> >         <c:out value="checkbox"/>
> >      </c:>
> >
> > This is the Output:
> >
> > QUESTION_TYPE:[2]
> >
> >
> > ----- Original Message -----
> > From: "Shawn Bayern" <bayern@essentially.net>
> > To: "Dave Anand" <anand@columbus.rr.com>
> > Cc: "Tag Libraries Users List" <taglibs-user@jakarta.apache.org>
> > Sent: Friday, August 02, 2002 2:56 PM
> > Subject: Re: is there a better way to do this without JSP Script var
> >
> >
> > > And
> > >
> > >  <c:if test="${rs.QUESTION_TYPE == '2'}> ... </c:if>
> > >
> > > indicates the expression is false?
> > >
> > > --
> > > Shawn Bayern
> > > "JSTL in Action"   http://www.jstlbook.com
> > >
> > > On Fri, 2 Aug 2002, Dave Anand wrote:
> > >
> > > > ok here is the actual code in my jsp -> QUESTION_TYPE:[<c:out
> > > > value="${rs.QUESTION_TYPE}"/>]
> > > >
> > > > the output -> QUESTION_TYPE:[2]
> > > > ----- Original Message -----
> > > > From: "Shawn Bayern" <bayern@essentially.net>
> > > > To: "Dave Anand" <anand@columbus.rr.com>
> > > > Cc: "Tag Libraries Users List" <taglibs-user@jakarta.apache.org>
> > > > Sent: Friday, August 02, 2002 2:34 PM
> > > > Subject: Re: is there a better way to do this without JSP Script var
> > > >
> > > >
> > > > > 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" <bayern@essentially.net>
> > > > > > To: "Dave Anand" <anand@columbus.rr.com>
> > > > > > Cc: "Tag Libraries Users List" <taglibs-user@jakarta.apache.org>
> > > > > > 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" <bayern@essentially.net>
> > > > > > > > To: "Dave Anand" <anand@columbus.rr.com>
> > > > > > > > Cc: "Tag Libraries Users List"
> <taglibs-user@jakarta.apache.org>
> > > > > > > > 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:taglibs-user-unsubscribe@jakarta.apache.org>
> > > > > > > > > For additional commands, e-mail:
> > > > > > > > <mailto:taglibs-user-help@jakarta.apache.org>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <mailto:taglibs-user-help@jakarta.apache.org>
> > >
> > >
> >
> 


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message