Re: Disadvantages of Struts?

2003-12-04 Thread Graham Leggett
Robert H. Tran wrote:

I just wonder if Struts comes with any significant drawback. I mean not in
terms of when to use Struts and when not to use it necessarily, but more in
the line of anyone's wishes that it had been better. Any advice is very
appreciated.
I battled initially to get my head around struts, as it was not clear 
enough to me exactly what the software did, and exactly what the 
software didn't do (which in turn answered the question "what do _I_ 
have to code to get something meaningful to work").

The second hassle I've had is with exceptions being caught and thrown 
away, especially in the DynaBean stuff - as a result I have an unpacked 
version of the struts code in my development tree, which is easy to 
access and amend in a debugger.

Struts is a bit like a swiss army knife, it does many diverse and very 
useful things as part of the greater goal: building a web app. It's just 
not all that clear as to exactly what it does sometimes. On the whole 
though, it's really useful - I have just had the opportunity to build a 
system from scratch (as opposed to retrofit struts to a previous 
disas^H^H^H^H^Hproject, yuck), and it has on the whole been an enormous 
timesaver, and really useful.

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


Struts throwing away exceptions

2003-11-14 Thread Graham Leggett
Hi all,

I ran into this problem a while back, worked around it, but now it is back.

Something has gone haywire with a struts web application I am trying to 
debug. When accessing an URL, I get an HTTP 400 error, with the 
explanation "The request sent by the client was syntactically incorrect 
().".

From my last experience with this problem, it turned out then to be a 
NullPointerException with no reason string - thus the empty string 
between the brackets. The problem is, the original exception has been 
thrown away by struts, so I have no clue where to start looking for the 
problem.

The cause of this issue is that all messages, including HTTP error 
codes, are being logged via commons-logging, which in this case has gone 
haywire along with the application. The correct behaviour IMHO in a 
situation where struts is in a broken state, is to pass the exception 
along with the HTTP error code to the servlet container, thus removing 
an enormous source of frustration for struts developers where a problem 
is reported seamingly by tomcat, but with no clue where the problem came 
from.

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


Can tiles contain tiles?

2003-11-12 Thread Graham Leggett
Hi all,

I have a tile, and within that tile, I have attempted to insert another 
tile. The nested  tag runs, but finds no definition in the 
 tile-defs.xml file when the definition is there.

If I copy the nested tiles:insert tag out of the tile and into the base 
jsp page where all the other tiles live, the tile works fine.

Is nesting tiles even possible using Struts v1.1? If not, is there a 
reason for this, or is this a bug?

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


Struts v1.1 source: line termination

2003-10-28 Thread Graham Leggett
Hi all,

I downloaded the struts v1.1 source as a tar.gz, and unpacked it to find 
that all the source files followed the Windows CRLF convention.

Is it possible to make sure the .tar.gz version of the source is 
terminated with LF, and the .zip version of the source is terminated 
with CRLF?

Regards,
Graham
--
-
[EMAIL PROTECTED]   "There's a moon
over Bourbon Street
tonight..."
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Html tags and "indexed" property - how does it work?

2003-09-27 Thread Graham Leggett
Graham Leggett wrote:

Is it possible to use an indexed property inside a DynaActionForm, and 
have the DynaActionForm populated correctly on submit?

The HTML form is submitted with element names of the form 
"id[index].property", the trouble is that when this form is submitted, 
and struts is tasked with populating the DynaActionForm bean, this bombs 
out like so:
Stepping through this with the debugger, I can confirm that the answer 
is no: it is not possible.

The problem exists inside commons-beanutils:

The logic of Beanutils.setProperty() goes like this:

- Check if property name contains a ".". (In our case, id[34].property 
does, so true)

- If true, try search for a property called "id[34]". This property does 
not exist, so bomb out and ignore it.

- Check if the bean is an instance of DynaBean. (In our case it's too 
late - we already bombed out above).

At this point the loops iterates again, and the indexed option is ignored.

Can someone check whether my understanding of this is correct? It's 
really late... so I could be reading this wrong.

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


Re: Html tags and "indexed" property - how does it work?

