TypeConverters - multiple fields/values

2010-02-14 Thread Andy Sykes
Hi list, I'm extending the StrutsTypeConverter and writing my own type converter. Is there any way to have the type converter reference multiple fields in order to construct a complex type? I notice the method signature for convertFromString has three parameters - one of them is a String array

Re: how to eliminate time in

2010-02-20 Thread Andy Sykes
You could write your own type converter - see type conversion in the S2 docs for a good overview. It handles the conversion of any Java object in your model class to a String for use in the view, and converts any String field into a Java object in forms/GET parameters. That way you have total c

and parameters

2009-04-16 Thread Andy Sykes
Hi all, How can I use parameters passed in to a jsp file with in a Struts2 tag within that JSP? So for example, I want to include a big chunk of boilerplate HTML and pass in an image name, then use that passed-in name in an tag to reference it. Include: prettything.jpg The

Re: recipes for 2.0.x?

2009-04-17 Thread Andy Sykes
Out of interest (and sorry for slight thread hijacking) - what's so bad about the Dojo tags? Now the Dojo stuff is deprecated, is there a roadmap to replacing them with something else? On 17 Apr 2009, at 20:30, Musachy Barroso wrote: I am not sure it is related, but make sure "showLoading

Re: recipes for 2.0.x?

2009-04-18 Thread Andy Sykes
DWR is bloody ace - don't know how that slipped under my radar. Cheers for the heads-up. Andy. On 17 Apr 2009, at 21:24, Musachy Barroso wrote: I am not sure what the status of the DWR plugin is, but I don't think it has changed much. The DWR plugin just hooks DWR with Struts 2, nothing more

Re: How to do matematical operation in jsp.

2009-04-22 Thread Andy Sykes
Abstract the HashMap behind another class that has a getTotal(Item key) method, and do the math in there (return item.prize * quantity). Doing any math in the JSP feels dirty. On 22 Apr 2009, at 13:16, Stefano Tranquillini wrote: Because the items are stored in hashmap item contains the p

Re: pagination in struts2

2009-04-22 Thread Andy Sykes
Have a look at the external sorting and pagination page[1] on the DisplayTag site. Also, take a look at the PaginatedList interface[2]. It takes a little bit to get your head around it. If you get stuck, the displaytag lists are pretty good at helping with the common issues. Andy. [1] ht

Re: pagination in struts2

2009-04-23 Thread Andy Sykes
I found I had to use the tag to set the object in the request scope before displaytag could "see" it, since displaytag doesn't know about the Value Stack (maybe it should?). Confusingly, displaytag gives you that message if it can't see the variable you're referencing, as well as if the va

OGNL & DisplayTag = inappropriate expressions

2009-04-30 Thread Andy Sykes
Hi all, Is there a way to prevent OGNL from analysing GET parameters as expressions? Reason for asking: DisplayTag generates URLs like this: action?d-49653-p=2 I'm getting tons of errors in the log, where it looks like OGNL is trying to evaluate this as: (d minus 49653 minus p). Naturally

Re: OGNL & DisplayTag = inappropriate expressions

2009-04-30 Thread Andy Sykes
f the regex, will be ignored. We should make a FAQ out of this question. musachy On Thu, Apr 30, 2009 at 3:47 PM, Andy Sykes wrote: Hi all, Is there a way to prevent OGNL from analysing GET parameters as expressions? Reason for asking: DisplayTag generates URLs like this: action?d-49653-p=2

Re: Submitting a Date to an Action

2009-05-01 Thread Andy Sykes
I wrote my own method based on having three select dropdown boxes for the date - day, month and year. Rather than do it as a type converter, I did it as an interceptor, with three getters/setters in the action (getStartTime_Day, getStartTime_Month, getStartTime_Year). The interceptor uses

Re: File upload (jupload)--how to disable struts2' fileupload interceptor?

