tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Holmes Jr." <...@tomholmes.net>
Subject Re: combining tags
Date Wed, 06 Jul 2005 16:29:26 GMT
Wendy Smoak wrote:

>From: "Tom Holmes Jr." <tom@tomholmes.net>
>
>  
>
>>I'd like to switch to something likes this:
>><c:forEach items="${SelectedRoomsForm.roomsList}" var="data"
>>varStatus="status">
>>        <html:checkbox name="data" property="checkedRes" indexed="true"/>
>>        <c:out value="${data.roomType}"/>
>>       <html:text name="data" property="numItems" indexed="true"
>>style="width:40"/>
>></c:forEach>
>>
>>The <c:out> tag I am sure works, but I am not sure about the
>><html:checkbox> or the <html:text>
>>
>>Does this code look ok, or is there something I have to change?
>>    
>>
>
>Assuming you're not on a JSP 2.0 container (I assume not, or you wouldn't be
>using <c:out>) you might want to switch to the Struts-EL tags instead of the
>'classic' taglib.  With the ability to use expressions in the JSTL tags,
>you'll quickly get frustrated at NOT being able to do it in the Struts tags.
>
>Indexed tags are now supported within <c:forEach> loops, according to the
>README.txt file included with Struts-EL.  To switch over, look in the
>'contrib' directory of the Struts 1.2.7 distribution, get the .jar files and
>change to:
>     <%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html-el"
>%>
>(Some people leave the prefix as 'html'.)
>
>All my checkboxes-within-forEach-loops are 'multibox' not 'checkbox'.  But I
>don't use indexed properties, so YMMV.
>
>  
>
I have no idea if it is a JSP Container 2.0 or not.  I can tell you that 
we are using IBM Websphere 5.1.x Portal Server.   I can also tell you 
that the the imports we are using in our JSP pages look like:
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>

And we are using Struts.   My boss has told me at one point that he'd 
wanted to start using JSTL tags more then the older JSP Tag Libraries.  
To me, that means using more of the <c:?> tags, but we still need to use 
html:? tags.  To my boss, that would mean getting more functionality and 
using expressions as you stated.  For example, rather than writing:

 <bean:write name="iter" property="selectedStartDate1"/> -
  <bean:write name="iter" property="selectedEndDate1"/><br>

Instead we could do:
<c:out value="${data.selectedStartDate1} - ${data.selectedEndDate1}" />

Doesn't that seem easier to understand?  I just figured we'd get the 
same results when we submit the form.  When using <logic:iterate> I 
understand how we can do <c:out> just fine.  And it works fine with 
html:text, but it's when we do <c:if test=""> something that I was 
getting into trouble.  It didn't seem to work?

As Rahul stated, I'll check the generated HTML source and I'll also 
check the Action class to see if the data submitted is the same.

Thanks for the help.

                                               Tom

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


Mime
View raw message