2003-09-27 Thread Graham Leggett
Ted Husted wrote:

This is really a USER list question, but you may be looking for the 
indexed properties how-to:

http://jakarta.apache.org/struts/faqs/indexedprops.html
I posted to the user list, but as yet I have had no reply. Searching 
google and the mailing list archives has shown other people having the 
same problem, but no solutions posted.

Is it possible to use an indexed property inside a DynaActionForm, and 
have the DynaActionForm populated correctly on submit?

The HTML form is submitted with element names of the form 
"id[index].property", the trouble is that when this form is submitted, 
and struts is tasked with populating the DynaActionForm bean, this bombs 
out like so:

java.lang.ArrayIndexOutOfBoundsException
at java.lang.reflect.Array.set(Native Method)
at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:459)
at 
org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(PropertyUtils.java:1414)
at 
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1013)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at 
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1104)

Is this a struts bug, or am I doing this wrong?

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


Html tags and "indexed" property - how does it work?

2003-09-27 Thread Graham Leggett
Hi all,

I am having some conceptual problems with the "indexed" property of the 
HTML tags, I have tried to find docs on this property, but apart from a 
brief one line description I can find none.

I have some JSP that looks roughly like this:




  
  



The form property "policycovers" contains the list of options in the 
dropdown, and this works fine.

The form property "policycoverId" is a String[], containing the default 
value for the dropdown in each iteration.

The option indexed="true" means output variables with a sequence 
embedded in them - but - the default value of policycoverId is always 
interpreted to mean the last value of the array, and not each iteration 
in the array, as is the logical behaviour.

Is this a bug with the indexed="true" attribute? Am I reading the docs 
wrong? What is the "right" way to do this?

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


Re: Editable Fields V/S Static Text

2003-09-27 Thread Graham Leggett
Edgar P Dollin wrote:

1) It is fine that the basic tags in struts don't emit non-standard html,
but why do struts tags have to 'police' the emission of non-html.  For many
intranet style projects, non standard html is important to achieve specific
required functionality.  To deny the need for such code seems strange.
I personally don't see why intranet applications should be exempt from 
following the same standards as internet applications - "breaking" 
standards out of convenience is not a good design practice.

The enforcement of standards by struts allows me the system architect to 
be certain that I am "doing the right thing" from a design perspective. 
And from a customer perspective, I don't want my intranet applications 
breaking because I upgraded from IE v6 to IE v7, now the custom little 
hacks I put in that worked in IE v6 suddenly don't work in IE v7.

2) It baffles my mind why struts insists the tags be so minimalistic and
non-creative.
To me, minimalism is another way of describing simplicity, and 
simplicity allows me to be more creative. From an art sense, simple is 
good :)

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


Re: [PROPOSAL] Wildcard-matched actions

2003-07-05 Thread Graham Leggett
Don Brown wrote:

Perhaps now that 1.1 is final, this would be a good time to bring this up.
I've written a small extension to Struts that allows action mappings to
use wildcards in matching URIs.
I submitted a patch to bugzilla a while back that did prefix matching in 
matching URIs. A config called "foo" could be called, regardless of 
whether it was accessed as "/bar/foo", or "/fred/foo". Very useful for 
standard functionality that is reused in a site, such as a login form. 
We've been using it for a while, and it works great.

Wildcard matching would also be really useful.

Regards,
Graham
--
-
[EMAIL PROTECTED]   "There's a moon
over Bourbon Street
tonight..."
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Problems with vague Exception handling

2003-07-04 Thread Graham Leggett
Hi all,

I have been plagued all afternoon by the following error message:

[ServletException in:/WEB-INF/jsp/policy/policy.jsp] null' 
javax.servlet.ServletException

It is the standard message that happens when a problem occurs in 
connection with a DynaActionForm bean, including but not limited to 
missing or undefined properties.

I am still using RC1 (no time to upgrade right now, using a patched 
struts) - does anyone know if the exception handling with respect to 
DynaActionForm has been improved in the final release?

Regards,
Graham
--
-
[EMAIL PROTECTED]   "There's a moon
over Bourbon Street
tonight..."
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


bean:define from a DynaActionForm containing a null causes ServletException