2009-05-16 Thread Andy Sykes
I can't see anywhere in the documentation (I've only had a quick skim of it) that says not mapping the Struts dispatcher to /* can be dangerous.. the only example I can see is if you're using Struts interceptors/actions for webapp security - in which case hitting a servlet directly might me

Re: [S2] When/How are Actions Created?

2009-05-19 Thread Andy Sykes
1. It's created when the Struts dispatcher filter receives a request that matches an element in the XML configuration file. Xwork handles the creation, I believe (Struts internal DI framework). You're running with Spring as the container, which mean Spring does the action creation based on

Re: Block accessing in some path with filter.

2009-05-20 Thread Andy Sykes
Put the mapping for the admin filter above the struts2 filter. Filters are invoked in the order in web.xml, first to last. The struts filter is catching the request first and dispatching it before it ever reaches the admin filter. On 20 May 2009, at 09:37, Stefano Tranquillini wrote: Hi a

Re: Block accessing in some path with filter.

2009-05-20 Thread Andy Sykes
urce (/WAP-Shop-war/denied.action) is not available. but is available! ideas? On Wed, May 20, 2009 at 13:35, Andy Sykes wrote: Put the mapping for the admin filter above the struts2 filter. Filters are invoked in the order in web.xml, first to last. The struts filter is catching the request

Re: Block accessing in some path with filter.

2009-05-21 Thread Andy Sykes
Read the section on the config file elements in struts.xml on the Struts2 docs site. Also read the Interceptors guide[1]. You have to specify the interceptor stack on the action. You can use the element to specify what stack to use by default. And what you've defined is not an intercepto

Netbeans 6.7 RC3 and Struts2

2009-06-19 Thread Andy Sykes
Hi all, Is anyone else using NB 6.7 RC3 and editing pages with S2 tags in them? The tags seem to really screw up the editor's error parsing mechanism, leaving red lines under everything after an S2 tag (like ), and giving an error of "missing ; before statement" which looks like a Javascri

Re: Please help! Validation Errors

2008-12-10 Thread Andy Sykes
Faraz, When using validation, the input result tells Struts where to dispatch/ redirect to if there's a validation error. When you submit the form, Struts checks the fields against the validation XML - if there's an error, it adds FieldError objects to the FieldErrors object on the value s

Re: Please help! Validation Errors

2008-12-10 Thread Andy Sykes
Wed, Dec 10, 2008 at 6:19 PM, Andy Sykes <[EMAIL PROTECTED]> wrote: Faraz, When using validation, the input result tells Struts where to dispatch/redirect to if there's a validation error. When you submit the form, Struts checks the fields against the validation XML - if there

Re: redirection problem with name is input

2008-12-12 Thread Andy Sykes
I could be wrong, but I thought you could only pass the FieldErrors back to a JSP using a dispatcher result, not a redirect-action. Andy. On 12 Dec 2008, at 12:34, Seshagiri V wrote: Hi All, Mapping with redirection type and name is "input" and value is null but I am not able to valida

Validation and dispatcher

2008-12-13 Thread Andy Sykes
pproaching the rich forms generation the wrong way, and there's a better way? Thanks for any advice, since I'm banging my head against the wall on this - I must be missing something obvious. Cheers, Andy. -- Andy Sykes IT Support Officer UCL Museums & Collections / Media Res

Re: Validation and dispatcher

2008-12-13 Thread Andy Sykes
. Andy. On 13 Dec 2008, at 16:26, Andy Sykes wrote: Hi all, I've got an action called "edit" that prepares some objects for use in a form (Lists for select tags, etc), then dispatches to the JSP form. It's dependent on having a parameter passed to it via a GET url (e.g

Re: alignment problem in struts2

2008-12-16 Thread Andy Sykes
Hi, No idea why it doesn't work - I found the XHTML theme to be a bit cumbersome for anything other than a stack of fields, one on top of the other. Use the simple theme - it'll give you more flexibility. You can write your own themes as well. For getting the validation errors in the si

Re: preparable inceptor and validation

2008-12-16 Thread Andy Sykes
Hi, My simple solution to the same problem was to check if any validation errors had occurred at the end of the validation method [with hasFieldErrors()], then call my prepareXXX method from there. On 16 Dec 2008, at 05:39, srinivasa_v . wrote: Hi All, I have sistutation where I need to

Re: OGNL exceptions are swallowed by struts2

2009-01-09 Thread Andy Sykes
If you're running with log4j in your app, set the logging priority on the root logger to debug. It spews a lot of messages, and the type converter messages are there - I was using this facility the other day when trying to upgrade an existing app from 2.0.x to 2.1.2. Andy. On 9 Jan 2009, a

Only call actions from certain forms

2009-01-23 Thread Andy Sykes
Hi all, My forms all submit to a different action than that which renders the pages. Is there a recommended way to prevent/mitigate the effect of users directly calling the actions (via their URL) that forms are submitted to? In this case, the actions' fields are null, which is somewhat

Re: Only call actions from certain forms

2009-01-23 Thread Andy Sykes
herwise! Andy. On 24 Jan 2009, at 02:52, Dave Newton wrote: Andy Sykes wrote: My forms all submit to a different action than that which renders the pages. Is there a recommended way to prevent/mitigate the effect of users directly calling the actions (via their URL) that forms are submit

Re: Upgrading Struts 2

2009-01-24 Thread Andy Sykes
Hi, We've migrated an app from 2.0.11 to 2.1.2 (and then to 2.1.6 when it became GA - this was a trivial upgrade). I found this article on the Apache wiki very useful: http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html I had no major issues - and the

Re: Only call actions from certain forms

2009-01-24 Thread Andy Sykes
action's own result code will override the interceptor-set result. Andy. On 24 Jan 2009, at 17:56, Dave Newton wrote: Andy Sykes wrote: Cheers for the suggestions - I guess I was just looking for a sanity check from the list. It seems reasonable to me--the functionality *could* be

Re: Only call actions from certain forms

2009-01-24 Thread Andy Sykes
Doh. I was being very stupid - I looked in the XWork source and realised it's really straightforward. I'm blaming this one of lack of sleep :) Cheers, Andy. On 25 Jan 2009, at 01:25, Wes Wannemacher wrote: On Saturday 24 January 2009 20:17:49 Andy Sykes wrote: Actually,

Casting an action to an interface

2009-01-29 Thread Andy Sykes
Hi all, I've written an interceptor with a PreResultListener that gets the action with ActionInvocation.getAction(), then casts it to an interface ("Parseable", in this case). This lets me call a particular method on the action just prior to the result being rendered. The action implement

Re: Casting an action to an interface

2009-01-30 Thread Andy Sykes
at 00:55, Wes Wannemacher wrote: On Thursday 29 January 2009 19:49:39 Andy Sykes wrote: Hi all, I've written an interceptor with a PreResultListener that gets the action with ActionInvocation.getAction(), then casts it to an interface ("Parseable", in this case). This lets me call

Re: Casting an action to an interface

2009-01-30 Thread Andy Sykes
rchy? That could explain certain "should never happen" incidents... Nils-H On Fri, Jan 30, 2009 at 12:39 PM, Andy Sykes wrote: Hi Wes, No, I'm not using Spring at all. The Action never passes the test of being an instanceof Parseable. If I make the action only impleme

Re: Casting an action to an interface

2009-01-30 Thread Andy Sykes
...snip... if (action instanceof SessionAware) { ((SessionAware) action).setSession(context.getSession()); } } } On 30 Jan 2009, at 12:22, Andy Sykes wrote: No, I don't 'need' the ca

Re: Casting an action to an interface

2009-01-30 Thread Andy Sykes
ng this. Cheers for the help, Andy. On 30 Jan 2009, at 15:03, Dave Newton wrote: If you have a small project you could host somewhere that might help, or just zip up all the source. Clearly this can't happen (ignoring for the moment that it is), but the framework obviously relies on t

Pagination and s:subset

2009-03-20 Thread Andy Sykes
Hi list, After bodging my way through some pagination for a project I'm working on with a combination of OGNL expressions, s:subset and s:iterator, I was wondering if anyone had given any serious thought to the practicality of implementing displaytag-style pagination in S2 tags? Display t