S2 tags - dynamic attributes

2008-09-03 Thread Jonny Cavell

What I need to do is very simple, but I'm beginning to wonder whether Struts2
actually lets me do it.

Firstly, I want the id attribute of any HTML tag to take a dynamic value, so
that I can code it at runtime.
Secondly I want the tag to take e.g. dojoType as an attribute:






Neither of these work.
If I can't do this (or use a simple workaround), I cannot use Struts tags.
Is it possible?

Jonny
-- 
View this message in context: 
http://www.nabble.com/S2-tags---dynamic-attributes-tp19291646p19291646.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Avoid having an action property called id

2008-06-25 Thread Jonny Cavell

This  http://www.vitarara.org/cms/struts_2_cookbook/post_and_redirect article
about post and redirect in struts 2  explains how to redirect to a
dynamically evaluated action.

However, if I use a param which references an action property called "id",
it doesn't work. 


  ${redirectActionName}
  /admin/holidays
  true
  ${id}


But when I changed the property (and its getter and setter) to be called
"aid", it works OK:

  .. as above...
  ..
  ${aid}



Also (possibly unrelated), again with a property called id on my action,
when I use the  tag, it automatically adds the current value of
the action's id to the URL even if I don't want it to. The docs don't
mention that this should happen (it's annoying).

It seems as if naming an action property id should be avoided...
-- 
View this message in context: 
http://www.nabble.com/Avoid-having-an-action-property-called-id-tp18115239p18115239.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Freemarker (old version that struts2 uses) disappearing pages

2008-04-04 Thread Jonny Cavell

I use Maven, and if you look at struts 2.0.11.1's dependencies
(http://www.mvnrepository.com/artifact/org.apache.struts/struts2-core/2.0.11.1)
you'll see that it's Freemarker version 2.3.8 it depends on. I can't
override this in Maven, even if I attempt to exclude it and force the latest
version of Freemarker:



org.apache.struts
struts2-core
2.0.11


org.freemarker
freemarker




org.freemarker
freemarker
2.3.12



Cheers

Jonny


Jeromy Evans - Blue Sky Minds wrote:
> 
> Jonny Cavell wrote:
>> I have a problem that seems to occur periodically.
>>
>> My freemarker templates, served by struts2, stop appearing - I get a
>> blank
>> page. There are no useful messages in the logs, other than saying that it
>> couldn't find the template (which it could find previously).
>>
>> First question - does anybody know what this problem might be?
>>
>>   
> No, other than a classpath/deployment problem.
>> I would like to upgrade to the latest version of Freemarker. However,
>> Struts2 in its wisdom has locked me down to version 2.3.8, and this was
>> released way back in 2006. Are there any plans to resolve this issue? 
>>
>>   
> The 2.1.1 version of Struts uses FreeMarker 2.3.11   You may be able to 
> replace the 2.3.8 jar with the 2.3.11 jar without problems.
> 
> I doubt the problem is with FreeMarker.  It's more likely to be the 
> FreeMarkerManager included with Struts 2 that's responsible for 
> searching for templates in the classpath.
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Freemarker-%28old-version-that-struts2-uses%29-disappearing-pages-tp16467449p16487687.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Freemarker (old version that struts2 uses) disappearing pages

2008-04-03 Thread Jonny Cavell

I have a problem that seems to occur periodically.

My freemarker templates, served by struts2, stop appearing - I get a blank
page. There are no useful messages in the logs, other than saying that it
couldn't find the template (which it could find previously).

First question - does anybody know what this problem might be?

I would like to upgrade to the latest version of Freemarker. However,
Struts2 in its wisdom has locked me down to version 2.3.8, and this was
released way back in 2006. Are there any plans to resolve this issue? 

I was hoping that upgrading might fix my problems..

Jonny




-- 
View this message in context: 
http://www.nabble.com/Freemarker-%28old-version-that-struts2-uses%29-disappearing-pages-tp16467449p16467449.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [struts] Being driven mad by the ParametersInterceptor

2008-03-07 Thread Jonny Cavell

Yes, you're right that they are just warnings and I could eliminate them with
logging config; also yes I'm running in devMode.

Looking at the source, the exception will always be thrown and logged
though, even when not in devMode.

I've noticed there's a NoParameters marker interface which actions can
implement to specify there should be no automatic setting of params.

Cheers

Jonny 


Kropp, Henning wrote:
> 
> Dale Newfield schrieb:
>> Jonny Cavell wrote:
>>> So that brings me back to the original problem - getting all these Error
>>> setting expression 'xxx' with value '[Ljava.lang.String;@19a82ee' 
>>> messages
>>> for every single parameter that doesn't have an associated setter 
>>> method on
>>> the action. How do I stop these errors?
>>
>> Unless I'm mistaken, those are not errors, just WARNings.  You are 
>> free to change your logging levels so they don't make it into your log 
>> files.
> As I am experiencing the same problems by now. I have checked and those 
> messages are not logged if devMode is turned off.
>>
>> -Dale
>>
>> -
>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Being-driven-mad-by-the-ParametersInterceptor-tp15878320p15891101.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Being driven mad by the ParametersInterceptor

2008-03-06 Thread Jonny Cavell

I haven't moved the checkbox interceptor, but of course the order has changed
- in the default stack the checkbox interceptor comes before the params
interceptor.

This highlights a problem in the way that interceptors are configured. If I
want to remove one from the default stack, I can't then easily put it back
in the same place for a specific action.

So that brings me back to the original problem - getting all these Error
setting expression 'xxx' with value '[Ljava.lang.String;@19a82ee' messages
for every single parameter that doesn't have an associated setter method on
the action. How do I stop these errors?

Cheers

Jonny


newton.dave wrote:
> 
> --- Jonny Cavell <[EMAIL PROTECTED]> wrote:
>> Fed up with messages such as Error setting expression 'xxx' with value
>> '[Ljava.lang.String;@19a82ee', I got rid of this Interceptor from my
>> default stack.
>> 
>> However, I wanted to use it for a particular action, so I added it there.
>> It took me a while to work out that it needed to go before the default
>> interceptor stack (got loads of misleading error messages).
> 
> That depends on how you've defined your custom interceptor stack. In the
> supplied defaultStack it's 14th out of 17 interceptors, which isn't a lot
> like it being first.
> 
>> When I did add it, I found that I got lots of checkbox related warnings:
>>  Error setting expression '__checkbox_xxx' with value
>> '[Ljava.lang.String;@891a0'
>> 
>> Am I doing anything wrong, or does this interceptor suck big time?
> 
> Most likely you're doing something wrong.
> 
> I would be cautious with the in/exclusion and order of parameter-oriented
> interceptors without understanding how they work. For example the
> "checkbox"
> interceptor modifies the parameter list passed on to the next interceptor.
> The error message above, at first glance, would lead me to believe you
> have
> removed the checkbox interceptor from your custom stack.
> 
> Dave
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Being-driven-mad-by-the-ParametersInterceptor-tp15878320p15879264.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Being driven mad by the ParametersInterceptor

2008-03-06 Thread Jonny Cavell

Fed up with messages such as Error setting expression 'xxx' with value
'[Ljava.lang.String;@19a82ee', I got rid of this Interceptor from my default
stack.

However, I wanted to use it for a particular action, so I added it there. It
took me a while to work out that it needed to go before the default
interceptor stack (got loads of misleading error messages).

When I did add it, I found that I got lots of checkbox related warnings:
 Error setting expression '__checkbox_xxx' with value
'[Ljava.lang.String;@891a0'

Am I doing anything wrong, or does this interceptor suck big time?

Thanks

Jonny

-- 
View this message in context: 
http://www.nabble.com/Being-driven-mad-by-the-ParametersInterceptor-tp15878320p15878320.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Spring-injected model results in error for ModelDriven action after 10mins

2008-03-05 Thread Jonny Cavell

I get the following error, but only after about 10 mins after a server
restart. To fix, I need to restart the server.

Unable to instantiate Action, xxx,  defined for 'aaa' in namespace '/'
Error creating bean with name 'xxx' defined in class path resource
[spring/struts2/yyy.xml]:
Error setting property values; nested exception is
org.springframework.beans.NotWritablePropertyException: Invalid property
'model' of bean class [zzz]: Bean property 'model' is not writable or has an
invalid setter method. Does the parameter type of the setter match the
return type of the getter?

Needless to say the getter and setter methods are of the correct type and
the property is publically writable.

My model and struts actions are defined in Spring.
-- 
View this message in context: 
http://www.nabble.com/Spring-injected-model-results-in-error-for-ModelDriven-action-after-10mins-tp15854255p15854255.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Struts 2 + Freemarker - how to set a select list option to selected from a request param

2008-03-05 Thread Jonny Cavell

If I set a request param with ?professionId=3, this does not make the
professionId with value 3 selected. What am I doing wrong?

...
<@s.select name = "professionId" key="profession"
headerKey="" headerValue="select_profession"
list="professions"
 listKey="id"
   listValue="name"
   value = "%{#parameters.professionId}"
required="true"
 />
...
-- 
View this message in context: 
http://www.nabble.com/Struts-2-%2B-Freemarker---how-to-set-a-select-list-option-to-selected-from-a-request-param-tp15848645p15848645.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Character encoding problems with Struts 2 and Freemarker or Velocity

2008-01-02 Thread Jonny Cavell

Thanks a lot, that has sorted it out.

I'm a bit confused as to why changing the default from utf-8 works though...



Jonny Cavell wrote:
> 
> I am setting default_encoding=UTF-8 in freemarker.properties, and leaving
> the struts encoding in default.properties untouched (i.e.
> struts.i18n.encoding=UTF-8). When I use a struts action to forward to a
> test page with Spanish text, without specifying the type (thus defaulting
> to jsp), it outputs fine. However, if the action forwards to the same
> page, but specifying the type as freemarker, the output is garbled. It is
> also garbled for Velocity, making me think that the problem must lie
> somewhere within Struts 2.
> 
> Even if I subclass FreemarkerManager, override the createConfiguration
> method and explicitly call config.setDefaultEncoding("utf-8") here, and
> specify this class as the struts.freemarker.manager.classname in
> struts.properties, it makes no difference - the output is garbled.
> 
> Does anybody know why this might be the case?
> 
> Thanks
> 
> Jonny
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Character-encoding-problems-with-Struts-2-and-Freemarker-or-Velocity-tp14538951p14575550.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Character encoding problems with Struts 2 and Freemarker or Velocity

2007-12-29 Thread Jonny Cavell

I am setting default_encoding=UTF-8 in freemarker.properties, and leaving the
struts encoding in default.properties untouched (i.e.
struts.i18n.encoding=UTF-8). When I use a struts action to forward to a test
page with Spanish text, without specifying the type (thus defaulting to
jsp), it outputs fine. However, if the action forwards to the same page, but
specifying the type as freemarker, the output is garbled. It is also garbled
for Velocity, making me think that the problem must lie somewhere within
Struts 2.

Even if I subclass FreemarkerManager, override the createConfiguration
method and explicitly call config.setDefaultEncoding("utf-8") here, and
specify this class as the struts.freemarker.manager.classname in
struts.properties, it makes no difference - the output is garbled.

Does anybody know why this might be the case?

Thanks

Jonny

-- 
View this message in context: 
http://www.nabble.com/Character-encoding-problems-with-Struts-2-and-Freemarker-or-Velocity-tp14538951p14538951.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [s2] How do I output unicode characters please help

2007-12-19 Thread Jonny Cavell

I am also having difficulty with using Struts2 and Freemarker.

I am setting default_encoding=UTF-8 in freemarker.properties, and leaving
the struts encoding in default.properties untouched (i.e.
struts.i18n.encoding=UTF-8). When I use a struts action to forward to a test
page with Spanish text, without specifying the type (thus defaulting to
jsp), it outputs fine. However, if the action forwards to the same page, but
specifying the type as freemarker, the output is garbled.

Even if I subclass FreemarkerManager, override the createConfiguration
method and explicitly call config.setDefaultEncoding("utf-8") here, and
specify this as the struts.freemarker.manager.classname in
struts.properties, it makes no difference - the output is garbled.

Does anybody know why this might be the case? 

Thanks

Jonny



Laurie Harper wrote:
> 
> Er, no; property files are required to be in ASCII format. Using a UTF-8 
> character encoding in a properties file will not work.
> 
> @Dave: ü is a valid encoding of the character \u00fc, it's 
> equivalent; in fact, I think it's equivalent regardless of character 
> encoding for the served HTML, which would make it the most portable 
> representation. Why do you want something else?
> 
> If you really can't work with the encoded output, you may be able to get 
> the raw character, for example with  escape="false"/>.
> 
> L.
> 
> Leonidas Papadakis wrote:
>> Just put the umlaut character u" directly to your property file and make 
>> sure that you save it as utf-8 not ansi e.t.c.
>> 
>> Regards,
>> 
>> Leon
>> 
>> David Harland wrote:
>>> Hi,
>>>
>>> Thanks I have added those properties but it is still outputting ü.
>>>
>>> Can someone please tell me what I might be doing wrong.
>>>
>>> Dave.
>>>
>>> - Original Message 
>>> From: Leonidas Papadakis <[EMAIL PROTECTED]>
>>> To: Struts Users Mailing List 
>>> Sent: Saturday, September 22, 2007 4:22:04 PM
>>> Subject: Re: [s2] How do I output unicode characters please help
>>>
>>> Hi there,
>>>
>>> in my Greek scenario i have set the below in struts.properties file :
>>> struts.i18n.encoding=UTF-8
>>> struts.locale = el_GR
>>>
>>> in my freemarker.properties :
>>> default_encoding=UTF-8
>>> locale=el_GR
>>>
>>> in my jsp file :
>>> <%@ page contentType="text/html; charset=utf-8" %>
>>>
>>> Also check the doctype of your resulting html.
>>>
>>> I hope this will help 
>>>
>>> Regards
>>>
>>> Leon
>>>
>>> David Harland wrote:
>>>  
 Hi,

 If I put the following \u00fc in a properties file and use it in a 
 jsp i get the german character u" output. If I have an action with 
 the variable test and I set it with \u00fc and I output it in a jsp I 
 get the encoding ü.

 How do I get the character instead of this encoding please?

 Thanks

 Dave.




   
 
  

 Don't let your dream ride pass you by. Make it a reality with Yahoo! 
 Autos.
 http://autos.yahoo.com/index.html
  



 -
 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]
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> 
>>>  
>>>
>>> Pinpoint customers who are looking for what you sell. 
>>> http://searchmarketing.yahoo.com/
>>>
>>> -
>>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-s2--How-do-I-output-unicode-characters-please-help-tp12837085p14414610.html
Sent from the Struts - User mailing list archive at Nabble.com.


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