RE: Unit Testing Advice

2008-11-07 Thread Gundersen, Richard
in the direction of the Xwork source used to build Struts 2.0.12 please? Thanks. Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS -Original Message- From: Gundersen, Richard [mailto:[EMAIL

RE: Unit Testing Advice

2008-11-07 Thread Gundersen, Richard
] Sent: Friday, November 07, 2008 11:08 AM To: Struts Users Mailing List Subject: Re: Unit Testing Advice Is this what you're looking for? http://svn.opensymphony.com/svn/xwork/tags/xwork_2_0_6/ Nils-H On Fri, Nov 7, 2008 at 12:02 PM, Gundersen, Richard [EMAIL PROTECTED] wrote: Hi, I'm still

Unit Testing Advice

2008-11-06 Thread Gundersen, Richard
Hi Just after a bit of advice for the best way to unit test my Struts 2 app. I'm using a fairly standard Spring/Struts2/JPA/Junit architecture, and my tests need access to all my spring beans (which I'm doing using @Resource tags) The only sticking point is setting up all of the fake 'request'

RE: Unit Testing Advice

2008-11-06 Thread Gundersen, Richard
This is what I have so far. It works but I would appreciate a little peer review (particularly regarding how I set up my session and the logged in user) Thanks! @Resource private CardPaymentAction cardPaymentAction; ActionContext

RE: Unit Testing Advice

2008-11-06 Thread Gundersen, Richard
... Nils-H On Thu, Nov 6, 2008 at 1:53 PM, Gundersen, Richard [EMAIL PROTECTED] wrote: This is what I have so far. It works but I would appreciate a little peer review (particularly regarding how I set up my session and the logged in user) Thanks

RE: Unit Testing Advice

2008-11-06 Thread Gundersen, Richard
Hi I just have one smallish question: for some reason my messages.properties isn't being loaded. It's configured in struts.xml constant name=struts.custom.i18n.resources value=messages / ...and I know that file is generally working because all the other Struts stuff is working. I'm getting this

RE: Programming help for a print function

2008-11-06 Thread Gundersen, Richard
I've just done the same thing - although it's nothing to do with Struts var a = window.open('','','width=500,height=400'); a.document.open(text/html); a.document.write(document.getElementById('receipt').innerHTML); a.document.close(); a.print(); a.close();

Custom Exception Interceptor

