Re: Upgrading AppFuse to Struts 2.1

2009-05-05 Thread mraible

Yes, but I don't have actionPackages configured in web.xml, so I don't
believe it's enabled. 


Wes Wannemacher wrote:
> 
> Matt,
> 
> are you combining the conventions plugin with regular XML
> configuration? Because your action is named SignupAction, which
> conventions would pickup, but the input result doesn't appear to
> follow the convention (it should be named signup-input.jsp). I'd poke
> around a bit and see if conventions is picking up that class as an
> action.
> 
> -Wes
> 
> On Tue, May 5, 2009 at 11:10 AM, mraible  wrote:
>>
>>
>>
>> mraible wrote:
>>>
>>> This weekend, I attempted to upgrade AppFuse to use Struts 2.1 (formerly
>>> using 2.0.11.1). I used the following instructions:
>>>
>>> http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html
>>>
>>> After completing all the steps, I was able to get everything to compile
>>> and start. However, the upgrade seems to have failed as the following
>>> issues still remain:
>>>
>>> 1. Users have to login for each page request.
>>> 2. Signup fails with the following error:
>>>
>>> WARN [btpool0-3] VisitorFieldValidator.warn(45) | The visited object is
>>> null, VisitorValidator will not be able to handle validation properly.
>>> Please make sure the visited object is not null for VisitorValidator to
>>> function properly
>>> WARN [btpool0-3] Dispatcher.warn(49) | Could not find action or result
>>> No result defined for action org.appfuse.webapp.action.SignupAction and
>>> result input
>>>
>>> If anyone has advice for how to fix these issues, I'd love to hear it.
>>> You
>>> can find the JIRA issue and patch I tried at:
>>>
>>> http://issues.appfuse.org/browse/APF-1130
>>>
>>> Thanks,
>>>
>>> Matt
>>>
>>
>> I'm still trying to resolve this issue. The strange thing is my Struts
>> action *does* have an input defined.
>>
>>        
>>            /
>>            /WEB-INF/pages/signup.jsp
>>            saveSignup
>>        
>>
>> Maybe this is caused by a difference b/w 2.0.x and 2.1.x and Spring with
>> the
>> Convention plugin (vs. the Codebehind plugin)?
>>
>> Thanks,
>>
>> Matt
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Upgrading-AppFuse-to-Struts-2.1-tp23256858p23389468.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> 
> 
> -- 
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Upgrading-AppFuse-to-Struts-2.1-tp23256858p23390995.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Upgrading AppFuse to Struts 2.1

2009-05-05 Thread mraible



mraible wrote:
> 
> This weekend, I attempted to upgrade AppFuse to use Struts 2.1 (formerly
> using 2.0.11.1). I used the following instructions:
> 
> http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html
> 
> After completing all the steps, I was able to get everything to compile
> and start. However, the upgrade seems to have failed as the following
> issues still remain:
> 
> 1. Users have to login for each page request. 
> 2. Signup fails with the following error:
> 
> WARN [btpool0-3] VisitorFieldValidator.warn(45) | The visited object is
> null, VisitorValidator will not be able to handle validation properly.
> Please make sure the visited object is not null for VisitorValidator to
> function properly
> WARN [btpool0-3] Dispatcher.warn(49) | Could not find action or result
> No result defined for action org.appfuse.webapp.action.SignupAction and
> result input  
> 
> If anyone has advice for how to fix these issues, I'd love to hear it. You
> can find the JIRA issue and patch I tried at:
> 
> http://issues.appfuse.org/browse/APF-1130
> 
> Thanks,
> 
> Matt
> 

I'm still trying to resolve this issue. The strange thing is my Struts
action *does* have an input defined.


/
/WEB-INF/pages/signup.jsp
saveSignup


Maybe this is caused by a difference b/w 2.0.x and 2.1.x and Spring with the
Convention plugin (vs. the Codebehind plugin)?

Thanks,

Matt

-- 
View this message in context: 
http://www.nabble.com/Upgrading-AppFuse-to-Struts-2.1-tp23256858p23389468.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Upgrading AppFuse to Struts 2.1

2009-04-27 Thread mraible



newton.dave wrote:
> 
>> //lets take a look at documentation on using visitor field validator from
>> http://struts.apache.org/2.0.14/docs/using-visitor-field-validator.html
>> public class VisitorValidatorsExampleAction extends
>> AbstractValidationActionSupport
>> 
>> //Latest WW 2.2.7 distro d/l
>> http://www.opensymphony.com/webwork/download.action
>> 
>> /** Copyright (c) 2002-2003 by OpenSymphony All rights reserved.*/
>> package com.opensymphony.webwork.showcase.validation;
> 
> O_o
> 
> The example shown in the S2 documentation is from the S2 showcase 
> validation example, which doesn't use anything from XW1. Or WW.
> 
> Dave
> 

Does that mean there isn't a bug and I'm doing something wrong?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Upgrading-AppFuse-to-Struts-2.1-tp23256858p23267156.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Upgrading AppFuse to Struts 2.1

2009-04-27 Thread mraible

This weekend, I attempted to upgrade AppFuse to use Struts 2.1 (formerly
using 2.0.11.1). I used the following instructions:

http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html

After completing all the steps, I was able to get everything to compile and
start. However, the upgrade seems to have failed as the following issues
still remain:

1. Users have to login for each page request. 
2. Signup fails with the following error:

WARN [btpool0-3] VisitorFieldValidator.warn(45) | The visited object is
null, VisitorValidator will not be able to handle validation properly.
Please make sure the visited object is not null for VisitorValidator to
function properly
WARN [btpool0-3] Dispatcher.warn(49) | Could not find action or result
No result defined for action org.appfuse.webapp.action.SignupAction and
result input  

If anyone has advice for how to fix these issues, I'd love to hear it. You
can find the JIRA issue and patch I tried at:

http://issues.appfuse.org/browse/APF-1130

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Upgrading-AppFuse-to-Struts-2.1-tp23256858p23256858.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: How can I tell Struts 2 to throw/log exceptions for invalid OGNL Expressions

2008-04-13 Thread mraible



Jeromy Evans - Blue Sky Minds wrote:
> 
> Jeromy Evans wrote:
>> mraible wrote:
>>
>>>
>>> I tried FreeMarker this morning and discovered that the problem 
>>> exists there
>>> too. Grrr. I've experienced Struts 2 being eliminated as a web framework
>>> candidate on a couple projects because of this. Kindof annoying.
>>>   
>>
>> So what do you really want?  My guess here is that you invoked a 
>> struts tag and the tag swallowed the error and provided a default to 
>> the freemarker template.
>>
>>
> 
> On further thought I think this comes down to an interesting issue with 
> coupling between the view and the model.
> In struts2 the model is a ValueStack that consists of both a stack and 
> map (context).  OGNL is used to address properties or methods in that 
> model and it's a trivial for OGNL to log when it fails to match a 
> property or method.
> 
> In the view, Struts2 provides tags for jsp, ftl or velocity that 
> evaluate OGNL expressions to access the model.  More often that not the 
> tags fail silently if the expression was invalid or failed to evaluate 
> anything.  Herein lies the problem. 
> 
> If I were using FTL directly to access the value stack, as a developer I 
> could decide how to handle missing properties, blank properties or 
> default values with FTL's excellent error handling.  However, when I use 
> FTL to invoke a Struts2 tag I lose that benefit as the tag 
> implementations *transfer* properties into the FTL context. I think its 
> a flaw that Struts2 tags evaluate OGNL expressions themselves prior to 
> rendering the template.. 
> 
> A tag overhaul is well overdue (but major effort).  I've expressed other 
> concerns about the Struts2 tags (XWork Component and UIBean) on several 
> occasions already.
> 

I realize it might be a major effort, but this seems to be a pretty big deal
to me. Not for users that've already chosen Struts 2 as a web framework, but
for folks evaluating Java Web Frameworks. The fact that Struts 2 is the
*only* one that doesn't blow up on invalid properties makes it look pretty
bad for evaluations. It's kindof like the old blank page you'd sometimes get
with Tiles - you really have no idea what you did wrong and it can take
quite some time to track it down if you don't know what's causing it.

Matt
-- 
View this message in context: 
http://www.nabble.com/How-can-I-tell-Struts-2-to-throw-log-exceptions-for-invalid-OGNL-Expressions-tp11659700p16659934.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: i18n Tags in FreeMarker Decorator for SiteMesh

2008-04-11 Thread mraible



Jeromy Evans - Blue Sky Minds wrote:
> 
> mraible wrote:
>> I'm using 2.1.1-SNAPSHOT of the sitemesh and rest plugins.
>> FreeMarker/SiteMesh is working fine. However, I'm unable to use i18n tags
>> in
>> my decorator. In src/main/resources/com/company/app/package.properties, I
>> have:
>>
>> webapp.name=Foo
>> webapp.tagline=Bar
>>
>> In my decorators/default.ftl, I have:
>>
>> [EMAIL PROTECTED] name="webapp.name"/]
>>
>> And it renders:
>>
>> webapp.name
>>
>>   
> I've committed an update to 2.1.1 that may affect this.
> 
> However, my guess is that your action doesn't extend ActionSupport and 
> there's no alternate TextProvider available. In that case, the first 
> TextProvider found is the DefaultTextProvider which only serves 
> resources from the global resource bundle.  Does that sound right?
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

Yes, that sound about right. My action is a POJO that only extends
ModelDriven.
-- 
View this message in context: 
http://www.nabble.com/i18n-Tags-in-FreeMarker-Decorator-for-SiteMesh-tp16599500p16646077.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: How can I tell Struts 2 to throw/log exceptions for invalid OGNL Expressions

2008-04-10 Thread mraible

Following up months later as this has come up again now that 2.1 is close to
release. The current version does log messages for invalid properties, but
it doesn't blow up for invalid properties which is more of what I'm looking
for.

When I blogged about this[1], one of the responses was the following:



> When you are using freemarker as your result technology in struts2 you get
> great feedback on problems like this. This is not indicative of the whole
> framework -- just the result-type that you are using (probably jsp?)
> 

I tried FreeMarker this morning and discovered that the problem exists there
too. Grrr. I've experienced Struts 2 being eliminated as a web framework
candidate on a couple projects because of this. Kindof annoying. 

Matt

[1] http://raibledesigns.com/rd/entry/does_struts_2_suck


Ted Husted wrote:
> 
> Good point. Feel free to open a S2 JIRA ticket that cross-references
> XW-557 (since I'm not sure if its something we could do here or not)
> -- and feel even more free to submit a patch!
> 
> As usual, we are short of active volunteers, and we can always use a
> hand with the code!
> 
> -Ted.
> 
> On 9/6/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> struts.devMode=true will catch setting invalid properties, but not
>> reading
>> from them. I want to be warned when a property/method doesn't exist. Or
>> in
>> the instance of calling stating methods with FQCN, I want to be made
>> aware
>> when I fat finger the package name. If I could use JSP's import and then
>> read from the package, that'd be even nicer. It's somewhat verbose to
>> call
>> FQ static methods. I suppose I could move the methods into my action, so
>> it's not too bad.
>>
>> Matt
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-can-I-tell-Struts-2-to-throw-log-exceptions-for-invalid-OGNL-Expressions-tp11659700p16612885.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: i18n Tags in FreeMarker Decorator for SiteMesh

2008-04-09 Thread mraible

I tried [EMAIL PROTECTED] value="text('key')"/] and that doesn't seem to work
either. I don't have a struts.xml or struts.properties in my project. I
tried putting the i18n bundle in all packages using it at the Action level
(ActionName.properties), but that didn't work either. Creating a
src/main/resources/struts.properties with the following in it is the only
thing that seems to work.

struts.custom.i18n.resources=messages

And then putting my keys in src/main/resources/messages.properties.

AFAICT, i18n bundles at the action/package level seems to be completely
broken in 2.1.1.

Matt


