You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "K.C. Baltz" <kc...@firefox.co.uk> on 2005/03/01 18:53:20 UTC

Is there a way to auto-trim String properties in DynaForms?

I'm reposting this in the hopes that there is an answer out there.

> It would be really nice if I could programmatically indicate that 
> certain fields in a DynaForm should be automatically trimmed of 
> whitespace.  Is there a way to do this?
> Alternatively, is there a way to get the behavior of the "required" 
> validation when using validwhen?  "required" doesn't accept values 
> that are nothing but whitespace whereas there's no way to test for 
> this when using validwhen.

K.C. Baltz

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


Re: Struts and EJB integration question?

Posted by Erik Weber <er...@mindspring.com>.
Well that's a good point. I was using a looser definition of "facade".

Erik


N G wrote:

>On Thu, 03 Mar 2005 12:03:27 -0500, Erik Weber <er...@mindspring.com> wrote:
>  
>
>>Well, a facade is supposed to be a black box, so you shouldn't have to,
>>for example, do an EJB lookup, to use the facade. It's supposed to be
>>easily accessible from any implementations of the next higher layer (in
>>other words, it makes stuff pluggable).
>>    
>>
>
>Actually, I think you are thinking about a Business Delegate pattern,
>not Facade. Usually, a Stateless Session Bean serves as you Facade and
>you would definitely have to do an EJB lookup on that.
>
>Bisiness Delegate, on the other hand, can hide what type of business
>objects you are using, so *it* would be the place to do the lookup or
>call your ServiceLocator class to do the lookup for you.
>
>NG
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

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


Re: Struts and EJB integration question?

Posted by N G <ni...@gmail.com>.
On Thu, 03 Mar 2005 12:03:27 -0500, Erik Weber <er...@mindspring.com> wrote:
> Well, a facade is supposed to be a black box, so you shouldn't have to,
> for example, do an EJB lookup, to use the facade. It's supposed to be
> easily accessible from any implementations of the next higher layer (in
> other words, it makes stuff pluggable).

Actually, I think you are thinking about a Business Delegate pattern,
not Facade. Usually, a Stateless Session Bean serves as you Facade and
you would definitely have to do an EJB lookup on that.

Bisiness Delegate, on the other hand, can hide what type of business
objects you are using, so *it* would be the place to do the lookup or
call your ServiceLocator class to do the lookup for you.

NG

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


Re: Struts and EJB integration question?

Posted by Erik Weber <er...@mindspring.com>.
leonnewsgroup wrote:

>Thanks for your reply.
>It is better to use a delegate or a manage layer than use a Struts
>Action class. And I want to make sure that when I implement the delegate or
>manage layer, I shouldn't use J2EE instead of POJO, it is correct?
>
>Tim
>  
>

Well, a facade is supposed to be a black box, so you shouldn't have to, 
for example, do an EJB lookup, to use the facade. It's supposed to be 
easily accessible from any implementations of the next higher layer (in 
other words, it makes stuff pluggable).

