RE: Proper place for validation

2004-09-09 Thread Janne Mattila
I guess this is heading more towards the direction of general exception 
handling and less struts-specific matters now...

The problem I have with that is, that with most applications I have been 
involved with, exceptions that get passed all the way up (meaning they are 
not caught somewhere in between by some business class that does some 
reactive operation) all result in fundamentally same consequences. 
Transaction gets rolled back, error page is shown, and an error message is 
shown to the user. The only difference between each type of exception is the 
error message shown.

For this purpose only, for differentiating between different messages to 
user, it feels silly to implement horders of different exception classes. In 
a big project you get lots and lots of those, and I don't really see the 
benefits that they bring. What I have usually done, is implement one generic 
exception class, and provide exception message with constructor. As in (in 
some business class, ie. User)

 1)
 if (alreadyExists(email)) {
throw new MyAppException(E-mail address already exists);
_if_ the exception results in some other consequence than error message 
being shown
(for example,
EmailService.do() {
  try {
  createUser()
  } catch (EmailExistsException e) {
  email = createRandomEmail();
  createUser()
  } - or something like that
)
then I have created a special exception class for that. Those cases are 
usually a small minority, something like 5% of cases. You mentioned the 
DAOException, and other similar ones. Those I have found to be useful. But 
exceptions that result from breaking some business logic rule / invariant - 
usually there's no sense in defining specific exceptions for those. In my 
opinion.

Of course, you create a coupling between presentation layer and business 
classes with that. It can be avoided with some techniques (like throw new 
MyAppException(Exceptions.get(Exceptions.EMAIL_EXISTS))).

I am fully aware that this is probably not the accepted way of doing this. 
All advice seems to say to create specific exception classes for your 
applications exceptions. I have just never really understood what benefit it 
_really_ brings. It would be nice to see the light though, so I would not 
have to be such a heretic anymore :)


From: Jim Barrows [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: RE: Proper place for validation
Date: Wed, 8 Sep 2004 08:52:05 -0700

 -Original Message-
 From: Janne Mattila [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 08, 2004 3:49 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Proper place for validation


 Hmm, not a lot of comments on this. I guess there is a
 consensus on the
 matter (that, or no-one really gives a damn).

 A quick followup on this; how could I achieve both

 a) decoupling of my business classes from Struts
 b) internationalization

 if I validate in my business class?

 1)
 if (alreadyExists(email)) {
throw new MyAppException(E-mail address already exists);

 achieves a) but not b), and

 2)
 if (alreadyExists(email)) {
throw new MyAppException(errors.email.duplicate);
Simple, you throw EmailAlreadyExists( email), and catch that, or use the 
exception handling ability of struts to give an appropriate error message 
to the user.  For system level stuff (ie DB is missing etc) you inlcude a 
cause, but don't necessarily show it to the user.
_
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


RE: Proper place for validation

2004-09-08 Thread Janne Mattila
Hmm, not a lot of comments on this. I guess there is a consensus on the 
matter (that, or no-one really gives a damn).

A quick followup on this; how could I achieve both
a) decoupling of my business classes from Struts
b) internationalization
if I validate in my business class?
1)
if (alreadyExists(email)) {
  throw new MyAppException(E-mail address already exists);
achieves a) but not b), and
2)
if (alreadyExists(email)) {
  throw new MyAppException(errors.email.duplicate);
achieves b) but not a)

