Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Checkboxes

Checkboxes

2007-12-03       - By Dave Newton

 Back
Reply:     1     2     3  

Oh, that's clever, I don't think I would have thought
of that, and it's a lot quicker than my ideas ;)

d.

--- "Hoying, Ken" <Ken_Hoying@(protected)> wrote:

> Thanks, Dave!
>
> This got me moving in the right direction.  For
> future reference, I
> ended using the checkboxlist tag inside of my loop
> and set the list
> attribute to a single value so I would only get the
> one option.  This
> seems to have solved my issue.
>
> Thanks,
> Ken
>
> -- --Original Message-- --
> From: Dave Newton [mailto:newton.dave@(protected)]
> Sent: Friday, November 30, 2007 6:06 PM
> To: Struts Users Mailing List
> Subject: RE: [S2] Checkboxes
>
> A single checkbox, AFAIK, only expects to check a
> single value, not an
> array or collection.
>
> I would consider using a modified version of the
> checkboxlist tag if
> it's just a matter of the rendered HTML you're
> having an issue with.
>
> d.
>
> --- "Hoying, Ken" <Ken_Hoying@(protected)> wrote:
>
> > Thank you for the response.
> >
> > I had looked at the example, but it really appears
> to only push the
> > checkbox results to the action.  I am not sure
> that it would
> > repopulate the checkbox with the values.
> >
> > I do not believe that checkbox list is going to
> work for me as it does
>
> > not give me control on where to put the
> checkboxes.
> > I need one in each
> > row.
> >
> > It appears that my understanding of how the
> checkbox works is not
> > correct.
> >
> > I am expecting that the checkbox control will call
> the
> > getSelectedContracts() method and see if any of
> these values in the
> > array it returns matches the value specified in
> the fieldValue
> > attribute specified in the checkbox tag.  If there
> is a match then
> > check the box, if not don't check it.  However,
> all of my checkboxes
> > are always being selected no matter what.
> >
> > I am also expecting that when submitting the form,
> > setSelectedContracts() will be called with an
> array of the values that
>
> > were selected.  This does appear to be working
> with one caveat. If
> > nothing is selected then I get the error: Invalid
> field value for
> > field "selectedContracts".
> >
> > This obviously does not work the way I thought and
> I was hoping
> > someone could maybe explain how it does work as I
> am really struggling
>
> > on gaining an understanding of this tag and its
> usage.
> >
> > Thanks in advance,
> > Ken
> >
> > -- --Original Message-- --
> > From: Martin Gainty [mailto:mgainty@(protected)]
> > Sent: Friday, November 30, 2007 11:09 AM
> > To: Struts Users Mailing List
> > Subject: Re: [S2] Checkboxes
> >
> > Hi Ken-
> >
> > struts.xml has this definition of EmployeeAction
> where results
> > populate editEmployee.jsp
> >         <action name="delete"
> >
>
class="org.apache.struts2.showcase.action.EmployeeAction"
> > method="delete">
> >             <result
> > name="error">/empmanager/editEmployee.jsp</result>
> >             <result
> >
>
type="redirect">edit-${currentEmployee.empId}.action</result>
> >         </action>
> >
> > looking at the results jsp
> > /empmanager/editEmployee.jsp has a checkbox
> defined as <s:checkbox
> > fieldValue="true" label="Married"
> > name="currentEmployee.married"/>
> >
> > The EmployeeAction is defined as
> > package org.apache.struts2.showcase.action;
> > public class EmployeeAction extends
> > AbstractCRUDAction implements
> > Preparable {  private Employee currentEmployee;
> >
> > whereas Employee is defined as
> > package org.apache.struts2.showcase.model;
> > public class Employee implements IdEntity {
> >     private boolean married; //checkbox
> >
> > so the individual checkbox works fine for setting
> booleans
> > http://struts.apache.org/2.0.11/docs/checkbox.html
> >
> > For handling a list of checkboxes you may want to
> implement with
> > checkboxlist?
> >
>
http://struts.apache.org/2.0.11/docs/checkboxlist.html
> >
> > M--
> > -- -- Original Message -- --
> > From: "Hoying, Ken" <Ken_Hoying@(protected)>
> > To: <user@(protected)>
> > Sent: Friday, November 30, 2007 8:45 AM
> > Subject: [S2] Checkboxes
> >
> >
> > I am having a difficult time getting checkboxes to
> work in the
> > following scenario and am not sure what I am doing
> wrong.  Any help or
>
> > guidance would be greatly appreciated.
> >
> > I have table which displays several rows.  In the
> first column of each
>
> > row, I have a check box to select that row.  I am
> keeping track of
> > user selections so when they return to the page,
> the checkboxes are
> > prepopulated with their previous selections.
> >
> >
> > My Action contains the following:
> >
> > public Long[] getSelectedContracts()
> > {
> > return setSelectedContracts.toArray(new Long[0]);
> }
> > // end
> > getSelectedContracts
> >
> > /**
> > * This setter takes the provided String[] of
> > selected contract ids.
> > */
> > public void setSelectedContracts(Long[]
> > palngSelectedContracts)
> >       {
> >
> >
>
setSelectedContracts.addAll(Arrays.asList(palngSelectedContracts));
> > } // end setSelectedContracts
> >
> > My JSP contains the following:
> >
> > <s:checkbox name="selectedContracts"
> > fieldValue="${contract.npcContractId}"/>
> >
> >
> >
> >
> >
> >
> > -- ---- ---- ---- ---- ---- ---- ---- ---
> > ***Note:The information contained in this message
> > may be privileged and
> > confidential and protected from disclosure. If the
> > reader of this
> > message is not the intended recipient, or an
> > employee or agent
> > responsible for delivering this message to the
> > intended recipient, you
> > are hereby notified that any dissemination,
> > distribution or copying of
>
=== message truncated ===


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.