11/23/2002 9:31:00 AM, "Nelson, Laird" <[EMAIL PROTECTED]> 
wrote:

>> -----Original Message-----
>> From: Ted Husted [mailto:[EMAIL PROTECTED]]
>> 11/22/2002 1:26:45 PM, "Nelson, Laird" <[EMAIL PROTECTED]> 
>> wrote:
>> >Is my company unique in trying to do
>> >things this way?
>> 
>> Probably not, but Struts hasn't been trying to be all things to 
>> all people. =:0)
>> 
>> It does what the people working on it need it to do, and if it 
>> doesn't do what we need, then we work to change it. But we're 
not 
>> sitting around a whiteboard trying to figure out the best way 
to 
>> capture market share. 
>
>(Sorry; my previous message wasn't intended to be whiny.  I just 
>wondered whether what we were doing warranted my digging further 
>or if I should just let Struts be and keep our patches in house.  
>It sounds like the multiple-servlet-mapping thing that we're 
>doing to keep our reporting folks happy is fairly unique and 
>nasty.)

If you come up with any actual patches, I'm sure everyone would be 
very interesting in seeing them. Struts 1.0.x wasn't trying to be 
all things to all people, but Struts 2.x may be a horse of a 
different color. 

>> Struts does restrict what URIs you can map to an Action. The 
>> underlying issue, as Craig pointed out, is that the Action path 
>> is not a truly logical identifier. It's a hash based on the URI 
>> that Struts munged and demunges.
>
>Isn't it just pathinfo (in the case of prefix mapping, not 
>extension mapping)?  Or is there a section of the code besides 
>processPath?() I should be looking at?

Originally, it was just a matter of prepending or appending the 
prefix or extension to the action-mapping path to generate the 
context-relative URI. Of course, now we also have to cope with the 
module prefix when applicable.

Right now, the Struts tags only use Action paths in the form tag, 
but other presentation vehicles let you use action paths in other 
places, like hyperlinks. I've been finding this very useful 
myself, and have been meaning to slip in a patch to html:link so 
that it supports retrieving an action along with a forward or a 
page reference. Since we now encourage people to put all their 
dynamic pages behind actions, in practice this becomes a *very* 
useful feature.

>One thing I was looking at on an earlier project was setting up 
>the action mappings section of the struts-config.xml file to be 
>able to switch not only off of URL fragments like pathinfo but 
>also the presence or absence of certain attributes in various 
>scopes.  Interestingly, of course, Struts offers XML tags that 
>test for the presence or absence of such attributes--wouldn't it 
>be twisted and awful and cool to use those tags in the action-
>mappings section?
>
>So you could say (warning; unchecked syntax but you get the
> idea):
>
>  <action-mappings>
>    <logic:present name="loggedIn" scope="session">
>      <action ... />
>    </logic>
>  </action-mappings>

The action-mapping elements are not runtime components. They are 
descriptors that are used to create runtime components. The place 
to put something like this would be in a subclass of the 
ActionMapping bean. You could then cast the ActionMapping to your 
own class (as is often done with ActionForms) to call whatever 
custom methods or properties you might need. 

What you might be driving at is the ability to pass some type of 
scripting statement to an Action, that it could then interpret at 
runtime. Another place to put something like this is the parameter 
property. 

Offhand, I don't think the JSP tags could be reused this way. But 
I do know a lot of developers are looking at decorating Actions 
with scripting languages, like Jelly or BSL.

I sometimes do things like have my Actions look at their 
ActionForwards to decide whether do some things (like look for a 
cancel request or a missing token).


-Ted.




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

Reply via email to