Jeromy Evans - Blue Sky Minds wrote:
> 
> Hi Matt,
> 
> is it only the @s.text tag that isn't working?  eg. is @s.property
> working?
> 
> I've suspected there's a problem with the text tag and i18n tag not 
> finding some resource bundles in the S2.1.1 branch but haven't had a 
> chance to investigate. There's several related issues in JIRA and I 
> recall something specifically about package-level properties.  I may 
> have an opportunity to investigate later today.  Does it find resources 
> in your action-properties or global properties?
> 
> cheers,
>  Jeromy Evans
> 
> mraible wrote:
>> I'm using 2.1.1-SNAPSHOT of the sitemesh and rest plugins.
>> FreeMarker/SiteMesh is working fine. However, I'm unable to use i18n tags
>> in
>> my decorator. In src/main/resources/com/company/app/package.properties, I
>> have:
>>
>> webapp.name=Foo
>> webapp.tagline=Bar
>>
>> In my decorators/default.ftl, I have:
>>
>> [EMAIL PROTECTED] name="webapp.name"/]
>>
>> And it renders:
>>
>> webapp.name
>>
>> Any idea why my Struts FreeMarker tag isn't being processed? I have the
>> following in my web.xml:
>>
>> 
>> struts-cleanup
>> /*
>> 
>>
>> 
>> sitemesh
>> /*
>> 
>>
>> 
>> struts
>> /*
>> 
>>
>> Thanks,
>>
>> Matt
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/i18n-Tags-in-FreeMarker-Decorator-for-SiteMesh-tp16599500p16601141.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]



i18n Tags in FreeMarker Decorator for SiteMesh

2008-04-09 Thread mraible

I'm using 2.1.1-SNAPSHOT of the sitemesh and rest plugins.
FreeMarker/SiteMesh is working fine. However, I'm unable to use i18n tags in
my decorator. In src/main/resources/com/company/app/package.properties, I
have:

webapp.name=Foo
webapp.tagline=Bar

In my decorators/default.ftl, I have:

[EMAIL PROTECTED] name="webapp.name"/]

And it renders:

webapp.name

Any idea why my Struts FreeMarker tag isn't being processed? I have the
following in my web.xml:


struts-cleanup
/*



sitemesh
/*



struts
/*


Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/i18n-Tags-in-FreeMarker-Decorator-for-SiteMesh-tp16599500p16599500.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: Struts2+Spring2 Beans+Hibernate

2007-09-26 Thread mraible

Here's a sample app that's ready to run if you have MySQL installed.

https://appfuse-light.dev.java.net/files/documents/6839/68407/appfuse-light-struts2-hibernate-1.8.zip

Matt


Vinicius Medeiros Peretti wrote:
> 
> I had problems with this combination using jdk 1.6, solved when I 
> changed the tomcat's jdk to 1.5.
> 
> Vinicius
> 
> Tom Holmes Jr. wrote:
>> Yes ... this is one of the very first links that came up with my 
>> Google search and I looked at this example in detail.
>>
>> Unfortunately, I'm not really using JPA (since in my opinion it's far 
>> from Hibernate and really not complete yet) ... and I'm not using Ajax 
>> at the moment.
>>
>> It really wasn't clear to me in this example how to use Struts2 + 
>> Spring2 Beans and Hibernate ...  eventually I did find an example that 
>> more closely matches what I was looking for.
>>
>> It was my fault that when I built my Maven2 pom.xml I included ALL the 
>> Struts2 plugins .. which in reality I just needed the Spring Plugin 
>> ... and none of the rest.
>> Additionally my fault ... I typed "applicationContent.xml"  as opposed 
>> to "applicationContext.xml"      I hate when I do that.
>>
>> I still have a few more errors, but that is because I'm working on the 
>> right jars to add.   I'm missing a few for Spring2 that I need.
>>
>> Thanks very much for the help!
>>  Tom
>>
>>
>> Leena Borle wrote:

> 2) Can anyone point me to a sample Struts2 web-app
> that uses Spring2 Beans with Hibernate.
>   
 Did you take a look at this example at,
 
>>>
>>>
>>> http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html
>>>
>>> It is complete with all possible combinations with Strus2
>>>
>>> Leena
>>>
>>> -
>>>  
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
>>>
>>>   
>>> 
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 
>>> 269.13.31/1031 - Release Date: 9/26/2007 12:12 PM
>>>   
>>
>>
>> -
>> 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/Struts2%2BSpring2-Beans%2BHibernate-tf4523404.html#a12913867
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 2 and struts-menu

2007-09-24 Thread mraible

I agree that MenuContextListener is the best way to use Struts Menu in a
non-Struts 1.x environment.

Matt
Lead (and only) developer on Struts Menu ;-)


Al Sutton-4 wrote:
> 
> 1) I use the MenuContextListener
> 
> 2) I use static menus, but I believe there is something in the struts-menu
> FAQ that will help you.
> 
> Regards,
> 
> Al.
> 
> -Original Message-
> From: Roberto Nunnari [mailto:[EMAIL PROTECTED] 
> Sent: 24 September 2007 15:52
> To: Struts Users Mailing List
> Subject: Re: Struts 2 and struts-menu
> 
> 
> Hi Al.
> Thank you for your time.
> 
> Glad to hear that ;) ..So here are a few more targeted questions:
> 
> 1) how do you integrate? Using Spring or MenuContextListener or else?
> 
> 2) is there a way to modify the menu links or add/set parameters to the 
> menu links at runtime?
> 
> Thank you again.
> 
> 
> Al Sutton wrote:
>> Yes.
>> 
>> -Original Message-
>> From: Roberto Nunnari [mailto:[EMAIL PROTECTED]
>> Sent: 24 September 2007 15:24
>> To: Struts Users Mailing List
>> Subject: Struts 2 and struts-menu
>> 
>> 
>> Hello list.
>> 
>> Is anybody successfully using struts-menu with Struts2?
>> 
>> Thank you.
>> 
> 
> 
> -- 
> Robi
> 
> 
> -
> 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/Struts-2-and-struts-menu-tf4509539.html#a12863951
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: How can I tell Struts 2 to throw/log exceptions for invalid OGNL Expressions

2007-09-06 Thread mraible

struts.devMode=true will catch setting invalid properties, but not reading
from them. I want to be warned when a property/method doesn't exist. Or in
the instance of calling stating methods with FQCN, I want to be made aware
when I fat finger the package name. If I could use JSP's import and then
read from the package, that'd be even nicer. It's somewhat verbose to call
FQ static methods. I suppose I could move the methods into my action, so
it's not too bad.

Matt


Ted Husted wrote:
> 
> Have you tried doing this with devMode turned on?
> 
> 
> 
> 
> For example, if I add to the form on MailReader Login.jsp
> 
>  
> 
> and submit the form with devmode=true, the following is logged
> 
> Sep 6, 2007 11:14:52 AM
> com.opensymphony.xwork2.validator.ActionValidatorManagerFactory
> 
> INFO: Detected AnnotationActionValidatorManager, initializing it...
> Sep 6, 2007 11:15:01 AM
> com.opensymphony.xwork2.interceptor.ParametersInterceptor
> setParameters
> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
> caught setting 'button.save' on 'class mailreader2.Login: Error
> setting expression 'button.save' with value
> '[Ljava.lang.String;@e33e18'
> Sep 6, 2007 11:15:01 AM
> com.opensymphony.xwork2.interceptor.ParametersInterceptor
> setParameters
> SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception
> caught setting 'doesntexist' on 'class mailreader2.Login: Error
> setting expression 'doesntexist' with value
> '[Ljava.lang.String;@15f1f9c'
> 
> HTH, Ted.
> http://husted.com/ted/blog/
> 
> 
> On 8/28/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> I'm now digging into XWork to see if I can add this functionality. I have
>> the
>> following in a JSP and I'd like to receive an error from it:
>>
>> 
>>
>> OgnlValueStack lines 260-265:
>>
>> Object value = OgnlUtil.getValue(expr, context, root,
>> asType);
>> if (value != null) {
>> return value;
>> } else {
>> return findInContext(expr);
>> }
>>
>> In this example, the following method is called with
>> "methodDoesntExist('foo')"" as the value for name:
>>
>> private Object findInContext(String name) {
>> return getContext().get(name);
>> }
>>
>> So if nothing is found in the map, null is returned (I'm assuming). It
>> seems
>> like the if/else statement might be better with the following:
>>
>> Object value = OgnlUtil.getValue(expr, context, root,
>> asType);
>> if (value != null) {
>> return value;
>> } else {
>> value = findInContext(expr);
>> if (value == null) {
>> logLookupFailure(expr, ??);
>>     }
>> }
>>
>> However, I don't know what to put in the ?? location. Thoughts on this?
>>
>> Thanks,
>>
>> Matt
>>
>> mraible wrote:
>> >
>> > Is it possible to use altSyntax to solve this problem? In other words,
>> > require %{} around all expressions? Looking through the docs, it
>> doesn't
>> > seem like altSyntax is supported in Struts 2.
>> >
>> > https://issues.apache.org/struts/browse/WW-1819
>> >
>> > Thanks,
>> >
>> > Matt
>> >
>> >
>> > mraible wrote:
>> >>
>> >>
>> >> mraible wrote:
>> >>>
>> >>> I have the following class:
>> >>>
>> >>> public class TestAction {
>> >>>
>> >>> public static String concat(String str1, String str2) {
>> >>> return str1 + " and " + str2;
>> >>> }
>> >>> }
>> >>>
>> >>> In a JSP, I can write the following and it works fine:
>> >>>
>> >>> 
>> >>>
>> >>> However, if I change it to an invalid class name, it fails silently:
>> >>>
>> >>> 
>> >>>
>> >>> I've tried turning up the logging for org.apache.struts2,
>> >>> com.opensymphony.xwork2 and ognl - but it still fails silently. Any
>> >>> ideas how to get better error messages about invalid OGNL
>> expressions?
>> >>>
>> >>
>> >>

Re: Can you specify the name of struts.xml for Struts2?

2007-08-30 Thread mraible

It looks like the FilterDispatcher supports a "config" init-parameter as
well. However, I tried setting it to /WEB-INF/struts.xml and it didn't work
for me.

http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/dispatcher/FilterDispatcher.html

Matt


Zarar Siddiqi wrote:
> 
> The struts.configuration.files property in struts.properties at the
> root of your classpath can specify struts configuration files using a
> comma separated list, by default this property is set to:
> 
> struts.configuration.files=struts-default.xml,struts-plugin.xml,struts.xml
> 
> You can change it if you like.
> 
> Zarar
> 
> On 8/30/07, Lane, Ron <[EMAIL PROTECTED]> wrote:
>> We're having a problem with Struts2 running under Jrun.
>> The 'web application class loader' in Jrun is not finding struts.xml in
>> WEB-INF/classes.
>> We can put struts.xml in the overall classpath of the Java application
>> server, but then that means only one per Java app server.
>>
>> 1. Has anyone else experienced this problem and have a solution or
>> workaround?
>> 2. In Struts-1, one could specify a name of the struts config file - is
>> there a way in web.xml to specify an alternative name of struts.xml?
>> That way each of the web apps can specify its unique name, and even
>> though all the config files are in the overall classpath, they can be
>> unique per web app by having a unique name.
>>
>> Ron Lane
>>
>> -
>> 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/Can-you-specify-the-name-of-struts.xml-for-Struts2--tf4355855.html#a12415685
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: How can I tell Struts 2 to throw/log exceptions for invalid OGNL Expressions

2007-08-28 Thread mraible

I'm now digging into XWork to see if I can add this functionality. I have the
following in a JSP and I'd like to receive an error from it:



OgnlValueStack lines 260-265:

Object value = OgnlUtil.getValue(expr, context, root, asType);
if (value != null) {
return value;
} else {
return findInContext(expr);
}

In this example, the following method is called with
"methodDoesntExist('foo')"" as the value for name:

private Object findInContext(String name) {
return getContext().get(name);
}

So if nothing is found in the map, null is returned (I'm assuming). It seems
like the if/else statement might be better with the following:

Object value = OgnlUtil.getValue(expr, context, root, asType);
if (value != null) {
return value;
} else {
value = findInContext(expr);
if (value == null) {
logLookupFailure(expr, ??);
}
}

However, I don't know what to put in the ?? location. Thoughts on this?

Thanks,

Matt

mraible wrote:
> 
> Is it possible to use altSyntax to solve this problem? In other words,
> require %{} around all expressions? Looking through the docs, it doesn't
> seem like altSyntax is supported in Struts 2.
> 
> https://issues.apache.org/struts/browse/WW-1819
> 
> Thanks,
> 
> Matt
> 
> 
> mraible wrote:
>> 
>> 
>> mraible wrote:
>>> 
>>> I have the following class:
>>> 
>>> public class TestAction {
>>> 
>>> public static String concat(String str1, String str2) {
>>> return str1 + " and " + str2;
>>> }
>>> }
>>> 
>>> In a JSP, I can write the following and it works fine:
>>> 
>>> 
>>> 
>>> However, if I change it to an invalid class name, it fails silently:
>>> 
>>> 
>>> 
>>> I've tried turning up the logging for org.apache.struts2,
>>> com.opensymphony.xwork2 and ognl - but it still fails silently. Any
>>> ideas how to get better error messages about invalid OGNL expressions?
>>> 
>> 
>> I'll take that as a "no", it is not possible to get better error
>> messages. That's too bad since it seems I get better type-safety and
>> errors from scriptlets instead of OGNL.
>> 
>> <%@ page
>> import="org.foo.bar.baz.SettingsServlet,org.foo.bar.baz.enums.EnumCodec" 
>> %>
>> 
>> > var="q"><%=EnumCodec.URL.encode(SettingsServlet.ACTIONS.networkUpdates)%>
>> 
>> 
>> 
>> VS:
>> 
>> > value="url(@[EMAIL PROTECTED]).q(@[EMAIL PROTECTED](@[EMAIL PROTECTED]))"/>
>> 
>> The framework I'm looking to migrate to Struts 2 has the ability for it's
>> EL to read from imported Statics - a pretty cool feature IMO.
>> 
>> ${url(pageBean.MAPPING.SETTINGS_SERVLET).q(EnumCodec.URL.encode(SettingsServlet.ACTIONS.networkUpdates))}
>> 
>> Matt
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-can-I-tell-Struts-2-to-throw-log-exceptions-for-invalid-OGNL-Expressions-tf4100102.html#a12373437
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: How can I tell Struts 2 to throw/log exceptions for invalid OGNL Expressions

2007-08-27 Thread mraible

Is it possible to use altSyntax to solve this problem? In other words,
require %{} around all expressions? Looking through the docs, it doesn't
seem like altSyntax is supported in Struts 2.

https://issues.apache.org/struts/browse/WW-1819

Thanks,

Matt


mraible wrote:
> 
> 
> mraible wrote:
>> 
>> I have the following class:
>> 
>> public class TestAction {
>> 
>> public static String concat(String str1, String str2) {
>> return str1 + " and " + str2;
>> }
>> }
>> 
>> In a JSP, I can write the following and it works fine:
>> 
>> 
>> 
>> However, if I change it to an invalid class name, it fails silently:
>> 
>> 
>> 
>> I've tried turning up the logging for org.apache.struts2,
>> com.opensymphony.xwork2 and ognl - but it still fails silently. Any ideas
>> how to get better error messages about invalid OGNL expressions?
>> 
> 
> I'll take that as a "no", it is not possible to get better error messages.
> That's too bad since it seems I get better type-safety and errors from
> scriptlets instead of OGNL.
> 
> <%@ page
> import="org.foo.bar.baz.SettingsServlet,org.foo.bar.baz.enums.EnumCodec" 
> %>
> 
>  var="q"><%=EnumCodec.URL.encode(SettingsServlet.ACTIONS.networkUpdates)%>
> 
> 
> 
> VS:
> 
>  value="url(@[EMAIL PROTECTED]).q(@[EMAIL PROTECTED](@[EMAIL PROTECTED]))"/>
> 
> The framework I'm looking to migrate to Struts 2 has the ability for it's
> EL to read from imported Statics - a pretty cool feature IMO.
> 
> ${url(pageBean.MAPPING.SETTINGS_SERVLET).q(EnumCodec.URL.encode(SettingsServlet.ACTIONS.networkUpdates))}
> 
> Matt
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-can-I-tell-Struts-2-to-throw-log-exceptions-for-invalid-OGNL-Expressions-tf4100102.html#a12351943
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: How can I tell Struts 2 to throw/log exceptions for invalid OGNL Expressions

2007-08-22 Thread mraible


mraible wrote:
> 
> I have the following class:
> 
> public class TestAction {
> 
> public static String concat(String str1, String str2) {
> return str1 + " and " + str2;
> }
> }
> 
> In a JSP, I can write the following and it works fine:
> 
> 
> 
> However, if I change it to an invalid class name, it fails silently:
> 
> 
> 
> I've tried turning up the logging for org.apache.struts2,
> com.opensymphony.xwork2 and ognl - but it still fails silently. Any ideas
> how to get better error messages about invalid OGNL expressions?
> 

I'll take that as a "no", it is not possible to get better error messages.
That's too bad since it seems I get better type-safety and errors from
scriptlets instead of OGNL.

<%@ page
import="org.foo.bar.baz.SettingsServlet,org.foo.bar.baz.enums.EnumCodec"  %>

<%=EnumCodec.URL.encode(SettingsServlet.ACTIONS.networkUpdates)%>



VS:



The framework I'm looking to migrate to Struts 2 has the ability for it's EL
to read from imported Statics - a pretty cool feature IMO.

${url(pageBean.MAPPING.SETTINGS_SERVLET).q(EnumCodec.URL.encode(SettingsServlet.ACTIONS.networkUpdates))}

Matt

-- 
View this message in context: 
http://www.nabble.com/How-can-I-tell-Struts-2-to-throw-log-exceptions-for-invalid-OGNL-Expressions-tf4100102.html#a12282397
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: Namespaces don't work when Struts is mapped to /struts/*

2007-08-21 Thread mraible

The path doesn't seem to matter - if I use /foo/*, I get the same issue. It
seems to be related to struts.enable.SlashesInActionNames since I have to
set it to false in order to get /foo/action.action to work.

Matt


Musachy Barroso wrote:
> 
> I didn't "know" about it, but kind of expected it, as "struts" is used
> to map to the resources inside the jar file, so is probably getting
> confused and building wrong paths. (should be fixable anyway :) )
> 
> musachy
> 
> On 8/21/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> Namespaces don't seem to work when my filter-mapping has a path like the
>> following:
>>
>> 
>> struts
>> /struts/*
>> 
>>
>> However, they seem to work fine when my url-pattern is /* or *.action. Is
>> this a known issue?
>>
>> Thanks,
>>
>> Matt
>> --
>> View this message in context:
>> http://www.nabble.com/Namespaces-don%27t-work-when-Struts-is-mapped-to--struts-*-tf4309131.html#a12267282
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Namespaces-don%27t-work-when-Struts-is-mapped-to--struts-*-tf4309131.html#a12268025
Sent from the Struts - User mailing list archive at Nabble.com.


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



Namespaces don't work when Struts is mapped to /struts/*

2007-08-21 Thread mraible

Namespaces don't seem to work when my filter-mapping has a path like the
following:


struts
/struts/*


However, they seem to work fine when my url-pattern is /* or *.action. Is
this a known issue?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Namespaces-don%27t-work-when-Struts-is-mapped-to--struts-*-tf4309131.html#a12267282
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: Retrieving static values in Actions

2007-08-21 Thread mraible

This works if I use the fully-qualified class name for
ServletMappingConstants. In the framework's current EL, it's possible to do
MAPPING.STATIC, so I'm trying to create a similar short syntax with Struts 2
for easier migration.

Thanks,

Matt


Musachy Barroso wrote:
> 
> try :
> 
> @[EMAIL PROTECTED]
> 
> musachy
> 
> On 8/21/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> I have the following interface that I'm trying to read variables from:
>>
>> public interface ServletMappingConstants
>> {
>>   String SECURE_PREFIX = "secure/";
>>
>>   String STATIC = "static";
>> ...
>> }
>>
>> If my Action implements this interface, I can refer to these strings with
>> the OGNL expression "@[EMAIL PROTECTED]". However, I'm trying to migrate some
>> existing code that uses the interface as a static final:
>>
>> public final static ServletMappingConstants MAPPING =
>> new ServletMappingConstants() {};
>>
>> If I use this, I'm unable to refer to @[EMAIL PROTECTED]@STATIC. Is there 
>> some
>> other expression that will allow me to retrieve values from the interface
>> without implementing it?
>>
>> Thanks,
>>
>> Matt
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Retrieving-static-values-in-Actions-tf4308955.html#a12266708
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Retrieving-static-values-in-Actions-tf4308955.html#a12267174
Sent from the Struts - User mailing list archive at Nabble.com.


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



Retrieving static values in Actions

2007-08-21 Thread mraible

I have the following interface that I'm trying to read variables from:

public interface ServletMappingConstants
{
  String SECURE_PREFIX = "secure/";

  String STATIC = "static";
...
}

If my Action implements this interface, I can refer to these strings with
the OGNL expression "@[EMAIL PROTECTED]". However, I'm trying to migrate some
existing code that uses the interface as a static final:

public final static ServletMappingConstants MAPPING =
new ServletMappingConstants() {};

If I use this, I'm unable to refer to @[EMAIL PROTECTED]@STATIC. Is there some
other expression that will allow me to retrieve values from the interface
without implementing it?

Thanks,

Matt

-- 
View this message in context: 
http://www.nabble.com/Retrieving-static-values-in-Actions-tf4308955.html#a12266708
Sent from the Struts - User mailing list archive at Nabble.com.


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



Is it possible to use Zero Configuration in a JUnit Test?

2007-08-20 Thread mraible

Is it possible to use Zero Configuration in a JUnit test? It works great when
running my Actions in a container, but I'd like to have a similar feature
when running tests - just "new" an Action and it'll be autowired with
dependencies.

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-use-Zero-Configuration-in-a-JUnit-Test--tf4302186.html#a12245918
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: Using the Restful2ActionMapper

2007-08-15 Thread mraible

I'm trying to change from using the old-style URLs to Restful2ActionMapper.
Here's what I've added to struts.xml:




I have a UserAction that does CRUD (below).

And the following action definitions:



userList.jsp
userList.jsp




userForm.jsp
userList.jsp




users.html
users.html
userForm.jsp
saveUserWithValidation



userForm.jsp
users.html


Is it possible to change to something like the following?

  
{0}
...
  

If so, I'm guessing I need to change some method names (i.e. the default
method for /user would be index, so I should change list() to index()) and
some result names (edit goes to "edit", save goes to "save", index goes to
"success")?

Thanks,

Matt


Philip Lorenz-2 wrote:
> 
> 
>> 
>> Tomorrow's task for me is trying RESTful, so hopefully
>> you'll figure this out ;)
>> 
>> Do you need the ".action" in the URL?!
>> 
>> d.
> 
> You can remove the action postfix by setting struts.action.extension to an
> empty string. I just left it enabled to have a clean default config with
> only the neccesary settings changed.
> 
> Philip
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Using-the-Restful2ActionMapper-tf3173361.html#a12171692
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] what is your practice to do Sidebar thing??

2007-08-13 Thread mraible

I've done it in the past using a combination of SiteMesh and .

http://raibledesigns.com/rd/entry/dependency_injection_with_sitemesh

Matt


Joe Lam wrote:
> 
> May I know what is your practice to do Sidebar thing? here the sidebar
> means a block lets say on the left side showing login form for guest user
> and showing user menu for logged in user.
> 
>  ?
>  ?
> or do it in decorator level (sitemesh) ?
> 
> thank you very much.
> 
> Joe
> 

-- 
View this message in context: 
http://www.nabble.com/-s2--what-is-your-practice-to-do-Sidebar-thing---tf4260692.html#a12131832
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: JSF Woodstock components in Struts 2

2007-08-13 Thread mraible

What are the errors you're getting? "Not much luck" isn't very descriptive.
;-)

Matt


Ravi Vedala wrote:
> 
> Has anyone tried integrating the woodstock JSF components in Struts 2 ? I
> tried but not much luck.
> 
> Thanks,
> r-a-v-i
> 
>
> -
> Pinpoint customers who are looking for what you sell. 
> 

-- 
View this message in context: 
http://www.nabble.com/JSF-Woodstock-components-in-Struts-2-tf4262185.html#a12131805
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: Conditional validation

2007-08-13 Thread mraible

I haven't tried working with Struts 2's annotations for validation yet, so
I'm unable to answer this question. In a week, things might be different.
;-)

Matt


strutstwouser wrote:
> 
> Hi Matt, 
> 
> Can you please tell me what's needed to use this validator using
> annotations alone? . Also, i need a simple conditional validator - ie a
> field needs to be validated only if a prerequisite condition is satisfied,
> else the validations on it must be skipped and no error must be added
> (since this is just a condition check).
> 
> Example : if appname is to be validated only if appid < 100, i will give
> the inverse expression in ConditionalFieldValidator with shortCircuit true
> and the subsequent validations below it ; assumption being if the first
> condition becomes true (i.e prerequisite not satisfied), then dont
> validate further.
> 
> The annotation i need would look like : 
> 
> @ConditionalFieldValidator(fieldName = "app.appname", expression =
> "app.appid > 100", message = "", shortCircuit=true)
> @StringLengthFieldValidator(fieldName = "app.appname" message = "App Name
> must be gt 5 chars", minLength = "5",  maxLength = "12")
> 
> I don't know how to make Struts 2 "see" this custom validator.
> 
> Thanks,
> Joseph
> 
> 
> 
> mraible wrote:
>> 
>> I figured out how to do this - posting here so others will benefit.
>> 
>> 1. Create a new ConditionalVisitorFieldValidator.java:
>> 
>> public class ConditionalVisitorFieldValidator extends
>> VisitorFieldValidator
>> {
>>   private String expression;
>> 
>>   public void setExpression(String expression)
>>   {
>> this.expression = expression;
>>   }
>> 
>>   public String getExpression()
>>   {
>> return expression;
>>   }
>> 
>>   /**
>>* If expression evaluates to true, invoke visitor validation.
>>* @param object the object being validated
>>* @throws ValidationException
>>*/
>>   public void validate(Object object) throws ValidationException
>>   {
>> if (validateExpression(object))
>> {
>>   super.validate(object);
>> }
>>   }
>> 
>>   /**
>>* Validate the expression contained in the "expression" paramter.
>>* @param object the object you're validating
>>* @return true if expression evaluates to true (implying a validation
>> failure)
>>* @throws ValidationException if anything goes wrong
>>*/
>>   public boolean validateExpression(Object object) throws
>> ValidationException
>>   {
>> Boolean answer = Boolean.FALSE;
>> Object obj = null;
>> 
>> try
>> {
>>   obj = getFieldValue(expression, object);
>> }
>> catch (ValidationException e)
>> {
>>   throw e;
>> }
>> catch (Exception e)
>> {
>>   // let this pass, but it will be logged right below
>> }
>> 
>> if ((obj != null) && (obj instanceof Boolean))
>> {
>>   answer = (Boolean) obj;
>> }
>> else
>> {
>>   log.warn("Got result of " + obj + " when trying to get Boolean.");
>> }
>> 
>> return answer;
>>   }
>> }
>> 
>> 2. Add it to your validators.xml:
>> 
>> > class="com...validation.ConditionalVisitorFieldValidator"/>
>> 
>> 3. Write your validation rule:
>> 
>>   
>> 
>>   reason == 'colleague' and colleaguePositionID == '_CHOOSE_'
>>   You must choose a position where you worked with this
>> person, or choose "Other..."
>> 
>> 
>>   reason == 'colleague' and colleaguePositionID == 'OTHER'
>>   
>> 
>>   
>> 
>> Hope this helps,
>> 
>> Matt
>> 
>> 
>> mraible wrote:
>>> 
>>> I need to do something similar - is it possible to have conditional
>>> visitor validation in Struts 2? AFAICT, it isn't.
>>> 
>>> Basically, I'd like to have a couple of validation rules for a
>>> drop-down. One rule is that the user must select at least one choice
>>> when the drop-down has its radio button selected:
>>> 
>>> 
>>> reason != 'partner' or (reason == 'partner' and
>>> partnerPositionID != '_CHOOSE_')
>&

[s2] ResourceBundle Search Order

2007-08-13 Thread mraible

On the following page, it describes how you can create hierarchical i18n
files and Struts will scan the hierarchy for appropriate messages.

http://struts.apache.org/2.x/docs/internationalization.html

This works well for Actions, but since most of my messages are in JSPs, I'd
prefer to put the *.properties files next to my JSPs and use a similar
hierarchy-scanning setup. Is this possible? If so, how would I go about
doing it? Is it just a matter of writing a new TextProvider? If so, how do I
plug it in and get  to read from it?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/-s2--ResourceBundle-Search-Order-tf4262689.html#a12130873
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 create a custom date range validator?

2007-08-10 Thread mraible

Changing this:

Integer startNumber = (Integer) getFieldValue(_startFieldName, object);
if(startNumber == null) 
  addFieldError(_startFieldName, "Start Year is a required field.");

To this:

Integer startNumber = (Integer) getFieldValue(_startFieldName, object);
if(startNumber == null) {
  setDefaultMessage("Start Year is a required field.");
  addFieldError(_startFieldName, object);
}

Seems to solve the problem. 

However, I did discover something strange. If a NPE is thrown in my
validator, the exception is swallowed. Any ideas on what could be causing
this. There's no information in my logs or shown in my browser (just
Tomcat's default 500 page).

uncaught exception
javax.servlet.ServletException
at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
    at o

Thanks,

Matt


mraible wrote:
> 
> I have the following validation XML that suites my needs perfectly:
> 
>   
> 
>   Start year is required.
> 
> 
>   1900
>   Please enter a date after 1900.
> 
> 
>   startYear gte currentYear
>   Start year must be less than or equal to the current year
> (${currentYear}).
> 
>   
>   
> 
>   End year is required.
> 
> 
>   1900
>   Please enter a date after 1900.
> 
> 
>   endYear lt startYear
>   End Year must be after Start year.
> 
>   
> 
> I'd like to turn this into a Java class so I can have the following XML
> instead:
> 
>   
> 
>   
> 
> Is this possible? 
> 
> I've given it a shot and I'm having some difficulty figuring out how to
> add field errors so they appear in the proper location (next to the
> fields) in my form. Here's the code I have so far. I realize that
> addFieldError() is not supposed to take the error message as its 2nd
> argument, but I think it helps convey what I'm trying to do.
> 
> public class MonthYearRangeValidator extends ValidatorSupport
> {
>   private String _startFieldName = "startYear";
>   private String _endFieldName = "endYear";
>   
>   public void validate(Object object)
>   throws ValidationException
>   {
> Integer startNumber = (Integer) getFieldValue(_startFieldName,
> object);
> if(startNumber == null) 
>   addFieldError(_startFieldName, "Start Year is a required field.");
> 
> Integer endNumber = (Integer) getFieldValue(_endFieldName, object);
> if(endNumber == null) {
>   addFieldError(_endFieldName, "End Year is a required field.");
> }
>
> if(!getValidatorContext().getFieldErrors().isEmpty())
>   return;
> 
> if (startNumber < 1900) {
>   addFieldError(_startFieldName, "Please enter a date after 1900.");
> }
> if (endNumber < 1900) {
>   addFieldError(_endFieldName, "Please enter a date after 1900.");
> }
> 
> if(!getValidatorContext().getFieldErrors().isEmpty())
>   return;
> 
> if (startNumber < Calendar.getInstance().get(Calendar.YEAR)) {
>   addFieldError(_startFieldName, "Start year must be less than or
> equal to the current year.");
> }
> 
> if (endNumber < startNumber) {
>   addFieldError(_endFieldName, "End Year must be after Start year.");
> }
>   }
> 
>   public void setStartFieldName(String startFieldName)
>   {
> _startFieldName = startFieldName;
>   }
> 
>   public void setEndFieldName(String endFieldName)
>   {
> _endFieldName = endFieldName;
>   }
> 
> }
> 
> Thanks,
> 
> Matt
> 

-- 
View this message in context: 
http://www.nabble.com/-s2--How-do-I-create-a-custom-date-range-validator--tf4245411.html#a12099744
Sent from the Struts - User mailing list archive at Nabble.com.


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



[s2] How do I create a custom date range validator?

2007-08-09 Thread mraible

I have the following validation XML that suites my needs perfectly:

  

  Start year is required.


  1900
  Please enter a date after 1900.


  startYear gte currentYear
  Start year must be less than or equal to the current year
(${currentYear}).

  
  

  End year is required.


  1900
  Please enter a date after 1900.


  endYear lt startYear
  End Year must be after Start year.

  

I'd like to turn this into a Java class so I can have the following XML
instead:

  

  

Is this possible? 

I've given it a shot and I'm having some difficulty figuring out how to add
field errors so they appear in the proper location (next to the fields) in
my form. Here's the code I have so far. I realize that addFieldError() is
not supposed to take the error message as its 2nd argument, but I think it
helps convey what I'm trying to do.

public class MonthYearRangeValidator extends ValidatorSupport
{
  private String _startFieldName = "startYear";
  private String _endFieldName = "endYear";
  
  public void validate(Object object)
  throws ValidationException
  {
Integer startNumber = (Integer) getFieldValue(_startFieldName, object);
if(startNumber == null) 
  addFieldError(_startFieldName, "Start Year is a required field.");

Integer endNumber = (Integer) getFieldValue(_endFieldName, object);
if(endNumber == null) {
  addFieldError(_endFieldName, "End Year is a required field.");
}
   
if(!getValidatorContext().getFieldErrors().isEmpty())
  return;

if (startNumber < 1900) {
  addFieldError(_startFieldName, "Please enter a date after 1900.");
}
if (endNumber < 1900) {
  addFieldError(_endFieldName, "Please enter a date after 1900.");
}

if(!getValidatorContext().getFieldErrors().isEmpty())
  return;

if (startNumber < Calendar.getInstance().get(Calendar.YEAR)) {
  addFieldError(_startFieldName, "Start year must be less than or equal
to the current year.");
}

if (endNumber < startNumber) {
  addFieldError(_endFieldName, "End Year must be after Start year.");
}
  }

  public void setStartFieldName(String startFieldName)
  {
_startFieldName = startFieldName;
  }

  public void setEndFieldName(String endFieldName)
  {
_endFieldName = endFieldName;
  }

}

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/-s2--How-do-I-create-a-custom-date-range-validator--tf4245411.html#a12081467
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: [2] Changing xwork.default.invalid.fieldvalue to report type

2007-08-09 Thread mraible

On a related note, the only way to override
"xwork.default.invalid.fieldvalue" seems to be to specify a global resource
bundle with "struts.custom.i18n.resources" in struts.xml and then put the
value in there. Is this correct?

The following page seems to imply that I should be able to override this
value in package.properties for a particular package.

http://struts.apache.org/2.x/docs/internationalization.html

Thanks,

Matt


Don Brown wrote:
> 
> Hmm...could you use a custom TextProvider impl that recognizes that
> error key, checks the type of the parameter, then looks up a new error
> key, say 'xwork.default.invalid.fieldvalue.number'?
> 
> Don
> 
> On 8/9/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> The default value for a type mismatch error (when doing conversion) is:
>>
>> xwork.default.invalid.fieldvalue=Invalid field value for field "{0}".
>>
>> I'd like to change it to render something like "Please enter a valid
>> date."
>> or "Please enter a valid number.". Is it possible to decipher the type of
>> the field and print that out?
>>
>> I realize I can customize the invalid messages on a per-field basis, but
>> I'd
>> like to do it on a per-type basis.
>>
>> Thanks,
>>
>> Matt
>> --
>> View this message in context:
>> http://www.nabble.com/-2--Changing-xwork.default.invalid.fieldvalue-to-report-type-tf4239378.html#a12062895
>> Sent from the Struts - User mailing list archive at Nabble.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/-2--Changing-xwork.default.invalid.fieldvalue-to-report-type-tf4239378.html#a12074911
Sent from the Struts - User mailing list archive at Nabble.com.


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



[2] Changing xwork.default.invalid.fieldvalue to report type

2007-08-08 Thread mraible

The default value for a type mismatch error (when doing conversion) is:

xwork.default.invalid.fieldvalue=Invalid field value for field "{0}".

I'd like to change it to render something like "Please enter a valid date."
or "Please enter a valid number.". Is it possible to decipher the type of
the field and print that out?

I realize I can customize the invalid messages on a per-field basis, but I'd
like to do it on a per-type basis.

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/-2--Changing-xwork.default.invalid.fieldvalue-to-report-type-tf4239378.html#a12062895
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] Error Message display

2007-08-07 Thread mraible

Here's what I've done:

 


IMO,  should detect when there's only one error and emit no
 tags. I've entered an issue in JIRA for this:

https://issues.apache.org/struts/browse/WW-2090

On a related note, looking at the docs, it looks like you're required to use
 to specify the field name. Is this true, or can "name" be used for
that?

Thanks,

Matt


Petzsch, Martin wrote:
> 
> 
> Hi,
> 
> Short of modifying the template for s:fielderror is there a way to
> retrieve
> just the text of the error message on a JSP?
> 
> Even with the theme set to simple I get the following on my jsp:
> An Error Message
> 
> What I want is just the message:
> An Error Message
> 
> And then I am free to decorate it as I wish.
> 
> Equally if you think I am taking the wrong approach to this please let me
> know.  The goal is to just display an error message - to the right of the
> field and to decorate it with CSS classes of our choice.  Ending up with
> something like this:
> 
> 
> An Error Message
> 
> Many thanks!
> Martin
> 
> 
> Capgemini is a trading name used by the Capgemini Group of companies which
> includes Capgemini UK plc, a company registered in England and Wales
> (number 943935) whose registered office is at No. 1 Forge End, Woking,
> Surrey, GU21 6DB. 
> 
> 
> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Error-Message-display-tf4229431.html#a12038118
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] s:component and reading parameters