From: Robert Taylor [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: RE: Proper place for validation
Date: Tue, 7 Sep 2004 08:21:09 -0400


From: Robert Taylor [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: RE: Proper place for validation
Date: Tue, 7 Sep 2004 08:21:09 -0400
I would avoid putting any business logic in the action
class. Place this type of logic in the business class as it
most likely is validation that is valid across all application
logic and not for just one use case.
robert
 -Original Message-
 From: Janne Mattila [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 07, 2004 8:15 AM
 To: [EMAIL PROTECTED]
 Subject: Proper place for validation


 I am wondering what would be the propert place for some validation code.
 Let's say I have a registration page where user inputs his/her 
information
 for a new user account. There's a field for e-mail address. On one level
 that information is validated on the ActionForm, for things such as

 - field is not left empty, if it is required
 - field is a valid e-mail address

 That much seems quite clear. But where should I put a check that ensures
 that same e-mail address is not already used by an existing account?

 On the other hand, I could put it in the registration action, because
 checking that is (kind of) user-input validation, and action is a 
natural
 place to do this.

 On the other hand, I could put it in my business class. The pros for 
this
 would be smaller and simpler action code, and reuse if same check is 
needed
 with different actions.

 Any suggestions? Intuitively, I think I would put that check in the 
Action,
 but I am happy to hear any arguments in favor or opposing that.

 _
 STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
 http://join.msn.com/?page=features/junkmail


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



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


Proper place for validation

2004-09-07 Thread Janne Mattila
I am wondering what would be the propert place for some validation code. 
Let's say I have a registration page where user inputs his/her information 
for a new user account. There's a field for e-mail address. On one level 
that information is validated on the ActionForm, for things such as

- field is not left empty, if it is required
- field is a valid e-mail address
That much seems quite clear. But where should I put a check that ensures 
that same e-mail address is not already used by an existing account?

On the other hand, I could put it in the registration action, because 
checking that is (kind of) user-input validation, and action is a natural 
place to do this.

On the other hand, I could put it in my business class. The pros for this 
would be smaller and simpler action code, and reuse if same check is needed 
with different actions.

Any suggestions? Intuitively, I think I would put that check in the Action, 
but I am happy to hear any arguments in favor or opposing that.

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail

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


Re: Struts bean property capitalization - minor problem

2004-09-03 Thread Janne Mattila
Reading the specification clarified how things work, thank you. It's much 
nicer to know the reason why things happen than just what immediate fix 
would solve the problem. It seems that if bean.getEMail() is a given, JSP 
page has to have

html:text property=EMail/
in order to work.
Actually, I do not think getEMail() method breaks any conventions. The 
reason property=eMail does not work is because to support the occasional 
use of all upper-case names, property name is not modified if first two 
characters are upper case. It seems to me that there is a fix for 
properties that break the naming convention (all upper case), but that fix 
breaks some cases that actually follow the naming convention (eMail). At 
least I did not see a rule that forbids a property name having the first 
word being only one character (is there one? I did not read much else 
besides chapters 8.3 and 8.8...).

Don't worry, I'm not going to use bean.getEMail() :)
From: Craig McClanahan [EMAIL PROTECTED]
Reply-To: Craig McClanahan [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: Struts  bean property capitalization - minor problem
Date: Thu, 2 Sep 2004 20:48:39 -0700
On Thu, 02 Sep 2004 14:07:37 +, Janne Mattila
[EMAIL PROTECTED] wrote:
 -formBean method getEeMail() and html:text size=30 maxlength=120
 property=eeMail/ = works
 -formBean method getEmail() and html:text size=30 maxlength=120
 property=email/ =works
 - formBean method getEMail() and html:text size=30 maxlength=120
 property=eMail/ =

 = org.apache.jasper.JasperException: No getter method for property 
eMail of
 bean org.apache.struts.taglib.html.BEAN

 I don't know what method struts tries to find. Eclipse creates getter as
 getEMail() when I name a property eMail. I think getEMail() is just 
fine
 getter for variable eMail. (of course, one could argue whether 
variable
 name should be email instead, but lets not go there)

 I am using 1.1, would a later release solve this?


Using a later release won't change anything, because the
commons-beanutils code that Struts uses under the covers requires you
to either follow the property naming conventions in the JavaBeans spec
(http://java.sun.com/products/javabeans/docs/spec.html), or provide
BeanInfo classes to tell the server what your property getter and
setter methods really are.  Property names like eMail break the
conventions, and are thus not recognized.  See the spec for more
details on all of this.
Craig
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


Height and width missing from html:image

2004-09-02 Thread Janne Mattila
Damn, why no width and height attributes for html:image? Disappointing.
_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

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


RE: Height and width missing from html:image

2004-09-02 Thread Janne Mattila
No, I am indeed rendering a input type=image .../ tag. I am converting a 
non-struts application
to struts and the original JSP has width and height attributes for the tag. 
But indeed, it seems that according to HTML specification those attributes 
do not exist. I wonder why not, as img tag does have them?


From: Robert Taylor [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: RE: Height and width missing from html:image
Date: Thu, 2 Sep 2004 07:31:33 -0400
If you are using it to render an img .../ then use
html:img .../ which should have the appropriate attributes.
The html:image .../ is for rendering input type=image .../
which does not have the height and width attributes.
robert
 -Original Message-
 From: Janne Mattila [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 02, 2004 7:23 AM
 To: [EMAIL PROTECTED]
 Subject: Height and width missing from html:image


 Damn, why no width and height attributes for html:image? Disappointing.

 _
 MSN 8 with e-mail virus protection service: 2 months FREE*
 http://join.msn.com/?page=features/virus


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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


Struts bean property capitalization - minor problem

2004-09-02 Thread Janne Mattila
-formBean method getEeMail() and html:text size=30 maxlength=120 
property=eeMail/ = works
-formBean method getEmail() and html:text size=30 maxlength=120 
property=email/ =works
- formBean method getEMail() and html:text size=30 maxlength=120 
property=eMail/ =

= org.apache.jasper.JasperException: No getter method for property eMail of 
bean org.apache.struts.taglib.html.BEAN

I don't know what method struts tries to find. Eclipse creates getter as 
getEMail() when I name a property eMail. I think getEMail() is just fine 
getter for variable eMail. (of course, one could argue whether variable 
name should be email instead, but lets not go there)

I am using 1.1, would a later release solve this?
_
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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


Re: AW: Design patterns used in Struts

2004-08-31 Thread Janne Mattila
Well, original poster asked the question for some reason. Who knows, maybe 
he has to give a presentation of Struts? I wouldn't like to embarrass myself 
by speaking of patterns that do not exist. Have a look at some random books 
on the subject, I'll bet they all talk about Model 1, Model 2, and MVC and 
none about MVC1 and MVC2. As does art of web development, by the way, at 
least according to the table of contents (I have not actually read that 
book). I think the reviewer was just confused. I am not sure whether MVC2 
has been said to be the XML extension of MVC1, can you please provide some 
links (or did you just pull that one out of your hat :) ?

The whole point of patterns is to create a common language for describing 
universal solutions. If you start to speak of MVC1 and MVC2 patterns, 
majority of people will not understand what you are talking about. That is 
why I care about precise nomenclature in this matter, and you should too...


From: Michael McGrady [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: AW: Design patterns used in Struts
Date: Mon, 30 Aug 2004 08:05:12 -0700
Janne Mattila wrote:
I think you have some confusion of terms there
MVC = a general (non-JSP specific) architectural Model-View-Controller 
pattern
Model1 and Model2 = models (or patterns) for implementing web applications 
with JSP technology. Model2 implements the MVC pattern.


From: Michael McGrady [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: AW: Design patterns used in Struts
Date: Mon, 30 Aug 2004 04:58:00 -0700
Rosenberg, Leon wrote:
Sorry,
but what is MVC2?
There is no such pattern by Gamma :-)
And I've never heard of an MVC2 paradigma...
Or do you mean Model2?
Google *MVC2 java
Michael

Some suggest that MVC2 is the XML extension of MVC1.  Who care about the 
precise nomenclature at this point?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Tiles - proper way for choosing a tile dynamically

2004-08-27 Thread Janne Mattila
I use Tiles to create pages that have their tiles selected dynamically based 
on some information that is created in an action. One simple example could 
be a menu tile, which is selected based on an attribute that is stored in 
session. I created simple definitions like:

	definition name=.layout.basic-cd 
path=/pages/cd/layout/basicTemplate.jsp
		put name=topleft value=/pages/cd/content/common/topleft.jsp /
		put name=header value=/pages/cd/content/common/logged-in-header.jsp 
/
		put name=menu value=/pages/cd/content/common/menu.jsp /
		put name=bottomleft value=/pages/cd/content/common/bottomleft.jsp /
		put name=footer value=/pages/cd/content/common/footer.jsp /
	/definition

   definition name=.page.main extends=.layout.basic-cd
put name=content value=/pages/cd/content/main.jsp/
   /definition
  ...
then, in menu.jsp page I include either admin menu or user menu based on 
the session parameter:

unstandard:bind var=AdminRole type=cd.business.Role field=ADMIN/
unstandard:bind var=UserRole type=cd.business.Role field=USER/
c:choose
c:when test=${sessionScope.role == AdminRole}
 tiles:insert page=menu-admin.jsp /
/c:when
c:when test=${sessionScope.role == UserRole}
 tiles:insert page=menu-user.jsp /
/c:when
/c:choose
Now the question: is this the proper way to do this, or is there a more 
elegant method?


PS. if those unstandard:bind tags confuse, they use jakarta unstandard 
taglib to enable JSTL to compare the object in session to typesafe 
enumeration values. In scriptlets this would be written simply as

% if (cd.business.Role.ADMIN.equals(session.getAttribute(role)) { %
 tiles:insert page=menu-admin.jsp /
...
_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Does Tiles support EL?

2004-08-26 Thread Janne Mattila
There does not seem to be a struts-tiles-el.tld - el tlds exist only for 
bean, html, and logic taglibs. Can I use EL with the Tiles tags?

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail

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


Re: Does Tiles support EL?

2004-08-26 Thread Janne Mattila
Is there a way to use struts-EL tags with Struts 1.1?

From: Nicolas De Loof [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: Does Tiles support EL?
Date: Thu, 26 Aug 2004 11:23:33 +0200
in Struts 1.2.x, contrib struts-EL tags include tiles-el.
You may also use tomcat 5 (or any servlet 2.4 container) to get EL on every 
tag.

Nico.
 There does not seem to be a struts-tiles-el.tld - el tlds exist only for
 bean, html, and logic taglibs. Can I use EL with the Tiles tags?

 _
 STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
 http://join.msn.com/?page=features/junkmail


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
Our name has changed.  Please update your address book to the following 
format: [EMAIL PROTECTED].

This message contains information that may be privileged or confidential 
and is the property of the Capgemini Group. It is intended only for the 
person to whom it is addressed. If you are not the intended recipient,  you 
are not authorized to read, print, retain, copy, disseminate,  distribute, 
or use this message or any part thereof. If you receive this  message in 
error, please notify the sender immediately and delete all  copies of this 
message.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


[OT(?)] Comparing against a typesafe enum in JSTL

2004-08-26 Thread Janne Mattila
First, apologies for a slightly OT question; this is more about JSTL and 
less about Struts.

Let's say I have a Role object in session. It is a typesafe enum, with 
values Role.ADMIN and Role.USER. How can I compare the object in session 
against those values, using JSTL? I can't figure out how to refer to 
typesafe enum objects using the JSTL notation. And I don't really want to 
change the enum class into a JavaBean.

Role:
public class Role {
private char roleChar;
public static final Role USER = new Role('u');
public static final Role ADMIN = new Role('a');
private Role(char roleChar) {
this.roleChar = roleChar;
}
char getRoleChar() {
return roleChar;
}
public boolean equals(Object obj) {
Role r2 = (Role) obj;
if (r2 == null) {
return false;
}
return r2.getRoleChar() == roleChar;
}
}
My attempt to use it in JSP page:
c:choose
c:when test=${sessionScope.role == cd.business.Role.ADMIN}
 Hello Admin
/c:when
c:otherwise
 Hello User
/c:otherwise
/c:choose
does not work.
(this special case could possibly be handled using container managed 
authorization and it's roles etcbut it's not really the point here)

_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

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


Re: [OT(?)] Comparing against a typesafe enum in JSTL

2004-08-26 Thread Janne Mattila
Um, no, doesn't work:
[ServletException in:/pages/cd/content/common/menu.jsp]
jsp.error.tlv.invalid.page
10: tag = 'when' / attribute = 'test': An error occurred while parsing 
custom action attribute test with value 
${sessionScope.role.roleChar.equals(cd.business.Role.ADMIN)}: Encountered 
(, expected one of [}, ., , gt, , lt, ==, eq, =, 
le, =, ge, !=, ne, [, +, -, *, /, div, %, mod, 
and, , or, ||]

besides, wouldn't that be comparing a char (besides, calling char's equals() 
method, which does not exist sice char is a primitive) to a Role?

Anyway, thanks for the suggestion, other ideas?

From: Can Zheng [EMAIL PROTECTED]
Reply-To: Can Zheng [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: [OT(?)] Comparing against a typesafe enum in JSTL
Date: Thu, 26 Aug 2004 20:32:27 +0800
Hi,
you can use
c:when 
test=${sessionScope.role.roleChar.equals(cd.business.Role.ADMIN)}
...


On Thu, 26 Aug 2004 12:09:56 +, Janne Mattila
[EMAIL PROTECTED] wrote:
 First, apologies for a slightly OT question; this is more about JSTL and
 less about Struts.

 Let's say I have a Role object in session. It is a typesafe enum, with
 values Role.ADMIN and Role.USER. How can I compare the object in session
 against those values, using JSTL? I can't figure out how to refer to
 typesafe enum objects using the JSTL notation. And I don't really want 
to
 change the enum class into a JavaBean.

 Role:

 public class Role {
private char roleChar;

public static final Role USER = new Role('u');
public static final Role ADMIN = new Role('a');

private Role(char roleChar) {
this.roleChar = roleChar;
}

char getRoleChar() {
return roleChar;
}

public boolean equals(Object obj) {
Role r2 = (Role) obj;
if (r2 == null) {
return false;
}
return r2.getRoleChar() == roleChar;
}
 }

 My attempt to use it in JSP page:

 c:choose
 c:when test=${sessionScope.role == cd.business.Role.ADMIN}
  Hello Admin
 /c:when
 c:otherwise
  Hello User
 /c:otherwise
 /c:choose

 does not work.

 (this special case could possibly be handled using container managed
 authorization and it's roles etcbut it's not really the point here)

 _
 MSN 8 with e-mail virus protection service: 2 months FREE*
 http://join.msn.com/?page=features/virus

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



--
Best regards,
Can Zheng
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Complicated select - option structure?

2004-08-24 Thread Janne Mattila
I am toying around with a simple test application. In one page user creates 
a new record, and picks the artist for that record with a select pulldown. 
My artist object has a first name and a last name separately. Initially I 
displayed only last name:

 html-el:select property=artistId
   html-el:optionsCollection property=allArtists value=id 
label=lastName/
 /html-el:select

Quite nice and compact. When I wanted to include also the last name, best I 
could come up with was:

 html-el:select property=artistId
   c:forEach var=artist items=${recordForm.allArtists}
 html-el:option value=${artist.id}
   c:out value=${artist.firstName} ${artist.lastName}/
 /html-el:option
   /c:forEach
 /html-el:select
It seems quite complicated - is there any way to use EL and 
optionsCollectionTag, for example, to achieve a simpler structure?

_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


RE: Learning the basics

2004-08-19 Thread Janne Mattila
I did not notice any book recommendations in answers to your question, and 
frankly, I am not surprised. For learning a new technology I prefer a good, 
well-written and well-structured book to harvesting scattered web pages to 
critical pieces of information. Unfortunately, I have read three books and 
can not recommend any of those to you:

Mastering Jakarta Struts: elementary stuff, contains lots of errors, does 
not tell you how to implement non-trivial UI. Most is copy-paste from the 
apache.org documentation. Poorly structured content.

Jakarta-Struts Live: goes deeper into details and offers more advanced 
stuff. Unfortunately author's way of words (no O'Reilly style sophistication 
here) and the book's (lack of) structure mean that it is an absolute pain to 
read! Also, you end up fiddling with lots and lots of neat plugins and 
helper applications (StrutsTestCase etc) for days before you get anywhere in 
the actual topic.

Programming Jakarta Struts: Perhaps the best structure out of these books. 
Unfortunately also covers just the basics and contains lots of copy-paste 
from the apache documentation. It seems that the author could not think of 
enough to write on Struts, so he blabbers on things such as unit testing is 
good and performance is important. What is it with the techincal books 
and their mammoth syndrome? Does every book have to contain all the 
knowledge of the author? The examples are really irritating - incomplete and 
you wil not be able to follow them by writing your own application piece by 
piece, the only way is to get the sources from O'Reilly and compile them all 
since the code is so coupled. Also lot of the book concentrates on author's 
proprietary framework.

None of these was a catastrophe though, but all were a bit so-soI have 
yet to find a _really good_ book.


From: Kenneth Litwak [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Learning the basics
Date: Wed, 18 Aug 2004 11:22:33 -0700
   If I'm an experienced developer, but new to Struts, do I need to buy
a book to write a basic app, or is there an online tutorial or something
like that that is sufficient?  One of the things I'd like to figure out
is to how to have three radio buttons, and a regular button, and have a
different action for each radio button.  I can't figure out how to wire
that.  Thanks.
Ken
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


RE: Learning the basics

2004-08-19 Thread Janne Mattila
I haven't yet. Just skimmed through Amazon example pages, and it seems like 
a proper book. (item from the example application: Commodore 1541. 
Brilliant!) Amazon user reviews were not that good, so I initially skipped 
this one, damn...


From: Jesse Alexander (KXT) [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Subject: RE: Learning the basics
Date: Thu, 19 Aug 2004 08:29:02 +0200
Have you looked at Struts in Action by Ted Husted 
http://www.manning.com/husted.
The in Action books are now one of my preferred collection of books.
You can check it out at half the price (ebook) which will be refunded 
when
you also buy the printed version from them. Their eShop works good.

Also new (I have not yet looked at it) from Manning: Struts Recipes
http://www.manning.com/catalog/view.php?book=franciscus. This one is not
for Struts-Beginners!
Happy Reading
Alexander
-Original Message-
From: Janne Mattila [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 19, 2004 8:19 AM
To: [EMAIL PROTECTED]
Subject: RE: Learning the basics
I did not notice any book recommendations in answers to your question, and
frankly, I am not surprised. For learning a new technology I prefer a good,
well-written and well-structured book to harvesting scattered web pages to
critical pieces of information. Unfortunately, I have read three books and
can not recommend any of those to you:
Mastering Jakarta Struts: elementary stuff, contains lots of errors, does
not tell you how to implement non-trivial UI. Most is copy-paste from the
apache.org documentation. Poorly structured content.
Jakarta-Struts Live: goes deeper into details and offers more advanced
stuff. Unfortunately author's way of words (no O'Reilly style 
sophistication
here) and the book's (lack of) structure mean that it is an absolute pain 
to
read! Also, you end up fiddling with lots and lots of neat plugins and
helper applications (StrutsTestCase etc) for days before you get anywhere 
in
the actual topic.

Programming Jakarta Struts: Perhaps the best structure out of these books.
Unfortunately also covers just the basics and contains lots of copy-paste
from the apache documentation. It seems that the author could not think of
enough to write on Struts, so he blabbers on things such as unit testing 
is
good and performance is important. What is it with the techincal books
and their mammoth syndrome? Does every book have to contain all the
knowledge of the author? The examples are really irritating - incomplete 
and
you wil not be able to follow them by writing your own application piece by
piece, the only way is to get the sources from O'Reilly and compile them 
all
since the code is so coupled. Also lot of the book concentrates on author's
proprietary framework.

None of these was a catastrophe though, but all were a bit so-soI 
have
yet to find a _really good_ book.

From: Kenneth Litwak [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Learning the basics
Date: Wed, 18 Aug 2004 11:22:33 -0700

If I'm an experienced developer, but new to Struts, do I need to buy
a book to write a basic app, or is there an online tutorial or something
like that that is sufficient?  One of the things I'd like to figure out
is to how to have three radio buttons, and a regular button, and have a
different action for each radio button.  I can't figure out how to wire
that.  Thanks.


Ken

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

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

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


Re: Tiles breaks my page that uses logic:iterate

2004-08-17 Thread Janne Mattila
Figured out what was the problem. Between the chair and the keyboard, it 
seems...

When copying the JSP from non-Tiles to Tiles version, I managed to include 
only

%@ taglib uri=/WEB-INF/struts-html.tld prefix=html%
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean%
so the logic taglib was missing. Naturally, no error message was shown. 
logic tags just fail silently, and since logic:iterate did not work I got 
the error about the missing object. And, of course, I did not include the 
whole JSP in my original question since I though it was not relevant. 
Plenty of dumb-assness going on it seems!

Anyhow, no problems now.

From: Janne Mattila [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Tiles breaks my page that uses logic:iterate
Date: Tue, 17 Aug 2004 06:07:27 +
With Tiles:
action path=/TilesInitInputs
type=jannen.action.InitInputsAction
scope=request
input=/Start.do
validate=false
name=inputsForm 
forward name=success 
path=/pages/jannen/tiles/layout/inputs.jsp/
/action
action path=/TilesGetInputs
type=jannen.action.GetInputsAction
scope=request
input=/Start.do
validate=false
name=inputsForm 
forward name=success 
path=/pages/jannen/tiles/layout/inputs.jsp/
/action
action path=/TilesSaveInputs
type=jannen.action.SaveInputsAction
scope=request
input=/TilesGetInputs.do
name=inputsForm 
forward name=success path=/TilesGetInputs.do/
/action
without tiles (works fine):
action path=/InitInputs
type=jannen.action.InitInputsAction
scope=request
input=/Start.do
validate=false
name=inputsForm 
forward name=success path=/pages/jannen/inputs.jsp/
/action
action path=/GetInputs
type=jannen.action.GetInputsAction
scope=request
input=/Start.do
validate=false
name=inputsForm 
forward name=success path=/pages/jannen/inputs.jsp/
/action
action path=/SaveInputs
type=jannen.action.SaveInputsAction
scope=request
input=/GetInputs.do
name=inputsForm 
forward name=success path=/GetInputs.do/
/action
So, three actions. Init is called only the first time to give default 
values, after that it is Save = Get = Save = Get and so on as long as 
user keeps submitting the form. Purpose of Get (and also Init) is to 
read the collection of possible choices (allChoices) from database.



From: Niall Pemberton [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: Tiles breaks my page that uses logic:iterate
Date: Mon, 16 Aug 2004 15:36:07 +0100
OK so post the bits of your struts-config which show the forms and action
mappings for
1) The action which renders the page
2) The action the form will post to (i.e. /TilesSaveInputs)
Niall
- Original Message -
From: Janne Mattila [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 16, 2004 3:13 PM
Subject: Re: Tiles breaks my page that uses logic:iterate
 Yes. And, (for example)

 bean:write name=inputsForm property=counter /

 works as long as I take out the multibox part.


 From: Niall Pemberton [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: Re: Tiles breaks my page that uses logic:iterate
 Date: Mon, 16 Aug 2004 15:09:57 +0100
 
 I'm guessing you changed the action your form is pointing to
 (/TilesSaveInputs) - so is the form name still inputsForm?
 
     logic:iterate id=choice name=inputsForm
 property=allChoices
 
 Niall
 
 - Original Message -
 From: Janne Mattila [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, August 16, 2004 2:59 PM
 Subject: Tiles breaks my page that uses logic:iterate
 
 
   I have a simple page for editing some form properties. It works.
There's
 a
   select box, a multibox, single-select select and a text input 
field.
Now
 I
   tried to Tiles-ify it, just using Tiles to add some silly
decorations
   around the actual form. Using tiles seems to break the form, the
 exception
 I
   get is
  
   16:49:43,714 ERROR

Re: Accessing bean properties problem

2004-08-16 Thread Janne Mattila
Janne Mattila wrote:
OK, Cap't of the Eh Team!
Maybe you should go and add Note: this is a clear, extensible, light, 
fast, loosely coupled, solution compared to a messy, solution specific, 
heavy, slow, tightly coupled version! to the Wiki page? After all, you 
have invented an elegant solution with low cost and with great flexibility 
and freedom!

Janne,
You too can be sardonic.  LOL  I guess we are just going to have to 
disagree on this one.  Enjoy coding and have a great day!  I was way ahead 
of you on the Wiki page suggestion though.  LOL

Michael
Agreed to disagreecheers and thanks for the opinions!
_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

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


Tiles breaks my page that uses logic:iterate

2004-08-16 Thread Janne Mattila
I have a simple page for editing some form properties. It works. There's a 
select box, a multibox, single-select select and a text input field. Now I 
tried to Tiles-ify it, just using Tiles to add some silly decorations 
around the actual form. Using tiles seems to break the form, the exception I 
get is

16:49:43,714 ERROR [Engine] - Root Cause -
javax.servlet.ServletException: Cannot find bean choice in any scope
   at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
   at 
org.apache.jsp.inputs_0002dcontent_jsp._jspService(inputs_0002dcontent_jsp.java:103)
   at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
   at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
   at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:575)
   at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:498)
   at 
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:822)
   at 
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:398)
   at 
org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
   at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
   at 
org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
   at 
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
   at 
org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
   at 
org.apache.jsp.template_jsp._jspx_meth_tiles_insert_1(template_jsp.java:197)
   at 
org.apache.jsp.template_jsp._jspx_meth_html_html_0(template_jsp.java:109)
   at org.apache.jsp.template_jsp._jspService(template_jsp.java:63)
   at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
   at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
   at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:575)
   at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:498)
   at 
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:822)
   at 
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:398)
   at 
org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
   at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
   at 
org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
   at 
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
   at 
org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
   at 
org.apache.jsp.inputs_jsp._jspx_meth_tiles_insert_0(inputs_jsp.java:99)
   at org.apache.jsp.inputs_jsp._jspService(inputs_jsp.java:57)

the JSP page for the form looks like:
html:form action=/TilesSaveInputs onsubmit=return 
validateInputsForm(this);

 bean:write name=inputsForm property=counter /br
 html:hidden property=counter /
 pSelect + optionsCollection:br
 html:select property=selectedChoicesForSelect multiple=true size=5
html:optionsCollection property=allChoices value=key label=name/
 /html:selectbr
 pMultibox:br
 !-- THE FOLLOWING BREAKS THE PAGE --
 logic:iterate id=choice name=inputsForm property=allChoices
   html:multibox property=selectedChoicesForMultibox
 bean:write name=choice property=key/
   /html:multibox
   bean:write name=choice property=name/br
 /logic:iterate
 pSingle select + optionsCollection:br
 html:select property=selectedChoiceForSingleSelect
html:optionsCollection property=allChoices value=key label=name/
 /html:selectbr
 pPlain text field, validated using validatorbr
 e-mail:html:text property=text/br
 p
 html:link action=/Start.doBack/html:linkbr
 p
 html:submit/
/html:form
The part which breaks the page is the multibox, it's iterator and use of 
iterator's choice object. If I take that part out the page works fine with 
Tiles, I can make the selections etc.

The page works fine also with the multibox as long as I do 

Re: Tiles breaks my page that uses logic:iterate

2004-08-16 Thread Janne Mattila
Yes. And, (for example)
bean:write name=inputsForm property=counter /
works as long as I take out the multibox part.

From: Niall Pemberton [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: Tiles breaks my page that uses logic:iterate
Date: Mon, 16 Aug 2004 15:09:57 +0100
I'm guessing you changed the action your form is pointing to
(/TilesSaveInputs) - so is the form name still inputsForm?
   logic:iterate id=choice name=inputsForm 
property=allChoices

Niall
- Original Message -
From: Janne Mattila [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 16, 2004 2:59 PM
Subject: Tiles breaks my page that uses logic:iterate
 I have a simple page for editing some form properties. It works. There's 
a
 select box, a multibox, single-select select and a text input field. Now 
I
 tried to Tiles-ify it, just using Tiles to add some silly decorations
 around the actual form. Using tiles seems to break the form, the 
exception
I
 get is

 16:49:43,714 ERROR [Engine] - Root Cause -
 javax.servlet.ServletException: Cannot find bean choice in any scope
 at

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:533)
 at

org.apache.jsp.inputs_0002dcontent_jsp._jspService(inputs_0002dcontent_jsp.j
ava:103)
 at
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
10)
 at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
 at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at

org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:684)
 at

org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:575)
 at

org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:498)
 at

org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:8
22)
 at

org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:398)
 at
 org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
 at 
org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
 at
 org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
 at

org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.ja
va:881)
 at
 org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
 at

org.apache.jsp.template_jsp._jspx_meth_tiles_insert_1(template_jsp.java:197)
 at
 
org.apache.jsp.template_jsp._jspx_meth_html_html_0(template_jsp.java:109)
 at org.apache.jsp.template_jsp._jspService(template_jsp.java:63)
 at
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
10)
 at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
 at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at

org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:684)
 at

org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:575)
 at

org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:498)
 at

org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:8
22)
 at

org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:398)
 at
 org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
 at 
org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
 at
 org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
 at

org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.ja
va:881)
 at
 org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
 at
 org.apache.jsp.inputs_jsp._jspx_meth_tiles_insert_0(inputs_jsp.java:99)
 at org.apache.jsp.inputs_jsp._jspService(inputs_jsp.java:57)

 the JSP page for the form looks like:

 html:form action=/TilesSaveInputs onsubmit=return
 validateInputsForm(this);

   bean:write name=inputsForm property=counter /br
   html:hidden property=counter /

   pSelect + optionsCollection:br

   html:select property=selectedChoicesForSelect multiple=true
size=5
   html:optionsCollection property=allChoices value=key 
label=name/
   /html:selectbr

   pMultibox:br

RE: Accessing bean properties problem

2004-08-13 Thread Janne Mattila

Oops, that was a typo. Should have read
tdhtml:image src=delete.gif name=%= delete_ + choiceKey % 
//td

If browsers did pick up value parameter, this problem would not even 
exist...

Some browsers do.  What is your problem?  Why are you adding delete in 
here?
There is no name attribute with image.  I assume you mean to use the 
property attribute.  There is no problem with this, even without a 
value attribute.  If you use property='%= delete + choiceKey %', 
and (in your processing of the form):

   String button = null;
   Enumeration enum = request.getParameterNames();
   String parameterName = null;
   while(enum.hasMoreElements()) {
 parameterName = (String)enum.nextElement();
 if(parameterName.endsWith(.x)) {
   button = parameterName.substring(0,parameterName.indexOf('.'));
 }
   }