2003-07-04 Thread Graham Leggett
Hi all,

On a jsp page, I am trying to retrieve a bean from a DynaActionForm like so:



In my ActionForm, I set this bean to null, because I am testing the 
"requested policy not found" functionality, to be trapped by logic:empty 
tags:

form.set("policy", null);

When I do this however, the bean:define tag throws a ServletException 
with message "null".

Is it possible to add a null value to a DynaActionForm property? Are 
there any known bugs that would stop you doing this?

Regards,
Graham
--
-
[EMAIL PROTECTED]   "There's a moon
over Bourbon Street
tonight..."
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Introduction and a proprosal to add new functionality to Struts: Automatic highlighting of errored form elements

2003-06-09 Thread Graham Leggett
Jeff Robertson wrote:

Do you also have an alternate style for the input's label text?

For instance, a form often looks like this:

 
 
 
If the "address" property fails validation, then one would normally expect
that the bean message (which probably just displays the word "Enter you
Address Here" or something) would be highlighted as well.
Something else that's useful is to highlight something that might have 
changed, or a field that is new, in an environment that contains workflow.

Pablo Casado and myself came up with some code that compared beans using 
reflection to compare the values of the getters in the bean. If 
bean.getFoo() was different to bean2.getFoo(), then a String "foo" was 
added to a List.

If the string "foo" existed in the List, then the style on that element 
was rendered as "changed" (in our case blue text instead of black text).

If anyone wants to look at the code, just shout.

Regards,
Graham
--
-
[EMAIL PROTECTED]   "There's a moon
over Bourbon Street
tonight..."
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: compiling 1.1 beta 3 problems

2003-01-22 Thread Graham Leggett
Robert Leland wrote:


What version of commons logging should I be using?



Download the latest nightly binary build and use those jars
to build your patch against.


With Struts v1.1b3 being declared RC1, why does a release candidate have 
a dependancy on another project's nightly build?

Regards,
Graham
--
-
[EMAIL PROTECTED]		"There's a moon
	over Bourbon Street
		tonight..."


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 



[PATCH] allow relative actions in struts-config.xml

2003-01-09 Thread Graham Leggett
Hi all,

The attached patch allows relative paths to be specified for actions 
defined in the action-mappings element of struts-config.xml.

If the path attribute of the action element is specified without a 
leading slash, struts now suffix matches the action-mapping paths 
against the path in the request, instead of doing an exact match. 
Previously in this case the path would never match.

If the path attribute is specified with a leading slash, the behaviour 
is to find an exact match the same as now.

This feature is useful where you want struts to ignore directories in 
your URL, for example:

http://somewhere/context/struts/-country-/show/info.do might display 
info on a particular "country". Defining the action-mapping path as 
"show/info" will match all URLs ending with "show/info.do" regardless of 
the value of "-country-".

Previously "-country-" would have to be specified as either a cookie 
(not always on), in the session (which may be lost at any time), or as a 
parameter (requiring link mangling on pages).

Comments...?

Regards,
Graham
--
-
[EMAIL PROTECTED]		"There's a moon
	over Bourbon Street
		tonight..."
--- ApplicationConfig-orig.java Thu Jan  9 13:48:14 2003
+++ ApplicationConfig.java  Thu Jan  9 13:50:50 2003
@@ -66,6 +66,8 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
+
 import javax.servlet.ServletException;
 import javax.servlet.UnavailableException;
 
@@ -363,8 +365,23 @@
  */
 public ActionConfig findActionConfig(String path) {
 
-return ((ActionConfig) actionConfigs.get(path));
+/* check absolute references */
+ActionConfig config = ((ActionConfig) actionConfigs.get(path));
+if (config != null) {
+return config;
+}
+
+/* check relative references */
+Iterator i = actionConfigs.keySet().iterator();
+while (i.hasNext()) {
+String configPath = (String)i.next();
+if (configPath.charAt(0) != '/' && path.endsWith(configPath)) {
+return (ActionConfig)actionConfigs.get(configPath);
+}
+}
 
+/* neither absolute nor relative paths matched */
+return null;
 }
 
 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: