On Sat, Apr 16, 2011 at 9:58 AM, Stéphane NICOLAS
<[email protected]>wrote:

> Hello all,
>
> it's been some times since I used click and it looks like I lost good
> habits . :)
>
> I am actually building an application that uses two classes Person and
> Workshop
> I could build a pretty user interface to CRUD those classes, everything
> works fine.
>
> Now, I want People to book workshops from a public web page.
> So basically I want to propose the users all workshops available (i thought
> doing that with a Edit-Table Pattern)
> and I want the user to check, in the table, the workshops they are
> interested in. And later get all clicked (selected) workshops and build a
> list out of that, and associate this list to a Person.
>
> This seems a common use case[1] and I - as Stéphane - don't know how to
implement  this pattern in click.
I know that all selected checkboxes will be converted to []String, for
examples:
<quote>

String[] vals = request.getParameterValues("checkbox");

</quote>
Thinking about it, we need something like a table which all rows are
enclosed in one form, like this example:
<quote>

   1.   <form action="AddToCart" method="post">
   2.             <table  border="1">
   3.                 <tr>
   4.                     <th>
   5.                         Select
   6.                     </th>
   7.                     <th>
   8.                         Product Code:
   9.                     </th>
   10.                     <th>
   11.                         Product Name:
   12.                     </th>
   13.                     <th>
   14.                         Product Quantity:
   15.                     </th>
   16.                 </tr>
   17.                 <%
   18.             ProductsDAO daoObj = new ProductsDAO();
   19.             ArrayList list = daoObj.getProducts();
   20.
   21.                 %>
   22.                 <p:forEach items="${list}" var="product">
   23.                     <tr>
   24.                         <td>
   25.                             <input type="checkbox" name="chec1k">
   26.                         </td>
   27.                         <td>
   28.                             <p:out value="${product.pcode}"
   ></p:out>
   29.
   30.                         </td>
   31.
   32.                         <td>
   33.                             <p:out value="${product.pname}"
   ></p:out>
   34.                         </td>
   35.
   36.                         <td>
   37.                             <p:out value="${product.qty}"></p:out>
   38.                         </td>
   39.                     </tr>
   40.                 </p:forEach>
   41.                 <input type="submit" value="Add To Cart">
   42.             </table>
   43.         </form>


</quote>

How could we build something like that with Click?

Regards,

Gilberto

[1]http://dl.dropbox.com/u/9093640/tela_01_vinculao.png

Reply via email to