2008-10-29 Thread Gundersen, Richard
Hi I'm trying to override the default global exception handler, because I need to remove a certain session attribute when an exception occurs. I think I've done most of what's needed, it's just not being executed. This is my struts.xml (I need my 'exception' to replace the one in the default

RE: Custom Exception Interceptor

2008-10-29 Thread Gundersen, Richard
: Gundersen, Richard [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2008 11:18 AM To: Struts Users Mailing List Subject: Custom Exception Interceptor Hi I'm trying to override the default global exception handler, because I need to remove a certain session attribute when an exception

RE: Which is Best book for Struts 1.2.9??

2008-10-29 Thread Gundersen, Richard
If you're starting from scratch, why not use Struts 2 instead? I used 'Practical Struts 2: Web 2.0 Projects' by Ian Roughly (who wrote a lot of Struts 2 I think??) to get to grips with the basics. It's easy to read and flows nicely, building an app step by step (as opposed to the Spring docs

s:url losing jsessionid in a cluster

2008-10-28 Thread Gundersen, Richard
Hi I'm using URL rewriting (I can't use session cookies for certain reasons). In my code, I have this: s:url id=url value=%{#session['currentTransaction'].url}/ Locally, this generates my URL perfectly - preserving the jsessionid - like this:

RE: s:url losing jsessionid in a cluster

2008-10-28 Thread Gundersen, Richard
between your tomcat servers? Do you use apache with mod_proxy, or mod_jk maybe or anything else? I had problems while using such architecture because of the way that tomcat build url from values present in the http header. Regards Sébastien Gundersen, Richard a écrit : Hi I'm using URL

Detect errors in OGNL

2008-10-15 Thread Gundersen, Richard
Hi Is there an easy way to say 'if validation errors exist', in OGNL? Tried a few things but not hit on the right syntax yet e.g. if %{errorFieldNames.size() 0} etc etc Thanks Richard Gundersen As a responsible corporate citizen, London Scottish Bank plc asks you to consider the

RE: Detect errors in OGNL

2008-10-15 Thread Gundersen, Richard
Doh, got it %{errors.size} Silly me :) Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS -Original Message- From: Gundersen, Richard [mailto:[EMAIL PROTECTED] Sent

RegexFieldValidator

2008-10-07 Thread Gundersen, Richard
Sorry, basic question but my RegexFieldValidator isn't working quite as I thought it would. I just want to be able to specify a decimal point, so I escape the dot, but the compiler complains. Could someone tell me how to specify 12345.67 as a regex for this? ^[0-9]{1,5}\.[0-9]{2}$

RE: RegexFieldValidator

2008-10-07 Thread Gundersen, Richard
: Gundersen, Richard [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2008 11:09 AM To: Struts Users Mailing List Subject: RegexFieldValidator Sorry, basic question but my RegexFieldValidator isn't working quite as I thought it would. I just want to be able to specify a decimal point, so I

VisitorFieldValidator - different validation scenarios

2008-09-19 Thread Gundersen, Richard
Hi I'm using the VisitorFieldValidator (annotations) to push validation over to my model object in my Action. However, I want the validation rules in my model object to work differently depending on which Action method is being called. What's the best way of doing this please? Richard

Validation based on other fields

2008-09-04 Thread Gundersen, Richard
Hi In Struts 2, I need to perform some validation based on other fields e.g. if cardType = 'Switch', issueNumber is mandatory I was looking for something like the validWhen tag from Struts 1. I'd like to do it with the client side javascript if possible (to prevent having to reload the

RE: Validation based on other fields

2008-09-04 Thread Gundersen, Richard
Cheers Dave, I'll check it out in the morning Appreciate you help -Richard -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Thu 04/09/2008 17:14 To: Struts Users Mailing List Subject: Re: Validation based on other fields --- On Thu, 9/4/08, Gundersen, Richard

Base64 Newlines

2008-09-02 Thread Gundersen, Richard
Hi I'm stuggling a bit with a parameter I need to pass through to a JSP in a frame. It's a base64-encoded string, so I thought I'd be able to just pass it through as a request parameter, but I found out it contains newline chars every 64 characters (which I read is correct), so any JavaScript I

Invalidating session

2008-08-27 Thread Gundersen, Richard
Hi all I came across this page for invalidating the session http://struts.apache.org/2.0.11.2/docs/how-do-we-get-invalidate-the-sess ion.html It mentions this way of invalidating the session: if (session instanceof org.apache.struts2.dispatcher.SessionMap) {

RE: Credit card validator

2008-08-27 Thread Gundersen, Richard
: Wednesday, August 27, 2008 3:47 PM To: Struts Users Mailing List Subject: Re: Credit card validator Don't know if it helps you, but Hibernate Validator has a credit card validator. It will work with JPA providers other than just Hibernate. On Thu, Aug 21, 2008 at 10:39 AM, Gundersen, Richard [EMAIL

Credit card validator

2008-08-21 Thread Gundersen, Richard
Sorry if I'm missing something obvious, but can someone tell me if there's a credit card validator in Struts 2? There's one in Struts 1, and in Struts 2 I found creditCard.js, which uses the Luhn algorithm, but I cant figure out a) how to use it or b) if there is a corresponding annotation for

RE: Credit card validator

2008-08-21 Thread Gundersen, Richard
Manchester M2 3LS -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2008 3:17 PM To: Struts Users Mailing List Subject: Re: Credit card validator --- On Thu, 8/21/08, Gundersen, Richard wrote: can someone tell me if there's a credit card validator

RE: 2 Validation questions

2008-08-06 Thread Gundersen, Richard
To: Struts Users Mailing List Subject: Re: 2 Validation questions Gundersen, Richard wrote: Hi Basic question sorry (looked all over but can't find the answer) 1) When validation fails for my 'username' textfield, the error message is displayed ABOVE the text box. Is it possible to have

2 Validation Questions

2008-08-05 Thread Gundersen, Richard
Would really appreciate any help with the following (sent yesterday). Just a pointer to some good docs would be great - Basic question sorry (looked all over but can't find the answer) 1) When validation fails for my 'username' textfield, the error message is

RE: 2 Validation Questions

2008-08-05 Thread Gundersen, Richard
for the textfield tag too. 2) IIRC, this javascript validation bug was resolved in the 2.1.x branch. 2008/8/5 Gundersen, Richard [EMAIL PROTECTED]: Would really appreciate any help with the following (sent yesterday). Just a pointer to some good docs would be great - Basic

2 Validation questions

2008-08-04 Thread Gundersen, Richard
Hi Basic question sorry (looked all over but can't find the answer) 1) When validation fails for my 'username' textfield, the error message is displayed ABOVE the text box. Is it possible to have more fine-grained control over how to position the error message. Ideally I would like it below

RE: Re: Wierd Validation

2008-07-31 Thread Gundersen, Richard
-Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Wednesday, July 30, 2008 10:18 PM To: user@struts.apache.org Subject: Re: Wierd Validation Gundersen, Richard wrote: Hi When validation succeeds on my form, I still get returned to the input page

Wierd Validation

2008-07-30 Thread Gundersen, Richard
Hi When validation succeeds on my form, I still get returned to the input page. My execute() method does not seem to be getting called even when validation is OK. This is my Action (no @Validation annotation after I read that was deprecated)

RE: dynamic forwarding from Action class to any url

2007-09-07 Thread Gundersen, Richard
I do it this way (create a new ActionForward with the url you want in the Action method you are executing, and just return that instead of doing mapping.findForward... ActionForward forward = new ActionForward(url); return forward; Richard

RE: Requiredif validator

2007-09-07 Thread Gundersen, Richard
Hi Pablo Try using validwhen instead - I think rewquiredif was deprecated. I changed all mine and you can achive the same thing although your logic might have to be turned around a bit. Here's an example: form name=completionForm extends=commonBankForm field

Quick question about getParameterValues

2007-09-06 Thread Gundersen, Richard
Hi I was wondering if I can rely on the order of the values returned by request.getParameterValues()? In my form I have a checkbox, and then underneath I have a hidden field with the same name. I do this in case the checkbox is unchecked (and hence the value would not be sent). This way I

RE: DownloadAction and a normal Forward

2007-08-02 Thread Gundersen, Richard
, Gundersen, Richard wrote: Hi Thanks for the reply. Tried it and it still gives me a NullPointer. Maybe that's not such a problem though - since the browser still redirects to the JSP I want. However, I was wondering if it's possible to use a ResourceStreamInfo to redirect to an ActionForward

DownloadAction and a normal Forward

2007-08-01 Thread Gundersen, Richard
Hi I'm using a DownloadAction to generate a PDF and return it the the browser. If there is a problem generating the PDF however, I want to redirect the user to a specific JSP. What's the best way of doing this? At the moment I am using protected StreamInfo getStreamInfo(ActionMapping

RE: DownloadAction and a normal Forward

2007-08-01 Thread Gundersen, Richard
(2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, August 1, 2007 9:24 am, Gundersen, Richard wrote: Hi I'm

RE: Re: DynaValidatorForm and BigDecimal problem

2007-03-02 Thread Gundersen, Richard
' for one of your money fields, you wont be able to re-display their incorrect input. That's the other major reason for making your form fields String-typed. L. Gundersen, Richard wrote: Actually, I tried out your first solution, and it actually works very nicely too, so I'm going to go

DynaValidatorForm and BigDecimal problem

2007-03-01 Thread Gundersen, Richard
Hi Has anyone had problems with BigDecimal and DynaValidatorForms? I've got a form with two fields (advisorFee and grossIncome) defined as java.lang.Double. I want to change them to java.math.BigDecimal because they are money fields. If I change advisorFee to BigDecimal, the validation fails

RE: DynaValidatorForm and BigDecimal problem

2007-03-01 Thread Gundersen, Richard
this populated by your action after validation succeeds. -ed On 3/1/07, Gundersen, Richard [EMAIL PROTECTED] wrote: Hi Has anyone had problems with BigDecimal and DynaValidatorForms? I've got a form with two fields (advisorFee and grossIncome) defined as java.lang.Double. I want to change them

RE: DynaValidatorForm and BigDecimal problem

2007-03-01 Thread Gundersen, Richard
. -ed On 3/1/07, Gundersen, Richard [EMAIL PROTECTED] wrote: Hi Has anyone had problems with BigDecimal and DynaValidatorForms? I've got a form with two fields (advisorFee and grossIncome) defined as java.lang.Double. I want to change them to java.math.BigDecimal because they are money fields

RE: OFF RECORD

2006-12-21 Thread Gundersen, Richard
Um, this might be wrong but I think you could open a connection using URLConnection (or similar), and hit the JSP URL that way. That should return a response (containing the HTML source) that you can then use for whatever you want. Not tried it though so I could be talking rubbish. Richard

Brackets in validation.xml

2006-12-12 Thread Gundersen, Richard
Hi Can anyone please tell me why this works. It's two versions of a validation rule from my commons validator xml file (for a validwhen condition): ( ( (oldProductStatusId == 21) and ((productStatusId == 21) or (productStatusId == 23) ) ) or ( (oldProductStatusId == 23) and

RE: Brackets in validation.xml

2006-12-12 Thread Gundersen, Richard
is it?! ;-) Cheers Richard -Original Message- From: Christopher Schultz [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 12, 2006 2:55 PM To: Struts Users Mailing List Subject: Re: Brackets in validation.xml -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Richard, Gundersen, Richard wrote

RE: Brackets in validation.xml

2006-12-12 Thread Gundersen, Richard
, Gundersen, Richard wrote: Can anyone please tell me why this works. It's two versions of a validation rule from my commons validator xml file (for a validwhen condition): The parser that the validation package uses cannot parse expressions of the form A or B or C (or can be replaced

RE: Re: Map backed properties

2006-12-06 Thread Gundersen, Richard
provided? L. Gundersen, Richard wrote: Hi Thanks for replying. I have tried that actually and it didn't work. In fact that particular example wont work for me unfortunately because my property isn't part of a map inside a DynaActionForm - it's just a normal member variable of a class that extends

RE: Map backed properties

2006-12-05 Thread Gundersen, Richard
- From: Strachan, Paul [mailto:[EMAIL PROTECTED] Sent: Monday, December 04, 2006 11:23 PM To: Struts Users Mailing List Subject: RE: Map backed properties try something like: c:if test=${formname.map.checklistItemNoteIds[120] == 7} ... /c:if -Original Message- From: Gundersen, Richard

RE: Formatting numbers in text field

2006-12-05 Thread Gundersen, Richard
If you are using an ActionForm, you could modify your getter to do the formatting. Or, have an additional getter method e.g. Double amount; Double getAmount() { // bog standard method } String getFormattedAmount() { // do some formatting } Then, in the form, do something like

Map backed properties

2006-12-04 Thread Gundersen, Richard
Hi I've been happily working with map based properties in my forms for a while now, but I've come across something that I really can't figure out. I started off with a DynaValidatorForm, and in the mapping, I had this: form-property name=checklistItemNoteIds type=java.util.HashMap/

RE: [OT] Did JIRA copy from LucasArts?

2006-12-04 Thread Gundersen, Richard
Forget about the logo and help me with my Map-backed property problem - I'm desperate! Only kidding! ;-)) -Original Message- From: Romu [mailto:[EMAIL PROTECTED] Sent: Monday, December 04, 2006 2:14 PM To: Struts Users Mailing List Subject: Re: [OT] Did JIRA copy from LucasArts?

RE: tiles: error

2006-12-04 Thread Gundersen, Richard
It could be that you have an error INSIDE the tile JSP. Are you doing anything that could result in a null pointer? -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of maya Sent: Monday, December 04, 2006 4:01 PM To: user@struts.apache.org Subject: tiles: error please

RE: Date validation

2006-11-22 Thread Gundersen, Richard
This is how I do it: constant constant-namedateFormat/constant-name constant-valuedd/MM//constant-value /constant ... ... field property=dob depends=date ... var var-namedatePattern/var-name var-value${dateFormat}/var-value /var /field -Original

RE: Logging to db

2006-11-21 Thread Gundersen, Richard
Log4j provides this functionality Look at the docs for these two classes org.apache.log4j.jdbcplus.JDBCLogger; org.apache.log4j.jdbcplus.JDBCSqlHandler; I've implemented it here, and it works great. Richard -Original Message- From: Søren Blidorf [mailto:[EMAIL

RE: session maintenance in struts webapp

2006-11-21 Thread Gundersen, Richard
Maybe you could have a bit of JavaScript in a tile or other include that's in all your pages. Whenever a page loads, the session idle time will be reset automatically, so you will have session-timeout seconds before it expires. In the JavaScript, you could just do a simple loop that counts down

Map-Backed ActionForm without using scriptlets

2006-11-21 Thread Gundersen, Richard
Hi Is there a clean way to use map-backed ActionForms in a JSP without using scriptlets? Say I have a map of properties called 'userAttributes' in my ActionForm. I want to loop through these using something like a c:forEach, and then for each one I find, I want to display an html:text