I am working on a JSP written in JSTL and html-el
tags.  The JSP is displayed fine.

This JSP has a table.  Each row of the table has a
checkbox.  Clients may select any number of the
checkboxes and click on a link to invoke a Struts
action.

I would like to pass the checkbox and every column of
each row when the "link" is clicked.  What is the
proper way of doing that?  My code is shown below(and
also in the attachment:
[code]
...all the required taglib(s)
<%@ page
import=".................common.pojo.user.User" %>

<html:html>
<HEAD>
<link rel="stylesheet" type="text/css"
href="<html:rewrite page='/theme/Master.css'/>">
<TITLE>User Maintenance Home Page</TITLE>
</HEAD>

<BODY>
        <!-- Create a variable in scope called userRows from
the Users object -->
        <c:set var="userRows" value="${requestScope.Users}"
/>
        
        <c:choose>
                <c:when test="${not empty userRows}">
                        <table>
                                <!-- create a "user" object for each element in
the userRows -->                        
                                <c:forEach var="user" items="${userRows}"
varStatus="idx">
        
                                        <tr>
                                                                        <td 
align="center">
                                                                                
<html-el:checkbox
property="selectedUsers[${idx.index}].selected" />
                                                                                
<html-el:hidden
property="selectedUsers[${idx.index}].id"
value="${user.id}"/>
                                                                                
<html-el:hidden
property="selectedUsers[${idx.index}].firstName"
value="${user.firstName}"/>
                                                                                
<html-el:hidden
property="selectedUsers[${idx.index}].lastName"
value="${user.lastName}"/>
                                                                        </td>
                                                                        <td 
align="center">
                                                                                
<c:out value="${user.firstName}" />
                                                                        </td>
                                                                        <td 
align="center">
                                                                                
<c:out value="${user.lastName}" />
                                                                        </td>

                                        </tr>
                                </c:forEach>

                                <tr>
                                        <td colspan="6" align="left">
                                                <html:link
action="/admin/selectUsers.do">Edit Selected
Users</html:link>
                                        </td>
                                </tr>
                        </table>

                </c:when>
        
                <c:otherwise>
                        <center><H1>No User Found.</H1></center>
                </c:otherwise>
        </c:choose>
</body>
</html:html>
[/code]

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-html-el" prefix="html-el"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/core" prefix="c" %> 
<%@ taglib uri="/tags/targeting-foundation" prefix="ecustoms"%>
<%@ page import="java.util.List"%>
<%@ page import="gov.cbp.ace.st.tf.common.pojo.user.User" %>

<html:html>
<HEAD>
<link rel="stylesheet" type="text/css" href="<html:rewrite 
page='/theme/Master.css'/>">
<TITLE>User Maintenance Home Page</TITLE>
</HEAD>

<BODY>
<html-el:form action="/admin/findUsers.do"> 
        <table width="95%" border="0" align="center">
                <tr>
                        <td colspan="6" align="center">
                                <html-el:submit 
accesskey="S">Search</html-el:submit>
                        </td>
                </tr>
                <tr>
                        <td colspan="6" align="center">
                                <br>
                        </td>
                </tr>
        </table>

        <!-- Create a variable in scope called userRows from the Users object 
-->
        <c:set var="userRows" value="${requestScope.Users}" />
        
        <c:choose>
                <c:when test="${not empty userRows}">
                        <table width="95%" border="0" cellspacing="1" 
cellpadding="3" align="center" >
                                <tr>
                                        <td class="adminHeader"><span 
class="dataHeader">Select</span></td>
                                        <td class="adminHeader"><span 
class="dataHeader">Hash ID</span></td>
                                        <td class="adminHeader"><span 
class="dataHeader">First Name</span></td>
                                        <td class="adminHeader"><span 
class="dataHeader">Last Name</span></td>
                                        <td class="adminHeader"><span 
class="dataHeader">Creation Date</span></td>
                                        <td class="adminHeader"><span 
class="dataHeader">Modification Date</span></td>
                                </tr>
                        
                                <!-- create a "user" object for each element in 
the userRows -->                        
                                <c:forEach var="user" items="${userRows}" 
varStatus="idx">
        
                                        <c:choose>
                                                <c:when test="${( idx.count+1 
)%2==0}">
                                                        <tr 
