Re: implementaiton advise on custom TextProvider

2012-10-16 Thread Lukasz Lenart
2012/10/15 Davis, Chad :
> I'm not sure I follow you.  Just for clarity, let me restate my problem.  I 
> have written a custom extension of TextProviderSupport.  I want to have it
> injected as the framework's default TextProvider.  I have achieved this by 
> configuring it in struts.xml, declaring my implementation with a  
> element and then setting the constant struts.xworkTextProvider to point at my 
> bean.
>
> This works, but my implementation needs to be properly injected.  Right now, 
> it's being created with the default no-arg constructor.  How can I best have 
> my dependencies injected when the framework creates this bean?  What are my 
> options?
>
> I restate this because it seems that you are suggesting that I override the 
> ActionSupport base class inorder to achieve this.  This seems to me to be 
> skipping the framework and simply creating and injecting my textprovider 
> myself.  Perhaps I misunderstand.

You can use framework's internal DI mechanism, just define constants
and beans and use @Inject. Overriding or redefining base ActionSupport
class is the best approach for each application. ActionSupport can
support simple and common cases.

Maybe in other way. ValueStack (the root of all expression evaluation)
search values from top, thus means if an action is on top (and in many
cases it is) it will be taken first for evaluation. The same works for
TextProvider - take a look on ActionSupport, it implements
TextProvider interface as well. So if you don't care about supporting
framework internal messages, you can implement your own base action
class which will implement TextProvider interface and it can be
created by Spring, Guice and you can inject whatever you need ;-)


Regards

-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: implementaiton advise on custom TextProvider

2012-10-16 Thread Lukasz Lenart
2012/10/16 Davis, Chad :
>>
>> Okay.  I'm following this path.  I've got the Spring Plugin in place.  And 
>> it's
>> working.  I verified it by autowiring a trivial spring bean into one of my
>> actions.  But when I try to create my custom textprovider and then have it
>> used as the framework default text provider I'm getting some initialization
>> problems.  Here's what I'm doing:
>>
>> 1) spring config
>>
>>   > class="com.mycompany.textsupport.MyTextProviderSupport"/>
>>
>> 2) struts.xml
>>
>>   > name="myTextProvider" class="customTextProvider" scope="default" />
>>  
>>
>> But when I start the app I get the following error, thrown when the
>> framework tries to create the text provider bean.  It seems like the
>> framework isn't recognizing that I'm referencing a spring bean with the class
>> attribute . . .
>>
>
> So, I have figured this out.  The TextProvider is injected outside the 
> control of the core objectfactory.  If you look at the ActionSupport class, 
> you'll see that there is a lazy init method for acquiring the textprovider.  
> It uses the default ContainerImpl, as injected ( by type I think ) into the 
> action, to inject the textprovider.  This means that it goes around the 
> spring object factory for this injection.
>
> Not sure what to do.  Several workarounds come to mind.

Good point, could you register an issue for that ?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



RE: implementaiton advise on custom TextProvider

2012-10-16 Thread Davis, Chad


> Spring MVC might be a consideration! (wink) On Oct 16, 2012 1:26 PM,

I heard it has a pretty good integration with the whole Spring ecosystem.

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



RE: implementaiton advise on custom TextProvider

2012-10-16 Thread stanlick
Spring MVC might be a consideration! (wink)
On Oct 16, 2012 1:26 PM, "Davis, Chad"  wrote:

> >
> > Okay.  I'm following this path.  I've got the Spring Plugin in place.
>  And it's
> > working.  I verified it by autowiring a trivial spring bean into one of
> my
> > actions.  But when I try to create my custom textprovider and then have
> it
> > used as the framework default text provider I'm getting some
> initialization
> > problems.  Here's what I'm doing:
> >
> > 1) spring config
> >
> >> class="com.mycompany.textsupport.MyTextProviderSupport"/>
> >
> > 2) struts.xml
> >
> >> name="myTextProvider" class="customTextProvider" scope="default" />
> >   value="myTextProvider"/>
> >
> > But when I start the app I get the following error, thrown when the
> > framework tries to create the text provider bean.  It seems like the
> > framework isn't recognizing that I'm referencing a spring bean with the
> class
> > attribute . . .
> >
>
> So, I have figured this out.  The TextProvider is injected outside the
> control of the core objectfactory.  If you look at the ActionSupport class,
> you'll see that there is a lazy init method for acquiring the textprovider.
>  It uses the default ContainerImpl, as injected ( by type I think ) into
> the action, to inject the textprovider.  This means that it goes around the
> spring object factory for this injection.
>
> Not sure what to do.  Several workarounds come to mind.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Help with sj:autocompleter

2012-10-16 Thread ajac2010-forw...@yahoo.de
Hi all,

i'd like to use the autocompleter as textfield to load a list of database 
objects when typing some characters. Everything's working fine (action 
roundtrips after 3 characters) except refreshing the list of the autocompleter. 
The list is still empty after setting the property in the Struts action class.

I guess i need some kind of javascript event to refresh the list - but i 
haven't found the correct property yet. Can anybody help?

 JSP 

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


           
           



 Action class 

    public String searchTennisStrings() throws Exception {


        // database call to look for tennis strings
        this.stringList = stringingService.findTennisStringsByName(this.term);

        return SUCCESS;
    }



Thanks 

André


RE: implementaiton advise on custom TextProvider

2012-10-16 Thread Davis, Chad
> 
> Okay.  I'm following this path.  I've got the Spring Plugin in place.  And 
> it's
> working.  I verified it by autowiring a trivial spring bean into one of my
> actions.  But when I try to create my custom textprovider and then have it
> used as the framework default text provider I'm getting some initialization
> problems.  Here's what I'm doing:
> 
> 1) spring config
> 
>class="com.mycompany.textsupport.MyTextProviderSupport"/>
> 
> 2) struts.xml
> 
>name="myTextProvider" class="customTextProvider" scope="default" />
>  
> 
> But when I start the app I get the following error, thrown when the
> framework tries to create the text provider bean.  It seems like the
> framework isn't recognizing that I'm referencing a spring bean with the class
> attribute . . .
> 

So, I have figured this out.  The TextProvider is injected outside the control 
of the core objectfactory.  If you look at the ActionSupport class, you'll see 
that there is a lazy init method for acquiring the textprovider.  It uses the 
default ContainerImpl, as injected ( by type I think ) into the action, to 
inject the textprovider.  This means that it goes around the spring object 
factory for this injection.  

Not sure what to do.  Several workarounds come to mind.

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



RE: implementaiton advise on custom TextProvider

2012-10-16 Thread Davis, Chad

> Do you have the:
> 
>   
> 
> constant defined in your struts.xml?  That should be all that's needed.
>   (*Chris*)

I don't but . . . isn't that in the plugin.xml?  And isn't the fact that I was 
able to autowire an action with a spring bean proof that the spring object 
factory is being used as the core factory?

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



Apache rewrite/reverse proxy

2012-10-16 Thread Wes Wannemacher
> Hello Listers,
>
> I have back end website running on Tomcat using struts with the following url
> http://local.domain.com/app. External user access the website through apache  
> proxy with
> the following url http://www.domain.com/user1 (user1, user2, etc... It’s uri 
> specific to each
> user). I want to use apache  rewrite or/ and reverse proxy  directive to 
> translate the url like
> http://www.domain.com/user1 into http://local.domain.com/app?user=user1
> Can some apache guru help me please?
>
> Thanks,
>
> Abdel

In your setup, is http://local.domain.com/app accessible to the users?
There may not be any need for reverse proxying, it may simply be a
matter for mod_rewrite...

-Wes
--
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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