By the way, I would also like to say that adding layers and decoupling, 
a widely used and useful technique, doesn't always work or make sense. 
Rick Reumann was arguing not that long ago on another thread that 
sometimes trying to get HTTP knowledge out of web app components is more 
trouble than it's worth. Well, in similar vein, I have had success 
building a (graphical) interface basically right on top of a network 
protocol (I'm not speaking of HTTP in this case though). Sometimes an 
event-driven interface (dialogs that react to packet arrivals) is just 
the easiest and fastest way to go. I still think you should exercise 
your brain (what happens when I do/don't want EJB here anymore, what 
happens when I introduce a different type of interface, what happens 
when I change persistence techniques, what happens when I change from a 
stateless to a stateful protocol, what happens when I switch from Struts 
to Webwork  >:o , etc.), but I avoid adding abstractions until 
prototyping/whiteboarding fleshes out the need for them. Always Be 
Prototyping! You'll always have a working version of your app that way, 
and your best design will actually come from having tried all the 
runners-up, rather than just your imagination.

Erik


>----- Original Message ----- 
>From: "Erik Weber" <er...@mindspring.com>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Sent: Tuesday, March 01, 2005 5:03 PM
>Subject: Re: Struts and EJB integration question?
>
>
>  
>
>>I think it depends on your service locator design and API. The goals are
>>ease of maintenance, reusability/decoupling and performance. Is the
>>extra layer going to facilitate reuse of your service locator/EJBs? If
>>so then it's probably worth it because it probably won't cost much in
>>terms of maintenance and performance (depends on your infrastructure of
>>course). Might you have other services that don't require the service
>>locator API or a different service locator API? If that's the case,
>>again, you'd probably want to have Struts talk to a "manager layer"
>>component (or as Robert Taylor suggests -- an app-specific delegate
>>right in front of the manager layer component), and let this component
>>find and use services directly, etc. This shields Struts from disparate
>>APIs.
>>
>>Erik
>>
>>
>>leonnewsgroup wrote:
>>
>>    
>>
>>>Hi there,
>>>
>>>I am building a Struts based application with EJB model. I want to know
>>>      
>>>
>the
>  
>
>>>strategy of find and call the EJBs in model layer. My model layer is
>>>implemented by a stateless or stateful session bean that accesses to
>>>      
>>>
>entity
>  
>
>>>beans. and there is a service locator object to find the session beans.
>>>      
>>>
>My
>  
>
>>>questions are where to put the code to use the service loactor to find
>>>      
>>>
>the
>  
>
>>>session beans? is it in the Struts Action classes or another delegate
>>>      
>>>
>class?
>  
>
>>>Thanks.
>>>
>>>Tim
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

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


Re: Struts and EJB integration question?

Posted by leonnewsgroup <le...@hotmail.com>.
Thanks for your reply.
It is better to use a delegate or a manage layer than use a Struts
Action class. And I want to make sure that when I implement the delegate or
manage layer, I shouldn't use J2EE instead of POJO, it is correct?

Tim

----- Original Message ----- 
From: "Erik Weber" <er...@mindspring.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, March 01, 2005 5:03 PM
Subject: Re: Struts and EJB integration question?


> I think it depends on your service locator design and API. The goals are
> ease of maintenance, reusability/decoupling and performance. Is the
> extra layer going to facilitate reuse of your service locator/EJBs? If
> so then it's probably worth it because it probably won't cost much in
> terms of maintenance and performance (depends on your infrastructure of
> course). Might you have other services that don't require the service
> locator API or a different service locator API? If that's the case,
> again, you'd probably want to have Struts talk to a "manager layer"
> component (or as Robert Taylor suggests -- an app-specific delegate
> right in front of the manager layer component), and let this component
> find and use services directly, etc. This shields Struts from disparate
> APIs.
>
> Erik
>
>
> leonnewsgroup wrote:
>
> >Hi there,
> >
> >I am building a Struts based application with EJB model. I want to know
the
> >strategy of find and call the EJBs in model layer. My model layer is
> >implemented by a stateless or stateful session bean that accesses to
entity
> >beans. and there is a service locator object to find the session beans.
My
> >questions are where to put the code to use the service loactor to find
the
> >session beans? is it in the Struts Action classes or another delegate
class?
> >Thanks.
> >
> >Tim
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Struts and EJB integration question?

Posted by Erik Weber <er...@mindspring.com>.
I think it depends on your service locator design and API. The goals are 
ease of maintenance, reusability/decoupling and performance. Is the 
extra layer going to facilitate reuse of your service locator/EJBs? If 
so then it's probably worth it because it probably won't cost much in 
terms of maintenance and performance (depends on your infrastructure of 
course). Might you have other services that don't require the service 
locator API or a different service locator API? If that's the case, 
again, you'd probably want to have Struts talk to a "manager layer" 
component (or as Robert Taylor suggests -- an app-specific delegate 
right in front of the manager layer component), and let this component 
find and use services directly, etc. This shields Struts from disparate 
APIs.

Erik


leonnewsgroup wrote:

>Hi there,
>
>I am building a Struts based application with EJB model. I want to know the
>strategy of find and call the EJBs in model layer. My model layer is
>implemented by a stateless or stateful session bean that accesses to entity
>beans. and there is a service locator object to find the session beans. My
>questions are where to put the code to use the service loactor to find the
>session beans? is it in the Struts Action classes or another delegate class?
>Thanks.
>
>Tim
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

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


RE: Struts and EJB integration question?

Posted by Günther Wieser <gw...@creative-it.com>.
i for one suggest to put it in a delegate class (maybe something with
"static" methods), something you would call a service, that gives you access
to your ejb stuff.
putting it directly into the action class is not recommended, the action
class should be seen as the "connection" between your business layer and the
view, so it should ust delegate, not process anything.

as mentioned, this is my private opinion and i'm sure there are may
different opinions out there....

kr,
guenther

-----Original Message-----
From: leonnewsgroup [mailto:leonnewsgroup@hotmail.com] 
Sent: Tuesday, March 01, 2005 10:40 PM
To: Struts Users Mailing List
Subject: Struts and EJB integration question?

Hi there,

I am building a Struts based application with EJB model. I want to know the
strategy of find and call the EJBs in model layer. My model layer is
implemented by a stateless or stateful session bean that accesses to entity
beans. and there is a service locator object to find the session beans. My
questions are where to put the code to use the service loactor to find the
session beans? is it in the Struts Action classes or another delegate class?
Thanks.

Tim

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




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


Struts and EJB integration question?

Posted by leonnewsgroup <le...@hotmail.com>.
Hi there,

I am building a Struts based application with EJB model. I want to know the
strategy of find and call the EJBs in model layer. My model layer is
implemented by a stateless or stateful session bean that accesses to entity
beans. and there is a service locator object to find the session beans. My
questions are where to put the code to use the service loactor to find the
session beans? is it in the Struts Action classes or another delegate class?
Thanks.

Tim

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