2007-08-06 Thread mraible

Here's how I'm referencing the component/template:

  

  

In my addposition.jsp, I added:




This doesn't render the error for "partnerPosition". However, if I change it
to:




...it works.

In my textfield tags, parameters.name is resolved correctly, so I know I'm
passing the proper value. I just can't figure out how to pass it in as a
literal value to the fieldErrors map.

Matt


Musachy Barroso wrote:
> 
> Ah..that "parameter", my bad. Just to make it easier to figure it out
> break it down to:
> 
> 
> 
> 
> now this is kind of a dumb question, but are you sure there is an
> error for that field?
> 
> 
> 
> musachy
> 
> On 8/6/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> I tried your suggestion, no dice. I think the problem is that I have an
>> expression w/in an expression. The following works for a textfield:
>>
>> 
>>
>> I don't know if "parameters" is request parameters - it's whatever
>>  creates.
>>
>> Matt
>>
>>
>> Musachy Barroso wrote:
>> >
>> > Try (assuming parameters here are the request parameters)
>> >
>> > 
>> >
>> > (#parameter.name is an array, it gets me all the time :) )
>> >
>> > musachy
>> >
>> > On 8/6/07, mraible <[EMAIL PROTECTED]> wrote:
>> >>
>> >> That worked - thanks!
>> >>
>> >> Now I can't get the following to work - is it possible?
>> >>
>> >> 
>> >>
>> >> I need to use this syntax to render errors next to fields since the
>> >> default
>> >>  (simple) tag wraps the error with an  even when
>> >> there's
>> >> only one error. This makes it difficult to put errors next to fields
>> (w/o
>> >> customizing a theme).
>> >>
>> >> Matt
>> >>
>> >>
>> >> Musachy Barroso wrote:
>> >> >
>> >> > try :
>> >> >
>> >> > 
>> >> >
>> >> > musachy
>> >> >
>> >> > On 8/6/07, mraible <[EMAIL PROTECTED]> wrote:
>> >> >>
>> >> >> I'm trying to use the  tag to create a re-usable set
>> of
>> >> >> fields
>> >> >> in a form. In my JSP:
>> >> >>
>> >> >>   
>> >> >> 
>> >> >>   
>> >> >>
>> >> >> In template/simple/addposition.jsp, I have:
>> >> >>
>> >> >> <%@ taglib uri="/struts-tags" prefix="s" %>
>> >> >>
>> >> >> Name: 
>> >> >>
>> >> >> For some reason, this doesn't work.
>> >> >>
>> >> >> Is there something I'm doing wrong? Can templates be JSPs or do
>> they
>> >> have
>> >> >> to
>> >> >> be FreeMarker/Velocity?
>> >> >>
>> >> >> Correct me if I'm wrong, but doesn't Struts'  tag
>> >> accomplish
>> >> >> the same thing that can be accomplished with JSTL's  and
>> >> >> 
>> >> >> tags? If so, it seems that JSP 2.0 tag files are a much more
>> elegant
>> >> >> solution than  or .
>> >> >>
>> >> >> Thanks,
>> >> >>
>> >> >> Matt
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12023494
>> >> >> Sent from the Struts - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> -
>> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > "Hey you! Would you help me to carry the stone?" Pink Floyd
>> >> >
>> >> >
>> -
>> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> > For additional commands, e-mail: [

Re: [s2] s:component and reading parameters

2007-08-06 Thread mraible

I tried your suggestion, no dice. I think the problem is that I have an
expression w/in an expression. The following works for a textfield:



I don't know if "parameters" is request parameters - it's whatever
 creates.

Matt


Musachy Barroso wrote:
> 
> Try (assuming parameters here are the request parameters)
> 
> 
> 
> (#parameter.name is an array, it gets me all the time :) )
> 
> musachy
> 
> On 8/6/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> That worked - thanks!
>>
>> Now I can't get the following to work - is it possible?
>>
>> 
>>
>> I need to use this syntax to render errors next to fields since the
>> default
>>  (simple) tag wraps the error with an  even when
>> there's
>> only one error. This makes it difficult to put errors next to fields (w/o
>> customizing a theme).
>>
>> Matt
>>
>>
>> Musachy Barroso wrote:
>> >
>> > try :
>> >
>> > 
>> >
>> > musachy
>> >
>> > On 8/6/07, mraible <[EMAIL PROTECTED]> wrote:
>> >>
>> >> I'm trying to use the  tag to create a re-usable set of
>> >> fields
>> >> in a form. In my JSP:
>> >>
>> >>   
>> >> 
>> >>   
>> >>
>> >> In template/simple/addposition.jsp, I have:
>> >>
>> >> <%@ taglib uri="/struts-tags" prefix="s" %>
>> >>
>> >> Name: 
>> >>
>> >> For some reason, this doesn't work.
>> >>
>> >> Is there something I'm doing wrong? Can templates be JSPs or do they
>> have
>> >> to
>> >> be FreeMarker/Velocity?
>> >>
>> >> Correct me if I'm wrong, but doesn't Struts'  tag
>> accomplish
>> >> the same thing that can be accomplished with JSTL's  and
>> >> 
>> >> tags? If so, it seems that JSP 2.0 tag files are a much more elegant
>> >> solution than  or .
>> >>
>> >> Thanks,
>> >>
>> >> Matt
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12023494
>> >> Sent from the Struts - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> -
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>> > --
>> > "Hey you! Would you help me to carry the stone?" Pink Floyd
>> >
>> > -
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12024122
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12024353
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] s:component and reading parameters

2007-08-06 Thread mraible

That worked - thanks!

Now I can't get the following to work - is it possible?



I need to use this syntax to render errors next to fields since the default
 (simple) tag wraps the error with an  even when there's
only one error. This makes it difficult to put errors next to fields (w/o
customizing a theme).

Matt


Musachy Barroso wrote:
> 
> try :
> 
> 
> 
> musachy
> 
> On 8/6/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> I'm trying to use the  tag to create a re-usable set of
>> fields
>> in a form. In my JSP:
>>
>>   
>> 
>>   
>>
>> In template/simple/addposition.jsp, I have:
>>
>> <%@ taglib uri="/struts-tags" prefix="s" %>
>>
>> Name: 
>>
>> For some reason, this doesn't work.
>>
>> Is there something I'm doing wrong? Can templates be JSPs or do they have
>> to
>> be FreeMarker/Velocity?
>>
>> Correct me if I'm wrong, but doesn't Struts'  tag accomplish
>> the same thing that can be accomplished with JSTL's  and
>> 
>> tags? If so, it seems that JSP 2.0 tag files are a much more elegant
>> solution than  or .
>>
>> Thanks,
>>
>> Matt
>> --
>> View this message in context:
>> http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12023494
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12024122
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] Is it possible to replace/supplement i18n resolution logic?

2007-08-06 Thread mraible



Don Brown wrote:
> 
> On 8/4/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> With Struts 2, how would I go about doing the following:
>>
>> 1. Replace the i18n resolution logic to load key/value pairs from a
>> database
>> instead of properties files?
> 
> Well, if your Action class implements TextProvider (as does
> ActionSupport), then you can resolve keys any way you'd like.  As for
> plugging/altering the existing lookup that is used by ActionSupport,
> it really isn't possible right now, and I've love to see a patch
> making that more flexible... *hint* *hint* :)
> 

Does this affect  as well? I'm not as concerned about Java reading
i18n files as I am about JSPs.


Don Brown wrote:
> 
> 
>> 2. Add an extra processing step to translate wiki syntax in values to
>> HTML?
> 
> You mean like creating your own template to customize the rendering of
> the control?  If using Freemarker, there might be a nice way to write
> something like the ?html piece that processes returned values.
> 

No, I'm looking to add an extra process step. Here's an example, using JSTL
 since I'm more familiar with it:

messages.properties:
page.message=Welcome to My Cool App *{0}*!

page.jsp:


renders:
Welcome to My Cool App *Matt*!

I want it to render:

Welcome to My Cool App Matt!

Thanks,

Matt



-- 
View this message in context: 
http://www.nabble.com/-s2--Is-it-possible-to-replace-supplement-i18n-resolution-logic--tf4214304.html#a12023712
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] Is it possible to replace/supplement i18n resolution logic?

2007-08-06 Thread mraible



Ray Clough wrote:
> 
> We did something similar to what you are suggesting.  We still use
> properties files, but we replaced much of the lookup with our own classes. 
> We created a wrapper around ResourceBundle which has overloaded
> 'getText()' methods.  We make this accessible to all parts of the app with
> a ThreadLocal object which incorporates the current Locale, and has a
> 'getMessageProvider()' method.  The 'MessageProvider' has the
> 'getText(key, args)' methods.  We did this because the non-Struts modules
> of the app need Message Support also, and so in order to keep the Struts
> artifacts out of these modules, we did the extra work.  The process of
> replacing messaging in the JSP pages was too daunting, so we still use the
> S2 tags to resolve those messages.  Our module uses the same
> ResourceBundle files as the Struts module.  However we created our own tag
> library to replace the s:text tag in some instances where the action isn't
> S2 (sometimes it is S1, sometimes it is JSF).  I think the ideal solution
> would be to move all the messaging resources into a new Commons project
> (commons-messaging??), and to access to the messaging service as an
> interface abstraction.  That way the choice of messaging service would be
> more flexible.
> 
> Changing the S2 messaging system would require overriding the 'getText()'
> methods in the ActionSupport class, as well as changing the way that the
> S2 tags get their messages.  That would be a pretty huge job, and would
> take a huge amount of refactoring of the S2 code base.  However, IMHO the
> S2 tags are really poor, so replacing them completely with a new library
> would be an excellent step.  
> 
> What I dislike most about the S2 tags is that their syntax is confusing,
> and very un-jsp-like.  They don't allow runtime expressions (like the jstl
> tags), requiring the use of s:set to create properties which are then
> de-referenced in the UI tags.  Also the syntax for accessing OGNL is
> particularly incongruous.  Some tags require using both a "%" and a "#"
> within one tag.  A lot of this is the result of trying to make a tag
> library that is flexible enough to work in environments other than JSP,
> but I believe a lot of it is due to the 'hobby-like' nature of S2 (I was
> not involved, so this is speculation on my part).  The evolution of
> WebWork from Struts allowed the WW developers to 'try things out', and
> when the project was remerged into S2, many design decisions which should
> have been reversed were found to be too much trouble.  So the 'try things
> out' features remain to bedevil the S2 application architecture.  The very
> worst feature (again IMHO) is the mandatory use of themes.  The other very
> worst feature is the result 'type' feature which mandates that only one
> rendering type can be used in any one page.  For example, if you are using
> the Tiles plugin with 'type=tiles', you can't use the jsf plugin with
> 'type=jsf'.  This has mandated that we don't use any plugins at all.  Of
> course, this isn't a big loss because the most of plugins are very very
> very ... very buggy and do not appear to be in current development, as
> judged by their still poor implementations.  Another very worst feature is
> the translation of the word "POJO" to equal "Java Bean", and means that
> everything has getters and setters everywhere, which makes the apps
> developed with it poorly encapsulated and difficult to maintain (the
> designers of S2 definitely did not read, or did not comprehend, or did not
> believe, the central theme of "Why Getters and Setters are Evil").
> 
> Sorry for the rant, but I do like many of the S2 features well enough that
> I continue to use it, and the S2 architecture is definitely better than S1
> (death to ActionForm!).
> 
> - Ray Clough
> 

