Re: Mapping Struts controller servlet to webapp root: trouble

2003-08-14 Thread Paul Yunusov
On August 13, 2003 11:03 am, Bailey, Shane C. wrote:
> If I remember correctly, from looking at the source code, Struts determines
> what extension (or prefix) to add to the request. If /* is used I could see
> how it could screw things up.  You don't want images and things like that
> going through Struts anyway, I wouldn't think.
>
> Why do you want to do /* (at least for Struts URL pattern)?

Thanks, I see how the way Struts parses URLs could confuse it. I want to map 
Struts to the webapp's root because my webapp doesn't contain any static 
content and I want to limit all requests to Struts-defined actions.

Can anyone confirm Struts does not support "/*" mapping for its controller 
servlet?

Thank you,

Paul



>
>
> -Original Message-
> From: Paul Yunusov [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 13, 2003 11:05 AM
> To: [EMAIL PROTECTED]
> Subject: Mapping Struts controller servlet to webapp root: trouble
>
> I was wondering if anyone has heard of issues arising when the contoller is
> mapped to a webapp's root.
>
> I am talking about this:
>
> 
>   action
>   /*
> 
>
> where "action" is the Struts controller.
>
> Struts seems to return a 400 error with such mapping when it tries to make
> a
>
> forward from an Action instance saying that "the request was syntactically
> incorrect".
>
> /struts/* or *.do are
> commong but I was wondering about the "/*" mapping. Anyone heard of any
> issues with this?
> Thanks,
>
> Paul
>
>
> -
> 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]


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



Re: Mapping Struts controller servlet to webapp root: trouble

2003-08-14 Thread Paul Yunusov
On August 13, 2003 05:40 pm, Bailey, Shane C. wrote:
> Do you want to add a filter which will look over every request prior to
> Struts getting any requests?  That might be one possibility.
>
> If you have never written a filter then one I know where you can get source
> for is at securityfilter.sourceforge.net that one isn't doing necessarily
> what you want but it is a (working with source) example.

No, all I want is to route every request to a webapp through a Struts 
controller servlet. The only obvious option, which is mapping the servlet to 
the "/*" pattern in web.xml, doesn't seem to work. That's why I am wondering 
if Struts supports this kind of mapping or not, or if this is a bug.
Thanks,

Paul


>
> - Original Message -
> From: "Paul Yunusov" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 13, 2003 11:51 AM
> Subject: Re: Mapping Struts controller servlet to webapp root: trouble
>
> > Thanks, I see how the way Struts parses URLs could confuse it. I want to
>
> map
>
> > Struts to the webapp's root because my webapp doesn't contain any static
> > content and I want to limit all requests to Struts-defined actions.
> >
> > Can anyone confirm Struts does not support "/*" mapping for its
> > controller servlet?
> >
> > Thank you,
> >
> > Paul
> >
> > > -Original Message-
> > > From: Paul Yunusov [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, August 13, 2003 11:05 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Mapping Struts controller servlet to webapp root: trouble
> > >
> > > I was wondering if anyone has heard of issues arising when the
> > > contoller
>
> is
>
> > > mapped to a webapp's root.
> > >
> > > I am talking about this:
> > >
> > > 
> > >   action
> > >   /*
> > > 
> > >
> > > where "action" is the Struts controller.
> > >
> > > Struts seems to return a 400 error with such mapping when it tries to
>
> make
>
> > > a
> > >
> > > forward from an Action instance saying that "the request was
>
> syntactically
>
> > > incorrect".
> > >
> > > /struts/* or *.do
>
> are
>
> > > commong but I was wondering about the "/*" mapping. Anyone heard of any
> > > issues with this?
> > > Thanks,
> > >
> > > Paul
> > >
> > >
> > > -
> > > 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]
> >
> > -
> > 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]
>
> -
> 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]



Re: Mapping Struts controller servlet to webapp root: trouble

2003-08-14 Thread Paul Yunusov
On August 13, 2003 06:56 pm, Craig R. McClanahan wrote:
> On Wed, 13 Aug 2003, Paul Yunusov wrote:
> > Date: Wed, 13 Aug 2003 17:46:57 -0400
> > From: Paul Yunusov <[EMAIL PROTECTED]>
> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > Subject: Re: Mapping Struts controller servlet to webapp root: trouble
> >
> > On August 13, 2003 05:30 pm, Sgarlata Matt wrote:
> > > As far as I know this is an issue that is specific to your web server
> > > and outside the scope of struts.  For example, in tomcat I believe the
> > > solution is to put your app in the </webapps/ROOT
> > > directory.
> >
> > No, I was wondering about mapping the Struts servlet to the webapp's root
> > URL, not putting a webapp at the server's root. I have still not heard
> > from anyone if Struts doesn't support it.
> >
> > That's what I am talking about (web.xml):
> > 
> >  action
> >  /*
> > 
>
> If you're using JSPs, this mapping will totally disable them because it
> maps things like "/index.jsp" back to the controller servlet again.

That's exactly what happened. Thanks for pointing this out to me.

>
> Struts requires either a prefix-match (/do/*) or extension-match (*.do)
> mapping.  See Section 5.4.2 of the User Guide.

I know why now. Thanks.

>
> > Paul
>
> Craig

Paul


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



Mapping Struts controller servlet to webapp root: trouble

2003-08-14 Thread Paul Yunusov
I was wondering if anyone has heard of issues arising when the contoller is 
mapped to a webapp's root.

I am talking about this:


  action
  /*


where "action" is the Struts controller.

Struts seems to return a 400 error with such mapping when it tries to make a 
forward from an Action instance saying that "the request was syntactically 
incorrect".

/struts/* or *.do are 
commong but I was wondering about the "/*" mapping. Anyone heard of any 
issues with this?
Thanks,

Paul


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



Re: Mapping Struts controller servlet to webapp root: trouble

2003-08-14 Thread Paul Yunusov
Thanks, Shane, I'll look into that.
Paul

On August 13, 2003 06:15 pm, Bailey, Shane C. wrote:
> I guess I am more saying, I'm pretty sure, by looking at Struts source code
> (granted a week or so ago), that you can't do /*.  So I am suggesting to
> use a filter.
>
> But looking at a different piece of the source maybe the solution is to not
> have a mapping specified at all.  Sounds ugly, dangerous; but there is a
> comment in the source that states, " Use our servlet mapping, if one is
> specified":
>
>
>
> /**
>  * Return the form action converted into a server-relative URL.
>  */
> public static String getActionMappingURL(String action, PageContext
> pageContext) {
>
> HttpServletRequest request = (HttpServletRequest)
> pageContext.getRequest();
> StringBuffer value = new StringBuffer(request.getContextPath());
> ModuleConfig config =
> (ModuleConfig)
> pageContext.getRequest().getAttribute(Globals.MODULE_KEY);
> if (config != null) {
> value.append(config.getPrefix());
> }
>
> // Use our servlet mapping, if one is specified
> String servletMapping =
> (String) pageContext.getAttribute(Globals.SERVLET_KEY,
> PageContext.APPLICATION_SCOPE);
> if (servletMapping != null) {
> String queryString = null;
> int question = action.indexOf("?");
> if (question >= 0) {
> queryString = action.substring(question);
> }
> String actionMapping = getActionMappingName(action);
> if (servletMapping.startsWith("*.")) {
> value.append(actionMapping);
> value.append(servletMapping.substring(1));
> } else if (servletMapping.endsWith("/*")) {
> value.append(servletMapping.substring(0,
> servletMapping.length() - 2));
> value.append(actionMapping);
> } else if (servletMapping.equals("/")) {
> value.append(actionMapping);
> }
> if (queryString != null) {
> value.append(queryString);
> }
> }
>
> // Otherwise, assume extension mapping is in use and extension is
> // already included in the action property
> else {
> if (!action.startsWith("/")) {
> value.append("/");
> }
> value.append(action);
> }
>
> // Return the completed value
> return (value.toString());
>  }
>
> -Original Message-
> From: Paul Yunusov [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 13, 2003 6:02 PM
> To: Struts Users Mailing List
> Subject: Re: Mapping Struts controller servlet to webapp root: trouble
>
> On August 13, 2003 05:40 pm, Bailey, Shane C. wrote:
> > Do you want to add a filter which will look over every request prior to
> > Struts getting any requests?  That might be one possibility.
> >
> > If you have never written a filter then one I know where you can get
>
> source
>
> > for is at securityfilter.sourceforge.net that one isn't doing necessarily
> > what you want but it is a (working with source) example.
>
> No, all I want is to route every request to a webapp through a Struts
> controller servlet. The only obvious option, which is mapping the servlet
> to
>
> the "/*" pattern in web.xml, doesn't seem to work. That's why I am
> wondering
>
> if Struts supports this kind of mapping or not, or if this is a bug.
> Thanks,
>
> Paul
>
> > - Original Message -
> > From: "Paul Yunusov" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Wednesday, August 13, 2003 11:51 AM
> > Subject: Re: Mapping Struts controller servlet to webapp root: trouble
> >
> > > Thanks, I see how the way Struts parses URLs could confuse it. I want
> > > to
> >
> > map
> >
> > > Struts to the webapp's root because my webapp doesn't contain any
> > > static content and I want to limit all requests to Struts-defined
> > > actions.
> > >
> > > Can anyone confirm Struts does not support "/*" mapping for its
> > > controller servlet?
> > >
> > > Thank you,
> > >
> > > Paul
> > >
> > > > -Original Message-
> > > > From: Paul Yunusov [mailto:[EMAIL PROTECTED]
> > > > Sent: 

Re: Mapping Struts controller servlet to webapp root: trouble

2003-08-14 Thread Paul Yunusov
On August 13, 2003 05:30 pm, Sgarlata Matt wrote:
> As far as I know this is an issue that is specific to your web server and
> outside the scope of struts.  For example, in tomcat I believe the solution
> is to put your app in the </webapps/ROOT directory.

No, I was wondering about mapping the Struts servlet to the webapp's root URL, 
not putting a webapp at the server's root. I have still not heard from anyone 
if Struts doesn't support it.

That's what I am talking about (web.xml):

 action
 /*


Paul

>
> Hope that helps,
>
> Matt
> ----- Original Message -
> From: "Paul Yunusov" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 13, 2003 11:51 AM
> Subject: Re: Mapping Struts controller servlet to webapp root: trouble
>
> > On August 13, 2003 11:03 am, Bailey, Shane C. wrote:
> > > If I remember correctly, from looking at the source code, Struts
>
> determines
>
> > > what extension (or prefix) to add to the request. If /* is used I could
>
> see
>
> > > how it could screw things up.  You don't want images and things like
>
> that
>
> > > going through Struts anyway, I wouldn't think.
> > >
> > > Why do you want to do /* (at least for Struts URL pattern)?
> >
> > Thanks, I see how the way Struts parses URLs could confuse it. I want to
>
> map
>
> > Struts to the webapp's root because my webapp doesn't contain any static
> > content and I want to limit all requests to Struts-defined actions.
> >
> > Can anyone confirm Struts does not support "/*" mapping for its
> > controller servlet?
> >
> > Thank you,
> >
> > Paul
> >
> > > -Original Message-
> > > From: Paul Yunusov [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, August 13, 2003 11:05 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Mapping Struts controller servlet to webapp root: trouble
> > >
> > > I was wondering if anyone has heard of issues arising when the
> > > contoller
>
> is
>
> > > mapped to a webapp's root.
> > >
> > > I am talking about this:
> > >
> > > 
> > >   action
> > >   /*
> > > 
> > >
> > > where "action" is the Struts controller.
> > >
> > > Struts seems to return a 400 error with such mapping when it tries to
>
> make
>
> > > a
> > >
> > > forward from an Action instance saying that "the request was
>
> syntactically
>
> > > incorrect".
> > >
> > > /struts/* or *.do
>
> are
>
> > > commong but I was wondering about the "/*" mapping. Anyone heard of any
> > > issues with this?
> > > Thanks,
> > >
> > > Paul
> > >


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



Re: design question about action chaining

2003-04-01 Thread Paul Yunusov
On Tuesday 01 April 2003 03:59 pm, Igor Shabalov wrote:
> You can not possibly imagine how useful and powerful can be good GUI tool
> when you handle really big and cumbersome struts-config file. Actually it
> can give you much more capability to implement such pipes, filers and
> “assembling” of application from pre-defined action components.

Why, I can.

Paul


>
> On Tue, 1 Apr 2003 15:12:34 -0500, Paul Yunusov <[EMAIL PROTECTED]>
>
> wrote:
> > On Tuesday 01 April 2003 03:00 pm, Thorin Linderholm wrote:
> >> The static method you suggest would be very cumbersome to implement and
> >> maintain, requiring hard-coding calls to each bit of functionality I
> >> wanted
> >> on each page (aghh!)  But thanks for the reply :-)
> >>
> >> I have to disagree that 'If they are a business tier concept, Struts
> >> should
> >> have nothing to do with
> >> chaining them.'
> >>
> >> The struts ActionServlet and the page mappings in the struts-config are
> >> the
> >> 'controller' portion of Struts.  The whole of Struts is much more than
> >> the
> >> 'C' in MVC.  It has taglibs for supporting the V, and actions are in
> >> fact
> >> always implementing buisness logic (they decide what page to go to by
> >> returning a 'forward': definite buisness logic, if there is such a
> >> thing.)
> >> And that's always been a gray area in MVC for me: does all the buisness
> >> logic belong in the model, or can it also go in the controller?  Or is
> >> there an MVCC where there is a 'view' controller and 'buisness'
> >> controller
> >> (which seems a bit redundant to me.)
> >
> > Well, at one point you will wonder which is more cumbersome: coding
> > Action classes or having a mile-long struts-config.xml.
> >
> > Paul
> >
> >> -Original Message-
> >> From: Paul Yunusov [mailto:[EMAIL PROTECTED]
> >> Sent: Tuesday, April 01, 2003 11:43 AM
> >> To: Struts Users Mailing List
> >> Subject: Re: design question about action chaining
> >>
> >> On Tuesday 01 April 2003 02:30 pm, Thorin Linderholm wrote:
> >> > I have been tasked with porting an existing web application with it's
> >>
> >> own
> >>
> >> > proprietary controller architecture to using Struts.
> >> >
> >> > As they are both web controller architectures, they have many
> >>
> >> similarities,
> >>
> >> > but I'm running into one difference in overall architecture that I'm
> >>
> >> having
> >>
> >> > difficulty resolving.
> >> >
> >> > This difficulty is most closely related to the 'action chaining' posts
> >>
> >> I've
> >>
> >> > been able to find in the mailing list archives.
> >> >
> >> > Specifically, I have over 400 pages mapped to various actions (our
> >> > controller calls them that, and they're roughly synonymous with struts
> >> > actions.)  However, our controller allows specifying a list of actions
> >>
> >> to
> >>
> >> > execute on a per-page, and per-page-set basis.  In other words, we can
> >> > assign an action like 'Ensure Session initialization has been
> >> > completed/Initialize session' to every page in the site with a single
> >> > mapping (assuming you've already listed all the pages.)  Or you can
> >> > assign it to 90% of your pages if you happen to desire.  We have
> >> > approximatly ten actions that happen on between 60-99% of the pages on
> >> > our site.  If we
> >>
> >> were
> >>
> >> > to directly translate this to the struts mapping system we would end
> >>
> >> up
> >>
> >> > having to re-specify those ten actions on most of those 400+ pages,
> >> > creating long action chains for each page (a whole lot of duplication:
> >>
> >> hard
> >>
> >> > to maintain, easy to get wrong, etc.)
> >> >
> >> > So, conceptually, I want to be able to apply a few different bits of
> >> > logic to whole sets of pages.  Some of those 'bits of logic' (actions
> >>
> >> if
> >>
> >> > you will,) interrupt the process and forward to a different page (page
> >> > access rules for instance.)
> &

Re: design question about action chaining

2003-04-01 Thread Paul Yunusov
On Tuesday 01 April 2003 03:00 pm, Thorin Linderholm wrote:
> The static method you suggest would be very cumbersome to implement and
> maintain, requiring hard-coding calls to each bit of functionality I wanted
> on each page (aghh!)  But thanks for the reply :-)
>
> I have to disagree that 'If they are a business tier concept, Struts should
> have nothing to do with
> chaining them.'
>
> The struts ActionServlet and the page mappings in the struts-config are the
> 'controller' portion of Struts.  The whole of Struts is much more than the
> 'C' in MVC.  It has taglibs for supporting the V, and actions are in fact
> always implementing buisness logic (they decide what page to go to by
> returning a 'forward': definite buisness logic, if there is such a thing.)
> And that's always been a gray area in MVC for me: does all the buisness
> logic belong in the model, or can it also go in the controller?  Or is
> there an MVCC where there is a 'view' controller and 'buisness' controller
> (which seems a bit redundant to me.)
>

Well, at one point you will wonder which is more cumbersome: coding Action 
classes or having a mile-long struts-config.xml.

Paul



>
>
> -Original Message-
> From: Paul Yunusov [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 01, 2003 11:43 AM
> To: Struts Users Mailing List
> Subject: Re: design question about action chaining
>
> On Tuesday 01 April 2003 02:30 pm, Thorin Linderholm wrote:
> > I have been tasked with porting an existing web application with it's own
> > proprietary controller architecture to using Struts.
> >
> > As they are both web controller architectures, they have many
>
> similarities,
>
> > but I'm running into one difference in overall architecture that I'm
>
> having
>
> > difficulty resolving.
> >
> > This difficulty is most closely related to the 'action chaining' posts
>
> I've
>
> > been able to find in the mailing list archives.
> >
> > Specifically, I have over 400 pages mapped to various actions (our
> > controller calls them that, and they're roughly synonymous with struts
> > actions.)  However, our controller allows specifying a list of actions to
> > execute on a per-page, and per-page-set basis.  In other words, we can
> > assign an action like 'Ensure Session initialization has been
> > completed/Initialize session' to every page in the site with a single
> > mapping (assuming you've already listed all the pages.)  Or you can
> > assign it to 90% of your pages if you happen to desire.  We have
> > approximatly ten actions that happen on between 60-99% of the pages on
> > our site.  If we
>
> were
>
> > to directly translate this to the struts mapping system we would end up
> > having to re-specify those ten actions on most of those 400+ pages,
> > creating long action chains for each page (a whole lot of duplication:
>
> hard
>
> > to maintain, easy to get wrong, etc.)
> >
> > So, conceptually, I want to be able to apply a few different bits of
> > logic to whole sets of pages.  Some of those 'bits of logic' (actions if
> > you will,) interrupt the process and forward to a different page (page
> > access rules for instance.)
> >
> > There are several possible solutions that I've come up with, but so far
>
> all
>
> > of them involve either hacks, extending struts (which happens to partialy
> > eliminate the reason I'm being required to move to Struts, and so isn't
> > very favored by my supperiors,) some complicated java inheritance
>
> hierarchy
>
> > where I inherit non-related functionality in those ten actions into a set
> > of compound actions, each inheriting in the set of functionality we want
> > (lame,) or I could implement a 'view preprocessor' of some kind that
> > parallels the struts-config and defines processing that I need to do for
> > each view page (which requires me to have two completely redundant sets
> > of page mappings, and apears to me to obsolete the need for Struts in the
> > first place (if we were to ignore it's tag libraries and other helper
> > classes which we also already have proprietary equivalents to.)
> >
> > I'd love to hear from anyone about other possibilities, or (even better,)
> > pointers to somebody/some package already solving this problem.
> >
> > Another way to look at the whole thing:  How have other people solved the
> > problem of being able to apply a set of page access rules to arbitrary
>
> sets
>

Re: Why is generateToken() "protected"?

2003-04-01 Thread Paul Yunusov
On Tuesday 01 April 2003 02:45 pm, David Graham wrote:
> The Action class' token methods are moving to RequestUtils in 1.2 to allow
> the RequestProcessor to use them.  Your classes can then use the token
> methods as well.
>
> David

Good news!

Paul




>
>
>
> From: Paul Yunusov <[EMAIL PROTECTED]>
>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Why is generateToken() "protected"?
> >Date: Tue, 1 Apr 2003 14:21:14 -0500
> >
> >I think at least one reason is the wish to separate the business tier from
> >the
> >Struts API as in "the business tier shall not call Struts methods" mantra.
> >Besides, generateToken() seems to be meant for collaboration with Struts
> >tags. However, the cost of this decision is that direct extensibility
> >options
> >are limited to inheritance, and, in some cases, this is a tangible cost.
> >
> >For example, I use a helper class for defining functionality common to
> >multiple actions instead of using a custom superclass that extends Action.
> >The helper class doesn't extend Action and it can be designed for
> >composition
> >or based on static methods. I also do not use any Struts tag libraries,
> >however, my helper class does need to generate a token for form workflow
> >control, for which generateToken() is useful.
> >
> >The problem is generateToken() is not accessible outside of the Struts
> >Action
> >heirarchy, and that seems to be based on an assumption that Struts users
> >will
> >rely largle on inheritance to extend the framework, or, at least, it seems
> >inheritance is very encouraged. I can create a wrapper around Action with
> > a public method calling generateToken() and beat the inheritance
> > assumption but
> >I don't like fighting with frameworks.
> >
> >generateToken() especially, can be useful outside the Struts Action+tags
> >model
> >so are there any reasons to keep generateToken() "protected" and is the
> >separation of the Struts API from the business tier a strong enough reason
> >in
> >this case?
> >
> >Paul
> >
> >-
> >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]


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



Re: design question about action chaining

2003-04-01 Thread Paul Yunusov
On Tuesday 01 April 2003 02:30 pm, Thorin Linderholm wrote:
> I have been tasked with porting an existing web application with it's own
> proprietary controller architecture to using Struts.
>
> As they are both web controller architectures, they have many similarities,
> but I'm running into one difference in overall architecture that I'm having
> difficulty resolving.
>
> This difficulty is most closely related to the 'action chaining' posts I've
> been able to find in the mailing list archives.
>
> Specifically, I have over 400 pages mapped to various actions (our
> controller calls them that, and they're roughly synonymous with struts
> actions.)  However, our controller allows specifying a list of actions to
> execute on a per-page, and per-page-set basis.  In other words, we can
> assign an action like 'Ensure Session initialization has been
> completed/Initialize session' to every page in the site with a single
> mapping (assuming you've already listed all the pages.)  Or you can assign
> it to 90% of your pages if you happen to desire.  We have approximatly ten
> actions that happen on between 60-99% of the pages on our site.  If we were
> to directly translate this to the struts mapping system we would end up
> having to re-specify those ten actions on most of those 400+ pages,
> creating long action chains for each page (a whole lot of duplication: hard
> to maintain, easy to get wrong, etc.)
>
> So, conceptually, I want to be able to apply a few different bits of logic
> to whole sets of pages.  Some of those 'bits of logic' (actions if you
> will,) interrupt the process and forward to a different page (page access
> rules for instance.)
>
> There are several possible solutions that I've come up with, but so far all
> of them involve either hacks, extending struts (which happens to partialy
> eliminate the reason I'm being required to move to Struts, and so isn't
> very favored by my supperiors,) some complicated java inheritance hierarchy
> where I inherit non-related functionality in those ten actions into a set
> of compound actions, each inheriting in the set of functionality we want
> (lame,) or I could implement a 'view preprocessor' of some kind that
> parallels the struts-config and defines processing that I need to do for
> each view page (which requires me to have two completely redundant sets of
> page mappings, and apears to me to obsolete the need for Struts in the
> first place (if we were to ignore it's tag libraries and other helper
> classes which we also already have proprietary equivalents to.)
>
> I'd love to hear from anyone about other possibilities, or (even better,)
> pointers to somebody/some package already solving this problem.
>
> Another way to look at the whole thing:  How have other people solved the
> problem of being able to apply a set of page access rules to arbitrary sets
> of pages without having to create a system parallel to struts that
> re-defines every page in the application?  Or do people consider a parallel
> system that respecifies every page as the proper design?
>
> Thorin


Ever thought of defining functionality equivalent to your proprietory 
"actions" in classes that don't extend the Struts framework and chaining 
calls to instances of these classes in your Struts Actions?

This is a static solution as opposed to having struts-config.xml support some 
sort of action chaining tags but Struts Actions are only HTTP adapters, and 
chaining them violates the spirit of the framework. That's why I think 
implementing "chaining" with non-Struts classes is a better idea.

Your  "actions" seem to be pretty fine-grained ("Ensure Session initialization 
has been completed/Initialize session"). If session in this case refers to 
the HttpSession, then they are almost as low-level as the Servlet API (why?). 
If they are a business tier concept, Struts should have nothing to do with 
chaining them.

Paul

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



Why is generateToken() "protected"?

2003-04-01 Thread Paul Yunusov
I think at least one reason is the wish to separate the business tier from the 
Struts API as in "the business tier shall not call Struts methods" mantra. 
Besides, generateToken() seems to be meant for collaboration with Struts 
tags. However, the cost of this decision is that direct extensibility options 
are limited to inheritance, and, in some cases, this is a tangible cost.

For example, I use a helper class for defining functionality common to 
multiple actions instead of using a custom superclass that extends Action. 
The helper class doesn't extend Action and it can be designed for composition 
or based on static methods. I also do not use any Struts tag libraries, 
however, my helper class does need to generate a token for form workflow 
control, for which generateToken() is useful.

The problem is generateToken() is not accessible outside of the Struts Action 
heirarchy, and that seems to be based on an assumption that Struts users will 
rely largle on inheritance to extend the framework, or, at least, it seems 
inheritance is very encouraged. I can create a wrapper around Action with a 
public method calling generateToken() and beat the inheritance assumption but 
I don't like fighting with frameworks.

generateToken() especially, can be useful outside the Struts Action+tags model 
so are there any reasons to keep generateToken() "protected" and is the 
separation of the Struts API from the business tier a strong enough reason in 
this case?

Paul

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



Re: Reporting an Exception message in a JSP.

2003-02-25 Thread Paul Yunusov
On Tuesday 25 February 2003 10:03 am, ROSSEL Olivier wrote:
> I want to display the error message of an SQLException
> in my JSP.
>
> At first, I tried to set an ActionError with this message and
> to display it via .
> It does not work because ActionError accepts as an input
> string the key of a property.
>
> So what's the nicest way to show to the user the error message
> that I get from my SQLException ?

If you use Struts 1.1, declare an  under  or an 
 in your struts config xml file. You can specify a JSP page to 
forward the request to within the exception element.

You may need to define an ExceptionHandler class that will be passed request, 
response and exception objects if an Action throws an exception. Build any 
response there that's more complex than merely forwarding to a JSP.

Read section 4.5 of the wonderful Struts user guide:
http://jakarta.apache.org/struts/userGuide and read the struts config file's 
DTD - very revealing texts.

Paul

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