class="contentCell1">
                                                </c:when>
                                                <c:otherwise>
                                                        <tr 
class="contentCell2">
                                                </c:otherwise>
                                        </c:choose>
                                                                        <td 
align="center">
                                                                                
<span class="dataContent">
                                                                                
                        <html-el:checkbox 
property="selectedUsers[${idx.index}].selected" />
                                                                                
                        <html-el:hidden 
property="selectedUsers[${idx.index}].id" value="${user.id}"/>
                                                                                
                        <html-el:hidden 
property="selectedUsers[${idx.index}].userIDCode" value="${user.userIDCode}"/>
                                                                                
                        <html-el:hidden 
property="selectedUsers[${idx.index}].createdByUserID" 
value="${user.createdByUserID}"/>
                                                                                
                        <html-el:hidden 
property="selectedUsers[${idx.index}].updatedByUserID" 
value="${user.updatedByUserID}"/>
                                                                                
                        <html-el:hidden 
property="selectedUsers[${idx.index}].firstName" value="${user.firstName}"/>
                                                                                
                        <html-el:hidden 
property="selectedUsers[${idx.index}].lastName" value="${user.lastName}"/>
                                                                                
                        <html-el:hidden 
property="selectedUsers[${idx.index}].createdDate" value="${user.createdDate}"/>
                                                                                
                        <html-el:hidden 
property="selectedUsers[${idx.index}].updatedDate" value="${user.updatedDate}"/>
                                                                                
</span>
                                                                        </td>
                                                        <c:choose>      
                                                                <c:when 
test="${not empty user.createdByUserID}">
                                                                        <td 
align="center"><span class="dataContent"><c:out value="${user.createdByUserID}" 
/></span></td>
                                                                </c:when>
                                                                <c:otherwise>
                                                                        <td 
align="center"><span class="dataContent"></span></td>
                                                                </c:otherwise>
                                                        </c:choose>
                                                        <c:choose>
                                                                <c:when 
test="${not empty user.firstName}">
                                                                        <td 
align="center"><span class="dataContent"><c:out value="${user.firstName}" 
/></span></td>
                                                                </c:when>
                                                                <c:otherwise>
                                                                        <td 
align="center"><span class="dataContent"></span></td>
                                                                </c:otherwise>
                                                        </c:choose>
                                                        <c:choose>
                                                                <c:when 
test="${not empty user.lastName}">
                                                                        <td 
align="center"><span class="dataContent"><c:out value="${user.lastName}" 
/></span></td>
                                                                </c:when>
                                                                <c:otherwise>
                                                                        <td 
align="center"><span class="dataContent"></span></td>
                                                                </c:otherwise>
                                                        </c:choose>
                                                        <c:choose>
                                                                <c:when 
test="${not empty user.createdDate}">
                                                                        <td 
align="center"><span class="dataContent"><c:out value="${user.createdDate}" 
/></span></td>
                                                                </c:when>
                                                                <c:otherwise>
                                                                        <td 
align="center"><span class="dataContent"></span></td>
                                                                </c:otherwise>
                                                        </c:choose>
                                                        <c:choose>
                                                                <c:when 
test="${not empty user.updatedDate}">
                                                                        <td 
align="center"><span class="dataContent"><c:out value="${user.updatedDate}" 
/></span></td>
                                                                </c:when>
                                                                <c:otherwise>
                                                                        <td 
align="center"><span class="dataContent"></span></td>
                                                                </c:otherwise>
                                                        </c:choose>
                                                        </tr>
                                </c:forEach>

                                <tr>
                                        <td colspan="6">
                                                <br>
                                        </td>
                                </tr>
                                <tr>
                                        <td colspan="6" align="left">
                                                <html:link 
action="/admin/selectUsers.do">Edit Selected Users</html:link>
                                        </td>
                                </tr>
                        </table>

                        <br>
                        <br>
                        <!-- Pagination -->
                        <center><ecustoms:pagenav 
hrefName="pagenavHref"/></center>

                </c:when>
        
                <c:otherwise>
                        <center><H1>No User Found.</H1></center>
                </c:otherwise>
        </c:choose>

</html-el:form>

</body>
</html:html>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to