Do you have a list of specific issues you've seen with the JSF Plugin? It'd
be nice to get these documented so 1) users can be aware of them and 2)
developers/contributors can fix them. 

Also, if you believe getters and setters are evil, what's the solution? Most
of the Java web frameworks I know of today use getters and setters to
read/set values. Are getters and setters evil in your Hibernate/JPA POJOs as
well?

Matt

-- 
View this message in context: 
http://www.nabble.com/-s2--Is-it-possible-to-replace-supplement-i18n-resolution-logic--tf4214304.html#a12023507
Sent from the Struts - User mailing list archive at Nabble.com.


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



[s2] s:component and reading parameters

2007-08-06 Thread mraible

I'm trying to use the  tag to create a re-usable set of fields
in a form. In my JSP:

  

  

In template/simple/addposition.jsp, I have:

<%@ taglib uri="/struts-tags" prefix="s" %>

Name: 

For some reason, this doesn't work. 

Is there something I'm doing wrong? Can templates be JSPs or do they have to
be FreeMarker/Velocity?

Correct me if I'm wrong, but doesn't Struts'  tag accomplish
the same thing that can be accomplished with JSTL's  and 
tags? If so, it seems that JSP 2.0 tag files are a much more elegant
solution than  or .

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/-s2--s%3Acomponent-and-reading-parameters-tf4226480.html#a12023494
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: Conditional validation

2007-08-03 Thread mraible

I figured out how to do this - posting here so others will benefit.

1. Create a new ConditionalVisitorFieldValidator.java:

public class ConditionalVisitorFieldValidator extends VisitorFieldValidator
{
  private String expression;

  public void setExpression(String expression)
  {
this.expression = expression;
  }

  public String getExpression()
  {
return expression;
  }

  /**
   * If expression evaluates to true, invoke visitor validation.
   * @param object the object being validated
   * @throws ValidationException
   */
  public void validate(Object object) throws ValidationException
  {
if (validateExpression(object))
{
  super.validate(object);
}
  }

  /**
   * Validate the expression contained in the "expression" paramter.
   * @param object the object you're validating
   * @return true if expression evaluates to true (implying a validation
failure)
   * @throws ValidationException if anything goes wrong
   */
  public boolean validateExpression(Object object) throws
ValidationException
  {
Boolean answer = Boolean.FALSE;
Object obj = null;

try
{
  obj = getFieldValue(expression, object);
}
catch (ValidationException e)
{
  throw e;
}
catch (Exception e)
{
  // let this pass, but it will be logged right below
}

if ((obj != null) && (obj instanceof Boolean))
{
  answer = (Boolean) obj;
}
else
{
  log.warn("Got result of " + obj + " when trying to get Boolean.");
}

return answer;
  }
}

2. Add it to your validators.xml:



3. Write your validation rule:

  

  reason == 'colleague' and colleaguePositionID == '_CHOOSE_'
  You must choose a position where you worked with this person,
or choose "Other..."


  reason == 'colleague' and colleaguePositionID == 'OTHER'
  

  

Hope this helps,

Matt