Sorry, I seem to have gotten a bit confused here. You are correct with your 
assumption that I meant the property attribute.

I described what I wanted to achieve in my original posting. To recap, I 
want to have a page with several delete buttons. Clicking on one button 
would produce parameter

delete_23.x=56
to be sent = we parse that, and delete item with ID 23 from database. 
Choosing a different delete -button would send parameter

delete_304.x=144
= we delete item with ID 304.
I am aware that I can use the approach you suggested (parse request 
parameters manually), and have been doing that for ages before I started 
learning Struts :) I was just expecting that Struts would somehow help me 
with this task. I have been looking into indexed properties but I have not 
quite figured out how to properly implement this kind of functionality using 
them.

_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


RE: Accessing bean properties problem

2004-08-13 Thread Janne Mattila
I described what I wanted to achieve in my original posting. To recap, I 
want to have a page with several delete buttons. Clicking on one button 
would produce parameter

delete_23.x=56
to be sent = we parse that, and delete item with ID 23 from database. 
Choosing a different delete -button would send parameter

delete_304.x=144
= we delete item with ID 304.
I am aware that I can use the approach you suggested (parse request 
parameters manually), and have been doing that for ages before I started 
learning Struts :) I was just expecting that Struts would somehow help me 
with this task. I have been looking into indexed properties but I have not 
quite figured out how to properly implement this kind of functionality 
using them.
I finally figured out a reasonably satisfying way to do this while using 
Struts to help as much as possible:

public class ChoicesForm extends ActionForm {
private Collection choices;
private ImageButtonTracer deleteButton;
public void reset(ActionMapping arg0, HttpServletRequest arg1) {
this.choices = new ArrayList();
this.deleteButton = new ImageButtonTracer();
}
public ChoiceView getChoice(int index) {
// if struts tries to get item with id index,
// and it does not exist,
// add new items until ok.
while (choices.size() = index) {
choices.add(new ChoiceView());
}
List lChoices = (List) choices;
return (ChoiceView) lChoices.get(index);
}
public Collection getChoices() {
return choices;
}
public void setChoices(Collection collection) {
choices = collection;
}
public ImageButtonTracer getDeleteButton() {
return deleteButton;
}
public void setDeleteButton(ImageButtonTracer tracer) {
deleteButton = tracer;
}
}
public class ImageButtonTracer {
private Map clickedButtons;
public ImageButtonTracer() {
clickedButtons = new HashMap();
}
public Button getItem(int index) {
Button toReturn = (Button) clickedButtons.get(new Integer(index));
if (toReturn == null) toReturn = new Button();
clickedButtons.put(new Integer(index), toReturn);
return toReturn;
}
public void setItem(int index, Button button) {
logger.debug(setItem( + index + ));
clickedButtons.put(new Integer(index), button);
}
public Collection getClickedButtonIndexes() {
return clickedButtons.keySet();
}
public class Button {
private int x;
private int y;
public int getX() { return x; }
public int getY() { return y; }
public void setX(int i) { x = i; }
public void setY(int i) { y = i; }
}
}
public class ChoiceView implements Serializable {
private String key;
private String name;
private String description;
... + getters  setters
}
html:form action=/SaveChoices method=GET
 table border=1
 logic:iterate id=choice name=choicesForm property=choices
   tr
 tdbean:write name=choice property=key/html:hidden 