mraible wrote:
> 
> I need to do something similar - is it possible to have conditional
> visitor validation in Struts 2? AFAICT, it isn't.
> 
> Basically, I'd like to have a couple of validation rules for a drop-down.
> One rule is that the user must select at least one choice when the
> drop-down has its radio button selected:
> 
> 
> reason != 'partner' or (reason == 'partner' and partnerPositionID
> != '_CHOOSE_')
> You must choose a position where you worked with this
> person, or choose "Other..."
> 
> 
> This works. Now I want to require a number of fields if the person selects
> the "Other..." option. The validation syntax starts to get complicated at
> this point. I'd like to do something like:
> 
> reason != 'partner' or (reason == 'partner' and partnerPositionID !=
> 'OTHER')  -> kick in visitor validation.
> 
> I still think the above syntax is confusing (ref
> http://tinyurl.com/2htw2k), I'd much rather write something like:
> 
> reason == 'partner' and partnerPositionID == 'OTHER' -> show message
> 
> I'm guessing it's possible to write my own FieldExpressionValidator that
> inverses the true/false outcome?
> 
> Why do I need conditional visitor validation? 
> 
> I'm trying to create a "component" that can be re-used in the backend
> (model object w/ its own validation rules) and on the front-end (using JSP
> tag files or the s:component tag). 
> 
> If there's an easier way to do this, please let me know. Of course, I
> could use JSF/Wicket/Tapestry - and that might be the outcome if this is
> not possible.
> 
> Thanks,
> 
> Matt
> 
> 
> Sparecreative wrote:
>> 
>> Is there a way to setup conditional validation through the validation.xml
>> file?
>> 
>> I'm currently user the visitor validator method where my core user
>> validation properties are in a User-validation.xml file. I want to be
>> able
>> to use this same file for all my user actions (register, add, update) and
>> just have conditional code which looks a user field to determine
>> validation.
>> 
>> At the moment I'm using a combination of the valididation.xml file and
>> the
>> validate method in the action.
>> 
>> I know the following doesn't work, but can I have something like this:
>> 
>> > 1.0.2//EN"
>> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>
>> 
>> 
>>  
>> 
>>   user.action.equals('insert') || user.action.equals('register')
>>  
>>  
>> 
>>   
>> 
>>   
>>   
>> 
>>   

Re: FieldExpressionValidator: How do I reference field names?

2007-08-03 Thread mraible

Just to follow up, I've created my own custom FieldExpressionValidator to get
my desired behavior. The code is below in case anyone wants to use it.
Here's how:

1. Create a validators.xml in your WEB-INF/classes (or src/main/resources
for M2) to override the "fieldexpression" validator:

http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd";>


  


2. Create LogicalFieldExpressionValidator:

package com.yourcompany.app.validation;

import
com.opensymphony.xwork2.validator.validators.FieldExpressionValidator;
import com.opensymphony.xwork2.validator.ValidationException;

/**
 * Override XWork's FieldExpressionValidator because it's more intuitive to
 * write expressions that evaluate to false rather than true.
 */
public class LogicalFieldExpressionValidator extends
FieldExpressionValidator
{
  public void validate(Object object) throws ValidationException
  {
String fieldName = getFieldName();

Boolean answer = Boolean.FALSE;
Object obj = null;

try
{
  obj = getFieldValue(getExpression(), object);
}
catch (ValidationException e)
{
  throw e;
}
catch (Exception e)
{
  // let this pass, but it will be logged right below
}

if ((obj != null) && (obj instanceof Boolean))
{
  answer = (Boolean) obj;
}
else
{
  log.warn("Got result of " + obj + " when trying to get Boolean.");
}

// parent class has !answer.booleanValue()
if (answer.booleanValue())
{
  addFieldError(fieldName, object);
}
  }
}

After doing this, instead of having the following expression:



reason != null and (reason == 'friend' and friendEmail == '')
Please provide your friend's email



I get to have:



reason == 'friend' and friendEmail == ''
Please provide your friend's email



This seems much more logical to me.

Matt




mraible wrote:
> 
> The following expression seems to do the trick:
> 
> reason != 'friend' or (reason == 'friend' and friendEmail != '')
> 
> However, this doesn't seem very intuitive, does it? Writing it in Java
> seems more logical:
> 
>   public void validate() {
> if (reason != null && reason.equals("friend") &&
> friendEmail.equals("")) {
>   addFieldError("friendEmail", "Please provide your friend's email");
> }
>   }
> 
> Why does the expression use the opposite (friendEmail != "") where the
> Java uses friendEmail == ""? Doesn't that seem confusing?
> 
> Matt
> 
> Eric Rank-2 wrote:
>> 
>> 
>> My Bad, there's another scenario when this field will validate. When  
>> reason != 'friend'
>> 
>> Better expression:
>> 
>> (reason != 'friend') or ((reason ==  
>> 'friend') and (friendEmail != null) and (friendEmail.trim().size() >  
>> 0))
>> 
>> Eric
>> 
>> On Jul 19, 2007, at 1:33 PM, Eric Rank wrote:
>> 
>>> Hi Matt,
>>>
>>> I tried out your scenario, and I think I found the problem. In my  
>>> test, it also validated when I left the friendEmail field blank. It  
>>> seems that the value of friendEmail is not null, but an empty  
>>> string. To solve the problem, I added another clause to check for  
>>> String length. After that, it triggered the field error as desired.  
>>> This is what worked for me.
>>>
>>> 
>>>   
>>> 
>>> reason == 'friend' and  
>>> friendEmail != null and friendEmail.trim().size() > 0
>>> Please provide your friend's email
>>> 
>>> 
>>> 
>>>
>>>
>>> Eric.
>>>
>>>
>>> On Jul 19, 2007, at 10:40 AM, mraible wrote:
>>>
>>>> If you're right, I'd expect the following expression make friendEmail
>>>> required when the "friend" reason is checked (it's a radio button):
>>>>
>>>> reason == 'friend' and friendEmail != null
>>>>
>>>> However, if I check friend and don't fill out the e-mail address,  
>>>> it still
>>>> passes validation. Based on the error message I'm getting in my  
>>>> logs (see
>>>> below), I'm guessing that I need to do some sort of "friendEmail ! 
>>>> = null"
>>>> check, but I'm already doing that.
>>>
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11989689
Sent from the Struts - User mailing list archive at Nabble.com.


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



[s2] Is it possible to replace/supplement i18n resolution logic?

2007-08-03 Thread mraible

With Struts 2, how would I go about doing the following:

1. Replace the i18n resolution logic to load key/value pairs from a database
instead of properties files?
2. Add an extra processing step to translate wiki syntax in values to HTML?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/-s2--Is-it-possible-to-replace-supplement-i18n-resolution-logic--tf4214304.html#a11989382
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: Conditional validation

2007-08-01 Thread mraible

I need to do something similar - is it possible to have conditional visitor
validation in Struts 2? AFAICT, it isn't.

Basically, I'd like to have a couple of validation rules for a drop-down.
One rule is that the user must select at least one choice when the drop-down
has its radio button selected:


reason != 'partner' or (reason == 'partner' and partnerPositionID !=
'_CHOOSE_')
You must choose a position where you worked with this
person, or choose "Other..."


This works. Now I want to require a number of fields if the person selects
the "Other..." option. The validation syntax starts to get complicated at
this point. I'd like to do something like:

reason != 'partner' or (reason == 'partner' and partnerPositionID !=
'OTHER')  -> kick in visitor validation.

I still think the above syntax is confusing (ref http://tinyurl.com/2htw2k),
I'd much rather write something like:

reason == 'partner' and partnerPositionID == 'OTHER' -> show message

I'm guessing it's possible to write my own FieldExpressionValidator that
inverses the true/false outcome?

Why do I need conditional visitor validation? 

I'm trying to create a "component" that can be re-used in the backend (model
object w/ its own validation rules) and on the front-end (using JSP tag
files or the s:component tag). 

If there's an easier way to do this, please let me know. Of course, I could
use JSF/Wicket/Tapestry - and that might be the outcome if this is not
possible.

Thanks,

Matt


Sparecreative wrote:
> 
> Is there a way to setup conditional validation through the validation.xml
> file?
> 
> I'm currently user the visitor validator method where my core user
> validation properties are in a User-validation.xml file. I want to be able
> to use this same file for all my user actions (register, add, update) and
> just have conditional code which looks a user field to determine
> validation.
> 
> At the moment I'm using a combination of the valididation.xml file and the
> validate method in the action.
> 
> I know the following doesn't work, but can I have something like this:
> 
>  1.0.2//EN"
> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>
> 
> 
>  
> 
>   user.action.equals('insert') || user.action.equals('register')
>  
>  
> 
>   
> 
>   
>   
> 
>   
> 
>   
>  
> 
> 
> 
> 
> resource not found
> 
> 
> 
>   short-circuit="true">
> 
> 
> 
> 
> 
> 
> 
> 
> 10
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Z.
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Conditional-validation-tf3678771.html#a11950499
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: Yes_I added the jar_Re: How to use struts 2 JSF plugin? Help pls!!!

2007-07-30 Thread mraible

Have you looked at the showcase example (it's part of the Struts downloads)?
That's how I figured it out.

Matt


lupus wrote:
> 
> Thanks Matt,
> 
> Sorry that I mailed you directly the response, I am not familaw with
> nabble :).
> 
> I think the problem is in the configuration of struts-jsf.xml and the
> action mapping in the corresponding jsf page. But I do not know how to fix
> it, because from the beginning I am not clear how it works, and what
> configurations I have to do to get it working.
> 
> If possible, do u mind showing me a simple example? 
> 
> Thank you very much!
> 
> Lupus
> 
> 
> 
> mraible wrote:
>> 
>> Have you added the JSF implementation's JARs to your classpath?
>> 
>> Matt
>> 
>> 
>> lupus wrote:
>>> 
>>> Hi all,
>>> 
>>> I cannot get Struts 2 JSF plugin working, the plugin documentation
>>> (http://struts.apache.org/2.x/docs/jsf-plugin.html) is not clear for me
>>> to follow and the jsf show-case mixed all the things together..., I do
>>> not know what configurations I need to get the JSF plugin working. I
>>> tried and failed. what I want to achieve is "when you input your name in
>>> jsf page, there comes a greeting page".
>>> 
>>> In the follow is what I have tried: 
>>> 
>>> 1. I add JavaServer Faces Servlet Configuration in web.xml as what the
>>> show-case does, but I get the error message: The requested resource
>>> (Servlet faces is not available) is not available.
>>> 
>>>
>>> 
>>> faces
>>> javax.faces.webapp.FacesServlet
>>> 1
>>> 
>>> 
>>> 
>>> 
>>> faces
>>>*.action
>>>  
>>> 
>>> 2. I add struts-jsf.xml into struts.xml
>>> 
>>> >> "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>>> "http://struts.apache.org/dtds/struts-2.0.dtd";>
>>>  
>>> 
>>>   
>>> 
>>>   
>>>   >> class="org.apache.struts2.jsf.FacesResult" />
>>>   
>>> 
>>> 
>>>   
>>> 
>>> 
>>> 
>>>   
>>> 
>>> 
>>> 
>>> 
>>>   
>>>   
>>>   >> namespace="/web/jsf/PersonBean">
>>>   
>>> >> method="getPersonName">
>>>   
>>> 
>>> >> method="setPersonName">
>>>   
>>> 
>>>   
>>> 
>>> 
>>> 
>>> 3. My java class PersonBean.java:
>>> package web.jsf;
>>> 
>>> public class PersonBean {
>>> 
>>>String personName;
>>> 
>>>/**
>>>* @return Person Name
>>>*/
>>>public String getPersonName() {
>>>   return personName;
>>>}
>>> 
>>>/**
>>>* @param Person Name
>>>*/
>>>public void setPersonName(String name) {
>>>   personName = name;
>>>}
>>> }
>>> 
>>> 4. Here is my jsp inputname.jsp
>>> 
>>>  
>>>  
>>>   
>>>  
>>>  
>>>   
>>>   
>>>   
>>>   
>>>
>>> 
>>> I think in my jsp action mapping may not be correct, but I don't know
>>> how to fix it.
>>> 
>>> Did I miss some configurations ? Please help me out.
>>> 
>>> Thank you very much!!!:-)
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-use-struts-2-JSF-plugin--Help-pls%21%21%21-tf4178602.html#a11884585
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: How to use struts 2 JSF plugin? Help pls!!!

2007-07-30 Thread mraible

Have you added the JSF implementation's JARs to your classpath?

Matt


lupus wrote:
> 
> Hi all,
> 
> I cannot get Struts 2 JSF plugin working, the plugin documentation
> (http://struts.apache.org/2.x/docs/jsf-plugin.html) is not clear for me to
> follow and the jsf show-case mixed all the things together..., I do not
> know what configurations I need to get the JSF plugin working. I tried and
> failed. what I want to achieve is "when you input your name in jsf page,
> there comes a greeting page".
> 
> In the follow is what I have tried: 
> 
> 1. I add JavaServer Faces Servlet Configuration in web.xml as what the
> show-case does, but I get the error message: The requested resource
> (Servlet faces is not available) is not available.
> 
>
>   
>   faces
>   javax.faces.webapp.FacesServlet
>   1
>   
> 
>   
>   
> faces
>*.action
>  
> 
> 2. I add struts-jsf.xml into struts.xml
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd";>
>  
> 
>   
> 
>   
>class="org.apache.struts2.jsf.FacesResult" />
>   
> 
> 
>   
> 
> 
> 
>   
> 
> 
> 
> 
>   
>   
>namespace="/web/jsf/PersonBean">
>   
>  method="getPersonName">
>   
> 
>method="setPersonName">
>   
> 
>   
> 
> 
> 
> 3. My java class PersonBean.java:
> package web.jsf;
> 
> public class PersonBean {
> 
>String personName;
>   
>/**
>* @return Person Name
>*/
>public String getPersonName() {
>   return personName;
>}
> 
>/**
>* @param Person Name
>*/
>public void setPersonName(String name) {
>   personName = name;
>}
> }
> 
> 4. Here is my jsp inputname.jsp
> 
>  
>  
>   
>  
>  
>   
>   
>/>
>   
>
> 
> I think in my jsp action mapping may not be correct, but I don't know how
> to fix it.
> 
> Did I miss some configurations ? Please help me out.
> 
> Thank you very much!!!:-)
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-use-struts-2-JSF-plugin--Help-pls%21%21%21-tf4178602.html#a11883175
Sent from the Struts - User mailing list archive at Nabble.com.


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



[s2] Is it possible to pre-compile JSPs and evaluate expressions?

2007-07-30 Thread mraible

Is it possible to pre-compile JSPs with Struts 2, as well as compile/evaluate
OGNL expressions? 

I found the following on compiling OGNL expressions, but it's a little more
low-level than what I'm looking for.

http://cwiki.apache.org/WW/ognl-expression-compilation.html

I'm looking for a mechanism or tool that will allow me to parse/compile
pages and look for syntax errors that might exist in expressions. I'd
probably need to somehow map Actions to JSPs (possibly using zero-config or
struts.xml) and then evaluate expressions to make sure they map to methods
that exist in Actions or on the ValueStack.

Has anyone done something like this?

Thanks,

Matt


-- 
View this message in context: 
http://www.nabble.com/-s2--Is-it-possible-to-pre-compile-JSPs-and-evaluate-expressions--tf4177668.html#a11879129
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: Can I integrate Struts 2 + JSF and Facelets?

2007-07-26 Thread mraible



mraible wrote:
> 
> Thanks for your help. I was able to get it working with Sun's RI +
> Facelets. I'm confident I could get it working with MyFaces 1.2 as well -
> but since they require a JSP 2.1 container (Sun's RI doesn't), I'll stick
> with the RI.
> 
> Here's the two ways I discovered:
> 
> 1. Create a faces-config.xml file with the following contents:
> 
> 
> http://java.sun.com/xml/ns/javaee";
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd";
>   version="1.2">
> 
> 
> com.sun.facelets.FaceletViewHandler
> 
> 
> 
> 2. Integrate Ajax4JSF (no faces-config.xml required) and add the following
> to your web.xml:
> 
> 
> org.ajax4jsf.VIEW_HANDLERS
> com.sun.facelets.FaceletViewHandler
> 
> 
> There does seem to be a bug with this integration however. The
> content-type returned from a Facelets page by default is:
> 
> Content-Type: application/xhtml+xml; charset=UTF-8
> 
> Since I'm using SiteMesh, my Facelets pages don't get decorated by
> default. The workaround seems to be adding the following at the top of my
> pages:
> 
> 
> 
> This doesn't happen when using JSP for the view. It also doesn't happen
> when I use JSF standalone.
> 
> Matt
> 

Adding the following to sitemesh.xml allows me to remove the  tags
from my Facelets pages:



Matt

-- 
View this message in context: 
http://www.nabble.com/Can-I-integrate-Struts-2-%2B-JSF-and-Facelets--tf4138220.html#a11815698
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: Can I integrate Struts 2 + JSF and Facelets?

2007-07-26 Thread mraible

Thanks for your help. I was able to get it working with Sun's RI + Facelets.
I'm confident I could get it working with MyFaces 1.2 as well - but since
they require a JSP 2.1 container (Sun's RI doesn't), I'll stick with the RI.

Here's the two ways I discovered:

1. Create a faces-config.xml file with the following contents:


http://java.sun.com/xml/ns/javaee";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd";
  version="1.2">


com.sun.facelets.FaceletViewHandler



2. Integrate Ajax4JSF (no faces-config.xml required) and add the following
to your web.xml:


org.ajax4jsf.VIEW_HANDLERS
com.sun.facelets.FaceletViewHandler


There does seem to be a bug with this integration however. The content-type
returned from a Facelets page by default is:

Content-Type: application/xhtml+xml; charset=UTF-8

Since I'm using SiteMesh, my Facelets pages don't get decorated by default.
The workaround seems to be adding the following at the top of my pages:



This doesn't happen when using JSP for the view. It also doesn't happen when
I use JSF standalone.

Matt

Laurie Harper wrote:
> 
> mraible wrote:
>> I'm trying to integrate JSF into a Struts 2 prototype. AFAICT, I need to
>> add
>> the struts-jsf-plugin to my pom.xml and add FacesServlet to my web.xml.
>> Are
>> there any other steps needed?
>> 
>> I'm using Sun's RI since it run's on Tomcat 5.x with JSP 2.0. How do I
>> tell
>> JSF to use Facelets w/o a faces-config.xml file? Does the plugin only
>> work
>> with MyFaces + JSP?
> 
> The JSF plugin should work with either MyFaces or the RI, and Facelets 
> should work too. I don't think you can get Facelets configured without 
> making the usual additions to web.xml and faces-config.xml, though, so 
> you'll need to do that as normal.
> 
> L.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can-I-integrate-Struts-2-%2B-JSF-and-Facelets--tf4138220.html#a11815395
Sent from the Struts - User mailing list archive at Nabble.com.


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



Can I integrate Struts 2 + JSF and Facelets?

2007-07-24 Thread mraible

I'm trying to integrate JSF into a Struts 2 prototype. AFAICT, I need to add
the struts-jsf-plugin to my pom.xml and add FacesServlet to my web.xml. Are
there any other steps needed?

I'm using Sun's RI since it run's on Tomcat 5.x with JSP 2.0. How do I tell
JSF to use Facelets w/o a faces-config.xml file? Does the plugin only work
with MyFaces + JSP?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Can-I-integrate-Struts-2-%2B-JSF-and-Facelets--tf4138220.html#a11770456
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: FieldExpressionValidator: How do I reference field names?

2007-07-23 Thread mraible

The following expression seems to do the trick:

reason != 'friend' or (reason == 'friend' and friendEmail != '')

However, this doesn't seem very intuitive, does it? Writing it in Java seems
more logical:

  public void validate() {
if (reason != null && reason.equals("friend") && friendEmail.equals(""))
{
  addFieldError("friendEmail", "Please provide your friend's email");
}
  }

Why does the expression use the opposite (friendEmail != "") where the Java
uses friendEmail == ""? Doesn't that seem confusing?

Matt

Eric Rank-2 wrote:
> 
> 
> My Bad, there's another scenario when this field will validate. When  
> reason != 'friend'
> 
> Better expression:
> 
> (reason != 'friend') or ((reason ==  
> 'friend') and (friendEmail != null) and (friendEmail.trim().size() >  
> 0))
> 
> Eric
> 
> On Jul 19, 2007, at 1:33 PM, Eric Rank wrote:
> 
>> Hi Matt,
>>
>> I tried out your scenario, and I think I found the problem. In my  
>> test, it also validated when I left the friendEmail field blank. It  
>> seems that the value of friendEmail is not null, but an empty  
>> string. To solve the problem, I added another clause to check for  
>> String length. After that, it triggered the field error as desired.  
>> This is what worked for me.
>>
>> 
>>   
>> 
>> reason == 'friend' and  
>> friendEmail != null and friendEmail.trim().size() > 0
>> Please provide your friend's email
>> 
>> 
>> 
>>
>>
>> Eric.
>>
>>
>> On Jul 19, 2007, at 10:40 AM, mraible wrote:
>>
>>> If you're right, I'd expect the following expression make friendEmail
>>> required when the "friend" reason is checked (it's a radio button):
>>>
>>> reason == 'friend' and friendEmail != null
>>>
>>> However, if I check friend and don't fill out the e-mail address,  
>>> it still
>>> passes validation. Based on the error message I'm getting in my  
>>> logs (see
>>> below), I'm guessing that I need to do some sort of "friendEmail ! 
>>> = null"
>>> check, but I'm already doing that.
>>
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11749020
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: FieldExpressionValidator: How do I reference field names?

2007-07-19 Thread mraible

I wish the solution was that easy - I tried your expression below and still
no dice. Maybe it's something so small I can't see it? Does it have
something to do with the fact that "reason" is a radio button that sets a
String value?

Matt


Eric Rank-2 wrote:
> 
> Hi Matt,
> 
> I tried out your scenario, and I think I found the problem. In my  
> test, it also validated when I left the friendEmail field blank. It  
> seems that the value of friendEmail is not null, but an empty string.  
> To solve the problem, I added another clause to check for String  
> length. After that, it triggered the field error as desired. This is  
> what worked for me.
> 
> 
>
>  
>  reason == 'friend' and  
> friendEmail != null and friendEmail.trim().size() > 0
>  Please provide your friend's email
>  
>  
> 
> 
> 
> Eric.
> 
> 
> On Jul 19, 2007, at 10:40 AM, mraible wrote:
> 
>> If you're right, I'd expect the following expression make friendEmail
>> required when the "friend" reason is checked (it's a radio button):
>>
>> reason == 'friend' and friendEmail != null
>>
>> However, if I check friend and don't fill out the e-mail address,  
>> it still
>> passes validation. Based on the error message I'm getting in my  
>> logs (see
>> below), I'm guessing that I need to do some sort of "friendEmail !=  
>> null"
>> check, but I'm already doing that.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11699294
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: Don't expose .action to user?

2007-07-19 Thread mraible

Do you rewrite outgoing URLs as well, or just incoming?


Neil Aggarwal wrote:
> 
> Matt:
> 
> I use URLRewrite.  I only have a few rules since
> urlreqrite supports regex pattern mathing.
> 
> Thanks,
>   Neil 
> 
> --
> Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
> FREE! Eliminate junk email and reclaim your inbox.
> Visit http://www.spammilter.com for details.
> 
> -Original Message-
> From: mraible [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, July 19, 2007 11:32 AM
> To: user@struts.apache.org
> Subject: Re: Don't expose .action to user?
> 
> 
> I agree it would be nice if you could make totally clean URLs with Struts
> 2
> -
> as if you had each action registered as servlets in your web.xml.
> Unfortunately, I don't believe it's possible. The only solution I can
> think
> of is to use the UrlRewriteFilter.
> 
> http://tuckey.org/urlrewrite
> 
> While this solution would work, it'd require duplicating your action paths
> in urlrewrite.xml. I guess the best solution is to write some sort of
> adapter for the UrlRewriteFilter that sweeps your struts.xml and creates
> rules to forward all action names (w/o an extension) to your actions with
> an
> extension. In turn, you'd have to write outgoing rules that strip off the
> extension from URLs.
> 
> If someone has a more elegant solution, I'd love to hear about it.
> 
> Matt
> 
> 
> Chris Pratt wrote:
>> 
>> We had the same concern, so by putting this in the top of our struts.xml:
>> 
>>   
>> 
>> It makes all the actions look like regular old .html requests.
>>   (*Chris*)
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Don%27t-expose-.action-to-user--tf4106649.html#a116921
> 69
> Sent from the Struts - User mailing list archive at Nabble.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/Don%27t-expose-.action-to-user--tf4106649.html#a11693505
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: FieldExpressionValidator: How do I reference field names?

2007-07-19 Thread mraible

If you're right, I'd expect the following expression make friendEmail
required when the "friend" reason is checked (it's a radio button): 

reason == 'friend' and friendEmail != null

However, if I check friend and don't fill out the e-mail address, it still
passes validation. Based on the error message I'm getting in my logs (see
below), I'm guessing that I need to do some sort of "friendEmail != null"
check, but I'm already doing that.

WARN - FieldExpressionValidator.validate(80) | Got result of null when
trying to get Boolean.

Here's my full validation rule:



reason == 'friend' and friendEmail != null
Please provide your friend's email



Thanks,

Matt


Eric Rank-2 wrote:
> 
> At risk of pointing out the obvious, I notice is that your expression  
> validates when:
> 
> 1. reason is "friend"
> 2. and when friendEmail is null
> 
> I'm guessing that you want it to successfully validate when
> 
> 1. reason equals "friend"
> 2. And when friendEmail IS NOT null
> 
> Could that be the problem?
> 
> I only point it out because the backwards logic involved with  
> validators has bitten me in the past. I always have to remind myself  
> that my validators test for things that I want, not for things that  
> will cause failure.
> 
> Eric Rank
> 
> 
> 
> 
> On Jul 18, 2007, at 3:08 PM, mraible wrote:
> 
>>
>> That didn't work - how about this: http://rafb.net/p/cmnEKB18.html
>>
>>
>> mraible wrote:
>>>
>>> Looks like Nabble was escaping my HTML - let's try again with HTML  
>>> Format
>>> checked:
>>>
>>> 
>>> 
>>> true
>>> Reason is required.
>>> 
>>> 
>>>
>>> 
>>> 
>>> friendEmail
>>> reason.equals('friend') and friendEmail == null
>>> Please provide your friend's email
>>> 
>>>
>>> 
>>> 
>>> 
>>> reason.equals('friend') and friendEmail == null
>>> Please provide your friend's email
>>> 
>>> 
>>>
>>>
>>> Musachy Barroso wrote:
>>>>
>>>> I've read this like 10 times just to make sure I'm not missing  
>>>> something,
>>>> but:
>>>>
>>>>  
>>>>friendEmail
>>>>reason.equals('friend') and friendEmail == null
>>>>Please provide your friend's email
>>>>
>>>>
>>>>
>>>> why is "friendEmail" in the expression?(should be "
>>>> reason.equals('friend')
>>>> and friendEmail == null" right?)
>>>>
>>>> musachy
>>>>
>>>> On 7/18/07, mraible <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>>
>>>>> I'm trying to use a FieldExpressionValidator (or  
>>>>> ExpressionValidator) to
>>>>> compare fields. Unfortunately, it doesn't seem to be working. I  
>>>>> have a
>>>>> radio
>>>>> button (named "reason") and a text field named "friendEmail". If  
>>>>> the
>>>>> selected radio has a reason of "friend", I want to require the text
>>>>> field.
>>>>> However, the expression "reason.equals('friend') and friendEmail ==
>>>>> null"
>>>>> doesn't seem to work. Is this expression syntax correct, or do I  
>>>>> have to
>>>>> do
>>>>> something additional to get a handle on the "reason" and  
>>>>> "friendEmail"
>>>>> values?
>>>>>
>>>>> 
>>>>> 
>>>>> true
>>>>> Reason is a required field.
>>>>> 
>>>>> 
>>>>>
>>>>> 
>>>>> friendEmail
>>>>> reason.equals('friend') and friendEmail == null
>>>>> Please provide your friend's email
>>>>> 
>>>>>
>>>>> I've also tried the following, but no dice:
>>>>>
>>>>> 
>>>>>  

Re: Don't expose .action to user?

2007-07-19 Thread mraible

I agree it would be nice if you could make totally clean URLs with Struts 2 -
as if you had each action registered as servlets in your web.xml.
Unfortunately, I don't believe it's possible. The only solution I can think
of is to use the UrlRewriteFilter.

http://tuckey.org/urlrewrite

While this solution would work, it'd require duplicating your action paths
in urlrewrite.xml. I guess the best solution is to write some sort of
adapter for the UrlRewriteFilter that sweeps your struts.xml and creates
rules to forward all action names (w/o an extension) to your actions with an
extension. In turn, you'd have to write outgoing rules that strip off the
extension from URLs.

If someone has a more elegant solution, I'd love to hear about it.

Matt


Chris Pratt wrote:
> 
> We had the same concern, so by putting this in the top of our struts.xml:
> 
>   
> 
> It makes all the actions look like regular old .html requests.
>   (*Chris*)
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Don%27t-expose-.action-to-user--tf4106649.html#a11692169
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: FieldExpressionValidator: How do I reference field names?

2007-07-18 Thread mraible

That didn't work - how about this: http://rafb.net/p/cmnEKB18.html


mraible wrote:
> 
> Looks like Nabble was escaping my HTML - let's try again with HTML Format
> checked:
> 
> 
> 
> true
> Reason is required.
> 
> 
> 
> 
> 
> friendEmail
> reason.equals('friend') and friendEmail == null
> Please provide your friend's email
> 
> 
> 
> 
> 
> reason.equals('friend') and friendEmail == null
> Please provide your friend's email
> 
> 
> 
> 
> Musachy Barroso wrote:
>> 
>> I've read this like 10 times just to make sure I'm not missing something,
>> but:
>> 
>>  
>>friendEmail
>>reason.equals('friend') and friendEmail == null
>>Please provide your friend's email
>>
>> 
>> 
>> why is "friendEmail" in the expression?(should be "
>> reason.equals('friend')
>> and friendEmail == null" right?)
>> 
>> musachy
>> 
>> On 7/18/07, mraible <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>> I'm trying to use a FieldExpressionValidator (or ExpressionValidator) to
>>> compare fields. Unfortunately, it doesn't seem to be working. I have a
>>> radio
>>> button (named "reason") and a text field named "friendEmail". If the
>>> selected radio has a reason of "friend", I want to require the text
>>> field.
>>> However, the expression "reason.equals('friend') and friendEmail ==
>>> null"
>>> doesn't seem to work. Is this expression syntax correct, or do I have to
>>> do
>>> something additional to get a handle on the "reason" and "friendEmail"
>>> values?
>>>
>>> 
>>> 
>>> true
>>> Reason is a required field.
>>> 
>>> 
>>>
>>> 
>>> friendEmail
>>> reason.equals('friend') and friendEmail == null
>>> Please provide your friend's email
>>> 
>>>
>>> I've also tried the following, but no dice:
>>>
>>> 
>>> 
>>> reason.equals('friend')
>>> Please provide your friend's email
>>> 
>>> 
>>>
>>> Thanks,
>>>
>>> Matt
>>> --
>>> View this message in context:
>>> http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11673436
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>> 
>> 
>> -- 
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11677727
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: FieldExpressionValidator: How do I reference field names?

2007-07-18 Thread mraible

Looks like Nabble was escaping my HTML - let's try again with HTML Format
checked:



true
Reason is required.





friendEmail
reason.equals('friend') and friendEmail == null
Please provide your friend's email





reason.equals('friend') and friendEmail == null
Please provide your friend's email




Musachy Barroso wrote:
> 
> I've read this like 10 times just to make sure I'm not missing something,
> but:
> 
>  
>friendEmail
>reason.equals('friend') and friendEmail == null
>Please provide your friend's email
>
> 
> 
> why is "friendEmail" in the expression?(should be "
> reason.equals('friend')
> and friendEmail == null" right?)
> 
> musachy
> 
> On 7/18/07, mraible  wrote:
>>
>>
>> I'm trying to use a FieldExpressionValidator (or ExpressionValidator) to
>> compare fields. Unfortunately, it doesn't seem to be working. I have a
>> radio
>> button (named "reason") and a text field named "friendEmail". If the
>> selected radio has a reason of "friend", I want to require the text
>> field.
>> However, the expression "reason.equals('friend') and friendEmail == null"
>> doesn't seem to work. Is this expression syntax correct, or do I have to
>> do
>> something additional to get a handle on the "reason" and "friendEmail"
>> values?
>>
>> 
>> 
>> true
>> Reason is a required field.
>> 
>> 
>>
>> 
>> friendEmail
>> reason.equals('friend') and friendEmail == null
>> Please provide your friend's email
>> 
>>
>> I've also tried the following, but no dice:
>>
>> 
>> 
>> reason.equals('friend')
>> Please provide your friend's email
>> 
>> 
>>
>> Thanks,
>>
>> Matt
>> --
>> View this message in context:
>> http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11673436
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11677716
Sent from the Struts - User mailing list archive at Nabble.com.


FieldExpressionValidator: How do I reference field names?

2007-07-18 Thread mraible

I'm trying to use a FieldExpressionValidator (or ExpressionValidator) to
compare fields. Unfortunately, it doesn't seem to be working. I have a radio
button (named "reason") and a text field named "friendEmail". If the
selected radio has a reason of "friend", I want to require the text field.
However, the expression "reason.equals('friend') and friendEmail == null"
doesn't seem to work. Is this expression syntax correct, or do I have to do
something additional to get a handle on the "reason" and "friendEmail"
values?



true
Reason is a required field.




friendEmail
reason.equals('friend') and friendEmail == null
Please provide your friend's email


I've also tried the following, but no dice:



reason.equals('friend')
Please provide your friend's email



Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/FieldExpressionValidator%3A-How-do-I-reference-field-names--tf4104715.html#a11673436
Sent from the Struts - User mailing list archive at Nabble.com.


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



How can I tell Struts 2 to throw/log exceptions for invalid OGNL Expressions

2007-07-17 Thread mraible

I have the following class:

public class TestAction {

public static String concat(String str1, String str2) {
return str1 + " and " + str2;
}
}

In a JSP, I can write the following and it works fine:



However, if I change it to an invalid class name, it fails silently:



I've tried turning up the logging for org.apache.struts2,
com.opensymphony.xwork2 and ognl - but it still fails silently. Any ideas
how to get better error messages about invalid OGNL expressions?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/How-can-I-tell-Struts-2-to-throw-log-exceptions-for-invalid-OGNL-Expressions-tf4100102.html#a11659700
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 Menu

2007-06-07 Thread mraible

If you download the example WAR - there's lot of examples in there. You could
also look at AppFuse (http://appfuse.org), which has Struts Menu
pre-integrated.

Matt


Antonio Petrelli-3 wrote:
> 
> 2007/6/5, Archer <[EMAIL PROTECTED]>:
>> Hi All,
>>
>>  I am new to struts menu. Can anybody please help where I can find a good
>> tutorial or suggest me a good place to start work with struts menu.
>> Thanks
>> in advance.
> 
> Probably at Struts Menu website
> 
> http://struts-menu.sourceforge.net/
> 
> Antonio
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-Menu-tf3873449.html#a11009836
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: Flash scope in Struts 2?

2007-06-06 Thread mraible



mraible wrote:
> 
> Does Struts 2 have support for a flash scope - where messages can be
> easily stuffed into this scope so they live through a redirect?
> 
> Thanks,
> 
> Matt
> 

I'll assume the answer is "no".

-- 
View this message in context: 
http://www.nabble.com/Flash-scope-in-Struts-2--tf3685114.html#a10993413
Sent from the Struts - User mailing list archive at Nabble.com.


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



reads wrong key from i18n bundle

2007-06-05 Thread mraible

I have a Company object that's attached to my User object with the following
JPA configuration:

@ManyToOne(cascade = CascadeType.ALL, optional=true)
@JoinColumn(name="company_id")
public Company getCompany() {
return company;
}

In my userForm.jsp, I'm trying to render allow users to edit the company
name with the following textfield:



In my i18n bundle, I have two keys:

company.name=Acme, Inc.

user.company.name=Company Name

For some reason, "Acme, Inc." is getting rendered as the label instead of
"Company Name". As far as I can tell, this is a bug in Struts 2.0.6. Should
I enter an issue for it in JIRA?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/%3Cs%3Atextfield-key%3E-reads-wrong-key-from-i18n-bundle-tf3871460.html#a10968459
Sent from the Struts - User mailing list archive at Nabble.com.


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



Testing error after adding DateConverter

2007-06-04 Thread mraible

I recently added a DateConverter to my project (Struts 2.0.6, Maven 2) and
now I'm getting NPEs when running tests.

xwork-conversion.properties:

java.util.Date=org.appfuse.webapp.action.DateConverter

DateConverter.java:

public class DateConverter extends StrutsTypeConverter {

public Object convertFromString(Map ctx, String[] value, Class arg2) {
if (value[0] == null || value[0].trim().equals("")) {
return null;
}

try {
return DateUtil.convertStringToDate(value[0]);
} catch (ParseException pe) {
pe.printStackTrace();
throw new TypeConversionException(pe.getMessage());
}
}

public String convertToString(Map ctx, Object data) {
return DateUtil.convertDateToString((Date) data);
}
}

My test's setUp() method:

@Override
protected void onSetUpBeforeTransaction() throws Exception {
LocalizedTextUtil.addDefaultResourceBundle(Constants.BUNDLE_KEY);
ActionContext.getContext().setSession(new HashMap());

// change the port on the mailSender so it doesn't conflict with an
// existing SMTP server on localhost
JavaMailSenderImpl mailSender = (JavaMailSenderImpl)
applicationContext.getBean("mailSender");
mailSender.setPort(2525);
mailSender.setHost("localhost");

// populate the request so getRequest().getSession() doesn't fail in
BaseAction.java
ServletActionContext.setRequest(new MockHttpServletRequest());
}

Stack trace:

ERROR [main] XWorkConverter.loadConversionProperties(645) | Conversion
registration error
java.lang.NullPointerException
at
com.opensymphony.xwork2.util.XWorkConverter.createTypeConverter(XWorkConverter.java:621)
at
com.opensymphony.xwork2.util.XWorkConverter.loadConversionProperties(XWorkConverter.java:639)
at
com.opensymphony.xwork2.util.XWorkConverter.(XWorkConverter.java:176)
at
com.opensymphony.xwork2.util.AnnotationXWorkConverter.(AnnotationXWorkConverter.java:98)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at
com.opensymphony.xwork2.util.XWorkConverter.getInstance(XWorkConverter.java:202)
at
com.opensymphony.xwork2.util.XWorkMapPropertyAccessor.(XWorkMapPropertyAccessor.java:30)
at
com.opensymphony.xwork2.util.OgnlValueStack.reset(OgnlValueStack.java:47)
at
com.opensymphony.xwork2.util.OgnlValueStack.(OgnlValueStack.java:37)
at
com.opensymphony.xwork2.util.OgnlValueStackFactory.createValueStack(OgnlValueStackFactory.java:14)
at
com.opensymphony.xwork2.ActionContext$ActionContextThreadLocal.initialValue(ActionContext.java:329)
at
java.lang.ThreadLocal$ThreadLocalMap.getAfterMiss(ThreadLocal.java:374)
at java.lang.ThreadLocal$ThreadLocalMap.get(ThreadLocal.java:347)
at
java.lang.ThreadLocal$ThreadLocalMap.access$000(ThreadLocal.java:225)
at java.lang.ThreadLocal.get(ThreadLocal.java:127)
at
com.opensymphony.xwork2.ActionContext.getContext(ActionContext.java:151)
at
org.appfuse.webapp.action.BaseActionTestCase.onSetUpBeforeTransaction(BaseActionTestCase.java:35)

Is there something I can do to manually register the Converters when testing
(with JUnit 3.8.2)?

Thanks,

Matt 
-- 
View this message in context: 
http://www.nabble.com/Testing-error-after-adding-DateConverter-tf3868021.html#a10958599
Sent from the Struts - User mailing list archive at Nabble.com.


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



[s2] Can't get to work

2007-05-24 Thread mraible

I'm trying to get  to work in AppFuse. I'm using Struts 2.0.6.
When I add the code below to a JSP, I get a 404 (via Firebug) for the
following files:

http://localhost:8080/struts/dojo/src/i18n/calendar/nls/en-us/gregorian.js
http://localhost:8080/struts/dojo/src/i18n/calendar/nls/en/gregorianExtras.js
http://localhost:8080/struts/dojo/src/i18n/calendar/nls/en-us/gregorianExtras.js

Here's the code for my JSP:

<%@ include file="/common/taglibs.jsp"%>



 My page



  
   Div 1
   
  
  

  
   



Any ideas?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/-s2--Can%27t-get-%3Cs%3Adatepicker%3E-to-work-tf3814068.html#a10796668
Sent from the Struts - User mailing list archive at Nabble.com.


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



Flash scope in Struts 2?

2007-05-03 Thread mraible

Does Struts 2 have support for a flash scope - where messages can be easily
stuffed into this scope so they live through a redirect?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Flash-scope-in-Struts-2--tf3685114.html#a10300567
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: Using doesn't seem to work

2007-04-03 Thread mraible

I've discovered some more information on this:

If I have theme="simple" on my  the labels aren't rendered. Changing
it to theme="xhtml" makes it show up, but causes duplicate 

E-Mail
address

I've deleted all my freemarker customizations insrc/main/webapp/template,
but it still seems to happen.  This is quite strange since class="desc"
shows up on my label.  This is a customization I had in my xhtml template -
does Struts have the same customization?

Thanks,

Matt


mraible wrote:
> 
> Any idea why  does not work for me with Struts 2.0.6?
> 
> 
> 
> The following works fine:
> 
> 
> 
> As does:
> 
> 
> 
> Is the "key" attribute of  supposed to write the body?  It seems
> to write the label tag just fine, but it has no body.
> 
> Thanks,
> 
> Matt
> 

-- 
View this message in context: 
http://www.nabble.com/Using-%3Cs%3Alabel-key%3D%22%22-%3E-doesn%27t-seem-to-work-tf3521861.html#a9825650
Sent from the Struts - User mailing list archive at Nabble.com.


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



Using doesn't seem to work

2007-04-03 Thread mraible

Any idea why  does not work for me with Struts 2.0.6?



The following works fine:



As does:



Is the "key" attribute of  supposed to write the body?  It seems to
write the label tag just fine, but it has no body.

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Using-%3Cs%3Alabel-key%3D%22%22-%3E-doesn%27t-seem-to-work-tf3521861.html#a9824656
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: Global messages.jsp file included in a SiteMesh decorator

2007-03-14 Thread mraible



Guillaume Carré wrote:
> 
> 2007/3/14, mraible <[EMAIL PROTECTED]>:
>> What if you use  foo  - does that
>> work
>> for you as well?
> 
> yes it does work as well, as advertized.
> 
> And if I remove the ActionContextCleanUp filter, it doesn't work
> anymore, I have the following exception:
> 
> java.lang.NullPointerException
>   at
> org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:50)
>   at
> org.apache.jsp.decorators.main_jsp._jspx_meth_ww_property_0(main_jsp.java:420)
> 
> I'm using Tomcat 5.5.17.
> 

What if you remove the  for Struts' filter in your web.xml? 
I have a staticFilter in my application that forwards to static resources
and doesn't hit the Struts FilterDispatcher when one is found.  Maybe that's
causing my problem?

Matt
-- 
View this message in context: 
http://www.nabble.com/Global-messages.jsp-file-included-in-a-SiteMesh-decorator-tf3400265.html#a9478424
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: Global messages.jsp file included in a SiteMesh decorator

2007-03-14 Thread mraible



Guillaume Carré wrote:
> 
> 2007/3/14, mraible <[EMAIL PROTECTED]>:
>> That's the problem, I *do* have the ActionContextCleanUp filter in my
>> web.xml:
> 
> It's working here for me, I've included a test.jsp in my sitemesh
> decorator with a  in it, and it's able to
> access the test object from the value stack.
> 
> But I still have my JSTL problem without the ActionContextCleanUp
> filter, even when I'm not in a sitemesh decorator...
> -- 
> Guillaume Carré
> 

What if you use  foo  - does that work
for you as well?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Global-messages.jsp-file-included-in-a-SiteMesh-decorator-tf3400265.html#a9477819
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: Global messages.jsp file included in a SiteMesh decorator

2007-03-14 Thread mraible



Guillaume Carré wrote:
> 
> 2007/3/14, mraible <[EMAIL PROTECTED]>:
>>
>> I have a messages.jsp[1] that's included (using <%@ include
>> file="/common/messages.jsp" %>) in my default decorator. This file has a
>> couple of calls to the valueStack - namely hasActionErrors() and
>> hasFieldErrors().  This worked fine in WebWork 2.1.x and Struts 2.0.1 -
>> even
>> when pages where rendered that didn't go through Struts.  However,
>> starting
>> with the 2.0.6 release, the  tag throws a NPE because the
>> ValueStack
>> isn't in the request.  I believe it's a bug, but wanted to check with
>> this
>> list first to confirm.
>>
>> Thanks,
>>
>> Matt
>>
>> [1] messages.jsp:
>>
>> <% if (request.getAttribute("struts.valueStack") != null) { %>
>> 
>> 
>>   
>>  " class="icon" />
>> 
>>   
>>
>> 
>>
>> 
>> 
>>   
>>   
>>  " class="icon" />
>>  
>>   
>>   
>>
>> 
>> <% } %>
>>
>> <%-- Success Messages --%>
>> 
>> 
>> 
>>  " class="icon"
>> />
>> 
>> 
>> 
>> 
>> 
> 
> You have to add the ActionContextCleanUp filter to your web
> application if you wan't to be able to access the value stack from a
> sitemesh decorator:
> http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/dispatcher/ActionContextCleanUp.html
> 
> On the same subject, I have opened an issue in JIRA. Without this
> filter, I can't access the value stack from JSTL on any JSP page (not
> a sitemesh decorator page):
> https://issues.apache.org/struts/browse/WW-1798
> Do you confirm this?
> -- 
> Guillaume Carré
> 

That's the problem, I *do* have the ActionContextCleanUp filter in my
web.xml:


struts-cleanup
/*
REQUEST
FORWARD


themeFilter
/*
REQUEST
FORWARD


sitemesh
/*


staticFilter
/*
REQUEST
FORWARD


struts
/*


Matt
-- 
View this message in context: 
http://www.nabble.com/Global-messages.jsp-file-included-in-a-SiteMesh-decorator-tf3400265.html#a9477319
Sent from the Struts - User mailing list archive at Nabble.com.


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



Global messages.jsp file included in a SiteMesh decorator

2007-03-13 Thread mraible

I have a messages.jsp[1] that's included (using <%@ include
file="/common/messages.jsp" %>) in my default decorator. This file has a
couple of calls to the valueStack - namely hasActionErrors() and
hasFieldErrors().  This worked fine in WebWork 2.1.x and Struts 2.0.1 - even
when pages where rendered that didn't go through Struts.  However, starting
with the 2.0.6 release, the  tag throws a NPE because the ValueStack
isn't in the request.  I believe it's a bug, but wanted to check with this
list first to confirm.

Thanks,

Matt

[1] messages.jsp:

<% if (request.getAttribute("struts.valueStack") != null) { %>


  
 " class="icon" />

  
   




  
  
 " class="icon" />
 
  
  
   

<% } %>

<%-- Success Messages --%>



 " class="icon" />






-- 
View this message in context: 
http://www.nabble.com/Global-messages.jsp-file-included-in-a-SiteMesh-decorator-tf3400265.html#a9468706
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] Is it possible to get Struts' FilterDispatcher to serve up static files

2007-02-27 Thread mraible

I came up with a StaticFilter (from http://issues.appfuse.org/browse/APF-431)
that seems to work (see code below).  However, it causes another issue for
me. In my SiteMesh decorator, I'm including a messages.jsp that has calls to
the valueStack:

<%-- ActionError Messages - usually set in Actions --%>


  
 " class="icon" />

  
   


<%-- FieldError Messages - usually set by validation rules --%>


  
  
 " class="icon" />
 
  
  
   


When I return a static page, this JSP causes issue:

java.lang.NullPointerException
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)

This works fine when I request a Struts Action.  Is there any way to check
for the stack in my messages.jsp?

Thanks,

Matt


public class StaticFilter extends OncePerRequestFilter {
private final static String DEFAULT_INCLUDES = "*.html";
private final static String DEFAULT_EXCLUDES = "";
private String[] excludes;
private String[] includes;
public static final String INCLUDES_PARAMETER = "includes";
public static final String EXCLUDES_PARAMETER = "excludes";

/**
 * Read the includes/excludes paramters and set the filter accordingly.
 */
public void initFilterBean() {
String includesParam =
getFilterConfig().getInitParameter(INCLUDES_PARAMETER);
if (StringUtils.isEmpty(includesParam)) {
includes = parsePatterns(DEFAULT_INCLUDES);
} else {
includes = parsePatterns(includesParam);
}

String excludesParam =
getFilterConfig().getInitParameter(EXCLUDES_PARAMETER);
if (StringUtils.isEmpty(excludesParam)) {
excludes = parsePatterns(DEFAULT_EXCLUDES);
} else {
excludes = parsePatterns(excludesParam);
}
}

private String[] parsePatterns(String delimitedPatterns) {
//make sure no patterns are repeated.
Set patternSet =
org.springframework.util.StringUtils.commaDelimitedListToSet(delimitedPatterns);
String[] patterns = new String[patternSet.size()];
int i = 0;
for (Iterator iterator = patternSet.iterator(); iterator.hasNext();
i++) {
//no trailing/leading white space.
String pattern = (String) iterator.next();
patterns[i] = pattern.trim();
}
return patterns;
}

public void doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
 FilterChain chain) throws IOException,
ServletException {

UrlPathHelper urlPathHelper = new UrlPathHelper();
String path = urlPathHelper.getPathWithinApplication(request);
boolean pathExcluded = PatternMatchUtils.simpleMatch(excludes,
path);
boolean pathIncluded = PatternMatchUtils.simpleMatch(includes,
path);

if (pathIncluded && !pathExcluded) {
RequestDispatcher rd =
getServletContext().getRequestDispatcher(path);
rd.forward(request, response);
}

chain.doFilter(request, response);
}
}


Stuart Piltch wrote:
> 
> mraible  raibledesigns.com> writes:
>> I'm using *.html as my default extension, which causes a whole host of
>> issues
>> with Dojo.  Regardless, I want to fight through it and see if I can come
>> up
>> with a solution.
> 
> Hi Matt,
> 
> I'm not sure about your specific FilterDispatcher question, but we also
> use
> *.html as a default extension. We ended up copying all the dojo html files
> that
> we use into out own /WEB-INF/widgets directory and adding an extra
> struts-dojo.xml file to our config:
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd";>
> 
> 
>  extends="base">
> 
> /WEB-INF/widgets/{1}.html
> 
> 
>  namespace="/struts/dojo/src/widget/templates/Editor2" extends="base">
> 
>  type="plainhtml">/WEB-INF/widgets/Editor2/{1}.html
> 
> 
>  namespace="/struts/dojo/src/widget/templates/Editor2/Dialog"
> extends="base">
> 
>  type="plainhtml">/WEB-INF/widgets/Editor2/Dialog/{1}.html
> 
> 
> 
> 
> It seems convoluted, but it's working. The other dojo files (css, js, etc)
> are
> working fine from within the struts jar.
> 
> Cheers,
> 
>  - stuart
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-get-Struts%27-FilterDispatcher-to-serve-up-static-files-tf3304172.html#a9196270
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] Is it possible to get Struts' FilterDispatcher to serve up static files

2007-02-27 Thread mraible

Right, it can serve up static content from the classpath, but I want to do it
from the webapp.

Matt


Musachy Barroso wrote:
> 
> Quoting the doc: "
> 
> Common static content that is needed by the framework (JavaScript and CSS
> files, etc.) is served automatically by the FilterDispatcher filter. Any
> request starting with "/struts/" denotes that static content is required,
> and then mapping the value after "/struts/" to common packages in Struts 2
> and, optionally in the application's class path.
> 
> By default, the following packages are searched:
> 
>- org.apache.struts2.static
>- template
> 
> Additional packages can be specified by providing a comma separated list
> to
> the configuration parameter named "packages" (configured in web.xml for
> the
> FilterDispatcher filter). When specifying additional static content, you
> should be careful not to expose sensitive configuration information (i.e.
> database password)."
> //I haven't used it myself :)
> musachy
> 
> On 2/27/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>>
>> I'm using *.html as my default extension, which causes a whole host of
>> issues
>> with Dojo.  Regardless, I want to fight through it and see if I can come
>> up
>> with a solution.
>>
>> I noticed that FilterDispatcher allows you to serve up static files from
>> the
>> classpath.  Is it possible to configure this same filter so it can serve
>> up
>> static .html files from a "static" directory in my webapp root?
>>
>> Thanks,
>>
>> Matt
>> --
>> View this message in context:
>> http://www.nabble.com/Is-it-possible-to-get-Struts%27-FilterDispatcher-to-serve-up-static-files-tf3304172.html#a9191128
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-get-Struts%27-FilterDispatcher-to-serve-up-static-files-tf3304172.html#a9191703
Sent from the Struts - User mailing list archive at Nabble.com.


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



Is it possible to get Struts' FilterDispatcher to serve up static files

2007-02-27 Thread mraible

I'm using *.html as my default extension, which causes a whole host of issues
with Dojo.  Regardless, I want to fight through it and see if I can come up
with a solution.

I noticed that FilterDispatcher allows you to serve up static files from the
classpath.  Is it possible to configure this same filter so it can serve up
static .html files from a "static" directory in my webapp root?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-get-Struts%27-FilterDispatcher-to-serve-up-static-files-tf3304172.html#a9191128
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] Issues running Struts 2.0.6 on Resin 3.0.21

2007-02-21 Thread mraible

This issue turned out to be a bug in Spring's RequestContextLoader and will
be fixed in Spring 2.0.3:

http://forum.springframework.org/showthread.php?t=33874

Matt


mraible wrote:
> 
> I get the following error when I try to deploy a Struts 2.0.6 application
> on Resin 3.0.21:
> 
> java.lang.NullPointerException
>   at
> org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:50)
>   at _jsp._error__jsp._jspService(common/messages.jsp:2)
> 
> From this, it looks like messages.jsp is causing the problem.  In that
> file, I have:
> 
> <%-- ActionError Messages - usually set in Actions --%>
> 
> 
>   
>  " class="icon" />
> 
>   
>
> 
> 
> <%-- FieldError Messages - usually set by validation rules --%>
> 
> 
>   
>   
>  " class="icon" />
>  
>   
>   
>
> 
> 
> <%-- Success Messages --%>
> 
> 
> 
>  " class="icon"
> />
> 
> 
> 
> 
> 
> 
> If I delete the contents of this file, I get:
> 
> [09:31:25.218] Compiling _jsp/_error__jsp.java
> [09:31:25.791] java.lang.NullPointerException
> [09:31:25.791]  at
> org.springframework.web.context.request.RequestContextListener.requestDestroyed(RequestContextListener.java:67)
> 
> If I remove RequestContextListener from my web.xml, everything works
> great.  This same application deploys and works fine on Tomcat.  Any
> ideas?  My guess is there's something in messages.jsp that I need to fix.
> 
> Thanks,
> 
> Matt
> 