indexed=true name=choice property=key//td
 tdhtml:text indexed=true name=choice property=name//td
 tdhtml:text indexed=true name=choice 
property=description//td
 tdhtml:image indexed=true src=delete.gif 
property=deleteButton.item//td
   /tr
 /logic:iterate
 /table
 brhtml:submit/
/html:form

public class SaveChoicesAction extends Action {
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
ChoicesForm cform = (ChoicesForm) form;
ChoiceDAO dao = new ChoiceDAO();
// UPDATE
Iterator i = cform.getChoices().iterator();
while (i.hasNext()) {
ChoiceView view = (ChoiceView) i.next();
Choice toUpdate = ChoiceView.createChoice(view);
dao.update(toUpdate);
}
  // DELETE
Collection deletedIds =
cform.getDeleteButton().getClickedButtonIndexes();
if (deletedIds != null) {
Iterator d = deletedIds.iterator();
while (d.hasNext()) {
int deleteIndex = ((Integer) d.next()).intValue();
ChoiceView toDelete = cform.getChoice(deleteIndex);
Choice choice = ChoiceView.createChoice(toDelete);

Re: Accessing bean properties problem

2004-08-13 Thread Janne Mattila


From: Michael McGrady [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: Accessing bean properties problem
Date: Fri, 13 Aug 2004 06:22:38 -0700
Janne Mattila wrote:
I am aware that I can use the approach you suggested (parse request 
parameters manually), and have been doing that for ages before I started 
learning Struts :) I was just expecting that Struts would somehow help me 
with this task. I have been looking into indexed properties but I have 
not quite figured out how to properly implement this kind of 
functionality using them.

All the solutions involve parsing the request parameters, Janne.  That is 
clearly the only way you will ever know what they are.  The difference is 
that there is a clear, extensible, light, fast, loosely coupled, solution 
and a messy, solution specific, heavy, slow, tightly coupled version of the 
solution.  You are seeking the latter for some reason.  There is NO reason 
to couple your solution to Struts.  Struts is a framework and is not meant 
to be a fulcrum to solve this problem.  If you were using the solution I 
have suggested for ages, you should go back to it.  Your present solution 
is horrible in comparison.  That is just plain true.
If you use Struts to do your HTTP request processing, you'll couple your 
HTTP request processing to Struts. I don't know what all this nonsense about 
decoupling from Struts is meant to be. That is the whole point of using 
Struts, there is absolutely no logic in trying to decouple you application's 
HTTP parameter handling from Struts. It is what Struts does.

You seem to like parsing HttpServletRequests manually, so why don't you skip 
Struts altogether and parse all request parameters manually? I bet it would 
be clear, extensible, light, fast, loosely coupled solution. Hell, who 
needs ActionForms after all? They make your solution tightly coupled to 
Struts!

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail

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


Re: Accessing bean properties problem

2004-08-13 Thread Janne Mattila
OK, Cap't of the Eh Team!
Maybe you should go and add Note: this is a clear, extensible, light, fast, 
loosely coupled, solution compared to a messy, solution specific, heavy, 
slow, tightly coupled version! to the Wiki page? After all, you have 
invented an elegant solution with low cost and with great flexibility and 
freedom!


From: Michael McGrady [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: Accessing bean properties problem
Date: Fri, 13 Aug 2004 07:11:29 -0700
No mas, Janne!  If you think that your serpentine code is superior to the 
following:

public class ButtonMiner {
 public int getId(HttpServletRequest request) {
   String buttonValue = null;
   Enumeration enum = request.getParameterNames();
   String parameterName = null;
   while(enum.hasMoreElements()) {
 parameterName = (String)enum.nextElement();
 if(parameterName.endsWith(.x)) {
   buttonValue = 
parameterName.substring(0,parameterName.indexOf('.'));
 }
 return Integer.parseInt(buttonValue.substring(1));
 }
}

which you could get from indexing _, then go for it!  I have no more to 
say.

Michael
Janne Mattila wrote:
I am well aware of the solution that you suggest and the fact that you 
think other solutions are over-engineered - I did indeed try to search for 
a solution before creating my own, and noticed the wiki page with the 
original over-engineered solution (which I noticed did change just 
recently).

There are two problems, first, your solution does not solve my case. Note 
that this is not a simple case of distinguishing whether accept or 
nuke was clicked (for those I would not certainly have used the original 
strategy from the wiki page, I agree with over-engineering there) - I want 
to get the ID conveniently as well. Please refer to earlier posts for 
details. Of course, I can add more parsing code to get also the ID, but 
this does not help with the second problem.

Which is: the purpose of Struts is to help me with some tasks, one 
important being parsing HttpServletRequest parameters so I do not have to 
deal with them manually. This service comes with a price - I have to spend 
time to learn the principles of the framework and all the small annoying 
quirks and unintuitive details (so far I've ran into quite a few!). If I 
have to both learn to cope with Struts and still continue to parse request 
parameters manually like I have done so many times before, the deal does 
not sound so good to me. The solution you suggest works, is not too 
complicated, but it does not integrate as seamlessly with the rest of the 
framework and how it is used to handle parameters. Button parameters end 
up being an exception to the general rule and I prefer a pretty 
solution. The solution I described also integrates nicely to the way other 
indexed properties are handled on the JSP page.

I don't know, but I am currently satisfied with the solution I am using. I 
end up creating one additional class (ImageButtonTracer) and add instance 
of it as a field to each form that requires this kind of indexed 
buttons. You would probably create one additional helper class (with a 
further developed version of the method you present) and add parameter 
name encoding logic to each form that contains such buttons.


From: Michael McGrady [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: Accessing bean properties problem
Date: Fri, 13 Aug 2004 05:57:24 -0700
This is all over-engineered, Janne.  I used to do something similar, 
however.  As I menteioned before, I just use the following code to 
determine which image was clicked:

   String imageClicked = null;
   Enumeration enum = request.getParameterNames();
   String parameterName = null;
   while(enum.hasMoreElements()) {
 parameterName = (String)enum.nextElement();
 if(parameterName.endsWith(.x)) {
   imageClicked = 
parameterName.substring(0,parameterName.indexOf('.'));
 }
   }
   return imageClicked;

That's all there is to it.  Your button solution is too complicated in 
any event.  The better button solution involves making only one button 
and then nuking that button as soon as you determine what image was 
clicked.  I just nuked the whole solution, since it is unnecessary.

Michael
Janne Mattila wrote:
I described what I wanted to achieve in my original posting. To recap, 
I want to have a page with several delete buttons. Clicking on one 
button would produce parameter

delete_23.x=56
to be sent = we parse that, and delete item with ID 23 from database. 
Choosing a different delete -button would send parameter

delete_304.x=144
= we delete item with ID 304.
I am aware that I can use the approach you suggested (parse request 
parameters manually), and have been doing that for ages before I 
started learning Struts :) I was just expecting that Struts would 
somehow help me

Accessing bean properties problem

2004-08-12 Thread Janne Mattila
Let's say I have a collection of Choice objects, each having attributes key 
and name. I want to iterate the collection on JSP, display it's contents and 
add a delete button for each choice. Delete button value should contain 
delete_ appended with each choice's key. Following works:

(1)
 logic:iterate id=choice name=choicesForm property=choices
   tr
 tdbean:write name=choice property=key//td
 tdbean:write name=choice property=name//td
 bean:define id=choiceKey name=choice property=key /
 tdhtml:image src=delete.gif value=%= delete_ + choiceKey % 
//td
   /tr
 /logic:iterate

the problem is the required additional bean:define that I would like to 
avoid. Trying

(2)
 logic:iterate id=choice name=choicesForm property=choices
   tr
 tdbean:write name=choice property=key//td
 tdbean:write name=choice property=name//td
 tdhtml:image src=delete.gif value=%= delete_ + 
choice.getKey() % //td
   /tr
 /logic:iterate

just results in
org.apache.jasper.JasperException: Unable to compile class for JSP
3\server\default\work\MainEngine\localhost\struts-helloworld\pages\jannen\listChoices_jsp.java:200: 
cannot resolve symbol
   [javac] symbol  : method getKey ()
   [javac] location: class java.lang.Object
   [javac]   _jspx_th_html_image_2.setValue( delete_ + 
choice.getKey() );

since choice is Object... Adding the correct cast results in horrible
tdhtml:image src=delete.gif value=%= delete_ + 
((com.someCompany.someProject.somePackage.Choice)choice).getKey() % 
//td

I guess I could improve on that by adding some imports to have this
tdhtml:image src=delete.gif value=%= delete_ + 
((Choice)choice).getKey() % //td

but then I am left with the task of updating the imports on JSP pages and I 
feel that there could/should be a simpler way. Any ideas? Unfortunately JSP 
2.0 is not an option for me at the moment.

_
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


Re: Accessing bean properties problem

2004-08-12 Thread Janne Mattila
Oops, that was a typo. Should have read
tdhtml:image src=delete.gif name=%= delete_ + choiceKey % //td
If browsers did pick up value parameter, this problem would not even 
exist...


Do you realize, Janne, how few browsers will pick up the value of value?
At 01:37 AM 8/12/2004, you wrote:
 tdhtml:image src=delete.gif value=%= delete_ + choiceKey 
% //td
   /tr

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


RE: OptionsCollectionTag with ActionForm and a collection attribute

2004-08-10 Thread Janne Mattila
No takers on this? If I am renderin a select box in JSP with selectTag and 
optionsCollectionTag, can my form bean store the selected options in a 
collection? (instead of an array, which seems to work fine)


From: Janne Mattila [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: OptionsCollectionTag with ActionForm and a collection attribute
Date: Mon, 09 Aug 2004 09:54:57 +
I am just studying the basic things about Struts, and have some trouble 
getting selectTag and optionsCollectionTag work as I would expect. 
Intention is to have two properties in a form: allChoices, that is a 
collection holding all possible choices for the select tag, and 
selectedChoicesCollection, that contains the currently selected ones. Each 
choice is modelled by a class Choice, that contains two attributes, id for 
identifying the selection and name, which is displaed to the user. 
SelectedChoicesCollection contains only the values of the Choices (as 
having it contain Choice objects did not seem to work at all).

I have to actions, SimpleGetAction and SimpleSaveAction. User starts by 
calling a URL which maps to SimpleGetAction. This action populates the form 
object and moves on to the JSP page. This part works out as I excpect, and 
the correct choice(s) is highlighted. When user submits the form, 
SimpleSaveAction gets called - except that BeanUtils.populate throws an 
exception before action gets it's turn:

12:34:46,268 INFO  [STDOUT] DEBUG 
[org.apache.struts.util.RequestUtils][1799] Get module name for path 
/SaveSimpleTest.do
12:34:46,268 INFO  [STDOUT] DEBUG 
[org.apache.struts.util.RequestUtils][1821] Module name found: default
12:34:46,268 INFO  [STDOUT] DEBUG 
[org.apache.struts.action.RequestProcessor][225] Processing a 'POST' for 
path '/SaveSimpleTest'
12:34:46,268 INFO  [STDOUT] DEBUG 
[org.apache.struts.util.RequestUtils][764]  Looking for ActionForm bean 
instance in scope 'request' under attribute key 'simp
eForm'
12:34:46,268 INFO  [STDOUT] DEBUG 
[org.apache.struts.util.RequestUtils][839]  Creating new ActionForm 
instance of type 'jannen.form.SimpleTestForm'
12:34:46,268 INFO  [STDOUT] DEBUG 
[org.apache.struts.util.RequestUtils][844]  -- jannen.form.SimpleTestForm 
selectedChoicesArray:  selectedChoicesCollection:
3]
12:34:46,308 INFO  [STDOUT] DEBUG 
[org.apache.struts.action.RequestProcessor][372]  Storing ActionForm bean 
instance in scope 'request' under attribute key 'si
pleForm'
12:34:46,388 INFO  [STDOUT] DEBUG 
[org.apache.struts.action.RequestProcessor][813]  Populating bean 
properties from this request
12:34:46,388 ERROR [Engine] StandardWrapperValve[action]: Servlet.service() 
for servlet action threw exception
javax.servlet.ServletException: BeanUtils.populate
   at 
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
   at 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
   at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
   at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
   at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
   at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at 
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at 
org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995

RE: OptionsCollectionTag with ActionForm and a collection attribute

2004-08-10 Thread Janne Mattila
Collections are more convenient to use than arrays (of course, disagreement 
on this is allowed :) and they integrate more easily to the rest of the 
codebase, which uses collections everywhere.

Multiple values can be selected (multiple=true), so the selected options 
would be a collection. In this example, I would expect it to be a collection 
of Choice objectsalthough a collection of Strings (as a collection of 
parameters) or a collection of Integers (collection of Choice.ids) I would 
also understand, too.

Even the struts examples (struts-exercise-taglib.war) use only arrays to 
model the selected options. This seems odd, since it would be logical to 
allow selected options to be stored in a collection, since all available 
options are stored in a collection. Plus, it seems to work to one way but 
not the other (JSP gets populated ok, problems occur only when submitting 
the form).

Oh well, it seems that struts documentation 
http://struts.apache.org/userGuide/struts-html.html#select states that

multiple=true IS selected - The corresponding property should be an array 
of any supported data type.

so I think I am out of luck here. Funny though that it works halfway...

From: [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: RE: OptionsCollectionTag with ActionForm and a collection 
attribute
Date: Tue, 10 Aug 2004 12:29:59 +0530

Why do you want to store it in a collection ??
The selected option would be a String right ??
-Original Message-
From: Janne Mattila [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 11:54 AM
To: [EMAIL PROTECTED]
Subject: RE: OptionsCollectionTag with ActionForm and a collection 
attribute

No takers on this? If I am renderin a select box in JSP with selectTag and
optionsCollectionTag, can my form bean store the selected options in a
collection? (instead of an array, which seems to work fine)
From: Janne Mattila [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: OptionsCollectionTag with ActionForm and a collection
attribute
Date: Mon, 09 Aug 2004 09:54:57 +

I am just studying the basic things about Struts, and have some trouble
getting selectTag and optionsCollectionTag work as I would expect.
Intention is to have two properties in a form: allChoices, that is a
collection holding all possible choices for the select tag, and
selectedChoicesCollection, that contains the currently selected ones. 
Each
choice is modelled by a class Choice, that contains two attributes, id 
for
identifying the selection and name, which is displaed to the user.
SelectedChoicesCollection contains only the values of the Choices (as
having it contain Choice objects did not seem to work at all).

I have to actions, SimpleGetAction and SimpleSaveAction. User starts by
calling a URL which maps to SimpleGetAction. This action populates the 
form
object and moves on to the JSP page. This part works out as I excpect, 
and
the correct choice(s) is highlighted. When user submits the form,
SimpleSaveAction gets called - except that BeanUtils.populate throws an
exception before action gets it's turn:

12:34:46,268 INFO  [STDOUT] DEBUG
[org.apache.struts.util.RequestUtils][1799] Get module name for path
/SaveSimpleTest.do
12:34:46,268 INFO  [STDOUT] DEBUG
[org.apache.struts.util.RequestUtils][1821] Module name found: default
12:34:46,268 INFO  [STDOUT] DEBUG
[org.apache.struts.action.RequestProcessor][225] Processing a 'POST' for
path '/SaveSimpleTest'
12:34:46,268 INFO  [STDOUT] DEBUG
[org.apache.struts.util.RequestUtils][764]  Looking for ActionForm bean
instance in scope 'request' under attribute key 'simp
eForm'
12:34:46,268 INFO  [STDOUT] DEBUG
[org.apache.struts.util.RequestUtils][839]  Creating new ActionForm
instance of type 'jannen.form.SimpleTestForm'
12:34:46,268 INFO  [STDOUT] DEBUG
[org.apache.struts.util.RequestUtils][844]  -- 
jannen.form.SimpleTestForm
selectedChoicesArray:  selectedChoicesCollection:
3]
12:34:46,308 INFO  [STDOUT] DEBUG
[org.apache.struts.action.RequestProcessor][372]  Storing ActionForm bean
instance in scope 'request' under attribute key 'si
pleForm'
12:34:46,388 INFO  [STDOUT] DEBUG
[org.apache.struts.action.RequestProcessor][813]  Populating bean
properties from this request
12:34:46,388 ERROR [Engine] StandardWrapperValve[action]: 
Servlet.service()
for servlet action threw exception
javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessorjava:821)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760

OptionsCollectionTag with ActionForm and a collection attribute

2004-08-09 Thread Janne Mattila
I am just studying the basic things about Struts, and have some trouble 
getting selectTag and optionsCollectionTag work as I would expect. Intention 
is to have two properties in a form: allChoices, that is a collection 
holding all possible choices for the select tag, and 
selectedChoicesCollection, that contains the currently selected ones. Each 
choice is modelled by a class Choice, that contains two attributes, id for 
identifying the selection and name, which is displaed to the user. 
SelectedChoicesCollection contains only the values of the Choices (as having 
it contain Choice objects did not seem to work at all).

I have to actions, SimpleGetAction and SimpleSaveAction. User starts by 
calling a URL which maps to SimpleGetAction. This action populates the form 
object and moves on to the JSP page. This part works out as I excpect, and 
the correct choice(s) is highlighted. When user submits the form, 
SimpleSaveAction gets called - except that BeanUtils.populate throws an 
exception before action gets it's turn:

12:34:46,268 INFO  [STDOUT] DEBUG 
[org.apache.struts.util.RequestUtils][1799] Get module name for path 
/SaveSimpleTest.do
12:34:46,268 INFO  [STDOUT] DEBUG 
[org.apache.struts.util.RequestUtils][1821] Module name found: default
12:34:46,268 INFO  [STDOUT] DEBUG 
[org.apache.struts.action.RequestProcessor][225] Processing a 'POST' for 
path '/SaveSimpleTest'
12:34:46,268 INFO  [STDOUT] DEBUG [org.apache.struts.util.RequestUtils][764] 
 Looking for ActionForm bean instance in scope 'request' under attribute 
key 'simp
eForm'
12:34:46,268 INFO  [STDOUT] DEBUG [org.apache.struts.util.RequestUtils][839] 
 Creating new ActionForm instance of type 'jannen.form.SimpleTestForm'
12:34:46,268 INFO  [STDOUT] DEBUG [org.apache.struts.util.RequestUtils][844] 
 -- jannen.form.SimpleTestForm selectedChoicesArray:  
selectedChoicesCollection:
3]
12:34:46,308 INFO  [STDOUT] DEBUG 
[org.apache.struts.action.RequestProcessor][372]  Storing ActionForm bean 
instance in scope 'request' under attribute key 'si
pleForm'
12:34:46,388 INFO  [STDOUT] DEBUG 
[org.apache.struts.action.RequestProcessor][813]  Populating bean properties 
from this request
12:34:46,388 ERROR [Engine] StandardWrapperValve[action]: Servlet.service() 
for servlet action threw exception
javax.servlet.ServletException: BeanUtils.populate
   at 
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
   at 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
   at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
   at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
   at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
   at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at 
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at 
org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
   at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
   at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
   at