-- 
View this message in context: 
http://www.nabble.com/Issues-running-Struts-2.0.6-on-Resin-3.0.21-tf3267060.html#a9094100
Sent from the Struts - User mailing list archive at Nabble.com.


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



Issues running Struts 2.0.6 on Resin 3.0.21

2007-02-21 Thread mraible

I get the following error when I try to deploy a Struts 2.0.6 application on
Resin 3.0.21:

java.lang.NullPointerException
at
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:50)
at _jsp._error__jsp._jspService(common/messages.jsp:2)

>From this, it looks like messages.jsp is causing the problem.  In that file,
I have:

<%-- ActionError Messages - usually set in Actions --%>


  
 " class="icon" />

  
   


<%-- FieldError Messages - usually set by validation rules --%>


  
  
 " class="icon" />
 
  
  
   


<%-- Success Messages --%>



 " class="icon" />






If I delete the contents of this file, I get:

[09:31:25.218] Compiling _jsp/_error__jsp.java
[09:31:25.791] java.lang.NullPointerException
[09:31:25.791]  at
org.springframework.web.context.request.RequestContextListener.requestDestroyed(RequestContextListener.java:67)

If I remove RequestContextListener from my web.xml, everything works great. 
This same application deploys and works fine on Tomcat.  Any ideas?  My
guess is there's something in messages.jsp that I need to fix.

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/Issues-running-Struts-2.0.6-on-Resin-3.0.21-tf3267060.html#a9081864
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] Simplifying the interceptor stack

2007-02-08 Thread mraible

I'm working to simplify the stack that I used to use in a WebWork
application.  Here's what I currently have:


















cancel,execute,delete,edit,list,start


input,back,cancel




Is there an easier way to override the validation and workflow methods? 
Someone recently pointed out that I don't have the checkbox interceptor in
my stack (which didn't exist in WW).

Is it possible to remove everything but the validation and workflow
interceptors?

Also, are there any performance reasons to have separate stacks for display
only (list) screens vs. forms (crud)?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/-struts-2--Simplifying-the-interceptor-stack-tf3196039.html#a8874246
Sent from the Struts - User mailing list archive at Nabble.com.


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



How do I configure wildcard action definitions in Struts 2.x?

2007-01-23 Thread mraible

I can't seem to find any documentation on configuring wildcard actions in
Struts 2.x.  Does this feature still exist?

Thanks,

Matt
-- 
View this message in context: 
http://www.nabble.com/How-do-I-configure-wildcard-action-definitions-in-Struts-2.x--tf3077950.html#a8551509
Sent from the Struts - User mailing list archive at Nabble.com.


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