Re: How to get the value of Constants defined in struts.xml

2010-10-25 Thread Andy Law

Heading off at a slight tangent, is it possible to use the constant values in
action configurations within the struts XML?

I have long thought it a code smell that I have magic strings in my XML
configuration that get repeated in my code. If I could handle those by
reference to a single point in my configuration file (referencing in my
 tags, @Injecting into my action classes)
then I would be much happier (well, a *bit* happier).

Of course, there would still be the pervasive smell over trying to get the
values into the tests :o{




Dave Newton-6 wrote:
> 
> Simplicity: it's just an @Inject.
> 
> On Mon, Oct 25, 2010 at 2:55 AM, SudhirJava  wrote:
>>
>> Struts Constants.
>> I can define in web.xml and get the value in Action class too.
>> Then what is the use of Struts Constants?
>>
>>
>> ~SK
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-get-the-value-of-Constants-defined-in-struts.xml-tp30019022p30048243.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: Bizarre sporadic problem with streaming a stylesheet.

2010-09-23 Thread Andy Law


I wrote:
> 
> Apologies for being late to the party, but this smells like a
> browser/proxy
> cache issue to me?
> 

and then


mgainty wrote:
> 
> 
> i agree with andy
>  
> do a view source and tracert on all urls
> 
> i it is possible you'll see there is a man-in-the middle proxy altering
> the response
> 
> 

I'd just to like to note that I don't share Martin's paranoia. It's just
that I know that when I alter static stylesheets in my
applications/websites, I often have to force the browsers to refresh them.
Pulling them with curl/wget always supplies the correct, current version as
in the OP's case but the browser ignores changes because they don't seem to
expect changes in style sheets.

I don't know off the top of my head if there is a cache pragma that can be
stuck into the stylesheet response or tag to prevent such problems, nor have
I ever gone hunting for one as this is a minor inconvenience that I
generally only suffer during development/debugging sessions.

Later,

Andy
-- 
View this message in context: 
http://old.nabble.com/Bizarre-sporadic-problem-with-streaming-a-stylesheet.-tp29766033p29787100.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: Bizarre sporadic problem with streaming a stylesheet.

2010-09-22 Thread Andy Law


DNewfield wrote:
> 
> Anyway, glad you've solved your issue.  Too bad we didn't all learn 
> something from it :-)
> 

Apologies for being late to the party, but this smells like a browser/proxy
cache issue to me?

Later,

Andy


-- 
View this message in context: 
http://old.nabble.com/Bizarre-sporadic-problem-with-streaming-a-stylesheet.-tp29766033p29777309.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: Interceptor order

2010-05-20 Thread Andy Law

Cheers Chris,


Chris Pratt wrote:
> 
> You may want to think about using:
> 
> invocation.getStack().getContext().put(MAGIC_KEY,getStuff());
> 
> instead of:
> 
> invocation.getStack().set(MAGIC_KEY,getStuff());
> 
> For the sake of argument, I'm going to assume that MAGIC_KEY is set to the
> String "magic".  The first example above makes #magic available in the
> Value
> Stack's context, so you can simply use  value="%{#magic.gathering}"/> in your JSP to effectively give the same
> results as a call to getStuff().getGathering().  Whereas the second
> example
> changes the stack itself, which may be what's interfering with the other
> interceptors.
> 


Is this documented anywhere? For the record, I would be looking for a great
big flashing Red sign saying "If you use the set() routine on the ValueStack
you'll silently blow away all the parameter handling code" for completeness
but I never found one of those yet.

Also for the record, using the set(MAGIC_KEY, this.getStuff()) call makes
'magic' available directly so I can reference it as . I'm not clear in my mind how the alternative
version is better (other than your assertion that it will work :o}).

Later,
Andy 

-- 
View this message in context: 
http://old.nabble.com/Interceptor-order-tp28597967p28623423.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: Interceptor order

2010-05-20 Thread Andy Law


RogerV wrote:
> 
> 
> 
> Andy Law wrote:
>> 
>> The pertinent code in the interceptor is reproduced below. It does what I
>> expect it to do insofar as it sticks my "Stuff" object in a place that
>> the JSP can retrieve it using the MAGIC_KEY string. However, if I
>> configure my interceptor stack with this interceptor at the top, none of
>> the other interceptors appear to fire. If I put this interceptor last in
>> the stack, all of the others do seem to fire (well, the application
>> works). Why should I need to put this after all the params-prepare-params
>> stuff?
>> 
>> public String intercept(ActionInvocation invocation) throws
>> Exception {
>> 
>> if (this.getStuff() != null) {
>> ActionContext ic = invocation.getInvocationContext();
>> if (ic != null) {
>> ValueStack vs = ic.getValueStack();
>> if (vs != null) {
>> vs.set(MAGIC_KEY, this.getStuff());
>> }
>> }
>> }
>> return invocation.invoke();
>> }
>> 
>> As always, any and all help/pointers gratefully accepted, particularly if
>> I'm doing something stupid!
>> 
>> 
> 
> First of all, I'd load the config-browser plugin and check that the
> interceptor stack your action is using is actually the stack that you
> think it is. (BTDTGTTS)
> 
> Secondly, I've never tried to poke the ValueStack directly, I've always
> used Interceptors to load objects into my actions and then retrieved them
> from there with the standard struts tags. What happens if you take all
> your processing out leaving just "return invocation.invoke()" - does your
> stack still fire?
> 
> Regards
> 


OK. Further investigation reveals the following:

1) The correct Interceptor stack *is* being configured and called (good call
on the config-browser plugin, I hadn't seen that before. Thanks)

2) Regardless of the position of the troublesome Interceptor, the other
Interceptors *do* fire

3) The key line is the "vs.set(MAGIC_KEY, this.getStuff());" line. Remove
this and all is well (except the interceptor does not do anything). Leave it
in and the action fails apparently because it never has the request
parameters set.

4) That same line works "as expected" if the interceptor runs last and the
object it injects *is* available in the JSPs.


It is as if setting a value on the ValueStack like that somehow wipes out
the Request parameters from the context.

Obviously I have two possible workarounds but this is bugging me. I don't
want to make my Actions know about the object being injected - this is not
part of their logic. Also, I don't want to have an application with some
"magic" order-related feature that I'll forget about in 6 months time. This
*should* work but it doesn't and that's just wrong!

Anyone more clues, anyone?

Later,

Andy

-- 
View this message in context: 
http://old.nabble.com/Interceptor-order-tp28597967p28622744.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



Interceptor order

2010-05-18 Thread Andy Law

Following on from my previous question
(http://old.nabble.com/Some-Spring-Struts-questions-td28533505.html) about
injecting objects orthogonal to actions into the environment where jsps can
"see" them, I now have an interceptor that does what I want it do (Yay! -
thanks guys).

However, I'm seeing some peculiar behaviour that I don't understand fully.

The pertinent code in the interceptor is reproduced below. It does what I
expect it to do insofar as it sticks my "Stuff" object in a place that the
JSP can retrieve it using the MAGIC_KEY string. However, if I configure my
interceptor stack with this interceptor at the top, none of the other
interceptors appear to fire. If I put this interceptor last in the stack,
all of the others do seem to fire (well, the application works). Why should
I need to put this after all the params-prepare-params stuff?



public String intercept(ActionInvocation invocation) throws
Exception {

if (this.getStuff() != null) {
ActionContext ic = invocation.getInvocationContext();
if (ic != null) {
ValueStack vs = ic.getValueStack();
if (vs != null) {
vs.set(MAGIC_KEY, this.getStuff());
}
}
}
return invocation.invoke();
}



As always, any and all help/pointers gratefully accepted, particularly if
I'm doing something stupid!

Later

Andy


-- 
View this message in context: 
http://old.nabble.com/Interceptor-order-tp28597967p28597967.html
Sent from the Struts - User mailing list archive at Nabble.com.


Why is ActionContext not an Interface?

2010-05-14 Thread Andy Law

I'm pretty sure that ActionContext used to be an Interface (in Struts1?). I
know that it isn't in Struts2 because I've just tripped over that when
trying to create mocks for a set of Unit tests for an Interceptor.

Is there a reason why it changed?

Later,

Andy
-- 
View this message in context: 
http://old.nabble.com/Why-is-ActionContext-not-an-Interface--tp28561045p28561045.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: Some Spring/Struts questions

2010-05-13 Thread Andy Law



Wes Wannemacher wrote:
> 
> On Wed, May 12, 2010 at 10:42 AM, Dale Newfield  wrote:
>>
>> That all sounds reasonable, except the part about putting it in the
>> session
>> instead of the request.  If there's no compelling reason to store
>> something
>> in the session, I think that it should be avoided.  If you're using an
>> interceptor that's going to be doing this injection for each request
>> anyway,
>> you might as well store it in request scope.
>>
>> If you're storing it in the session, and the bean doesn't change much
>> (and
>> can't get stale), the interceptor might as well at least check to see if
>> it's already present and act as a no-op in that case.
>>
> 
> 
> Good point, Dale... I didn't read the OP close enough and was being lazy.
> 
> -Wes
> 
> 

Thanks for all the replies so far folks.

Following up on that thought process, if I use an interceptor then is there
any difference/tradeoff/efficiency gain or loss from stuffing the object in
question onto the Value Stack instead of dropping it into the request or the
session? I guess that "explicitness" is what you gain from the
request/session route?

Later,

Andy

-- 
View this message in context: 
http://old.nabble.com/Some-Spring-Struts-questions-tp28533505p28546199.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: Some Spring/Struts questions

2010-05-12 Thread Andy Law



dcabasson wrote:
> 
> That's actually possible. We are doing that type of things by using the 
> @Autowired annotation, which means that spring needs to find a suitable 
> bean to inject there. If you put that annotation on your base class, the 
> instance will get injected in all sub-classes. But in that case, it's 
> better for the actions to be unaware of that, so I would using the 
> static approach. Otherwise, you could use an interceptor to push that 
> object on to the stack.
> 

But that introduces a dependency on Spring into my Action classes, no? And
puts *some* of the configuration into the code and some inside of the Spring
config file.

I think that I'd rather avoid those outcomes if at all possible.

I think I'm leaning back towards Interceptors :o{

Later,

Andy
-- 
View this message in context: 
http://old.nabble.com/Some-Spring-Struts-questions-tp28533505p28535809.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: Some Spring/Struts questions

2010-05-12 Thread Andy Law

Martin,



mgainty wrote:
> 
> 
> jsp:useBean for quite some time
>  class="enterprise.criteriaQuery.ejb.StatelessSessionBean" />
> 
> in your jsp if you have a method called getCriteria the jsp could call the
> bean method directly via
> 
> <%=query.getCriteria()%>
> 
> 


OK. This looks like it could well be a good route to take except that I
can't work out how to make the jsp:useBean tag actually specify the copy of
the object that it wants to come from Spring. There is bean configuration
going on inside of the Spring configuration and so having instantiated a
singleton inside of the Spring config, I then want to tell the jsp to access
that instance. Th class specification that I'm working to is also an
Interface and I don't want to hard-code the specific implementation name
inside of the jsps as I need to configure that in Spring so I can plug in
alternative implementations in different instances of the application.

Is any of that possible?

Later,

Andy
-- 
View this message in context: 
http://old.nabble.com/Some-Spring-Struts-questions-tp28533505p28535778.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: Some Spring/Struts questions

2010-05-12 Thread Andy Law



James Cook-13 wrote:
> 
> In the past I have done this for accessing beans in a servlet.
> 
>  class="org.springframework.web.context.support.ServletContextAttributeEx
> porter">
>   
>   
>  value-ref="myOrganisationServiceBeanRef"/>
>  
>   
> 
> 
> OrganisationService organisationService = (OrganisationService)
> getServletContext().getAttribute("organisationService");
> 


OK. Thanks. I'll try that.

Is it possible though to use Spring to push objects onto the Struts OGNL
stack? That would be neater?

Later,

Andy
-- 
View this message in context: 
http://old.nabble.com/Some-Spring-Struts-questions-tp28533505p28534868.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: Some Spring/Struts questions

2010-05-12 Thread Andy Law


James Cook-13 wrote:
> 
> You could, add the bean to the servlet context, and access it via a
> scriptlet in the jsp. Thus bypassing your actions all together.
> 

What does the Spring configuration look like for that course of action?


James Cook-13 wrote:
> 
> Or.. Create filter/Inteceptor and inject into them?
> 

OK. We're already doing that for some of our stuff and that kind of handles
our "inheritance" problem (same injection into multiple subclass types with
single configuration). It feels a bit "hacky" in this context and I'd also
have to make all the actions "aware" of the object being added. The other
objects that we handle in this manner are genuinely integral to the Actions
(data access objects and permissions filters for example).

Later,

Andy

-- 
View this message in context: 
http://old.nabble.com/Some-Spring-Struts-questions-tp28533505p28533688.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



Some Spring/Struts questions

2010-05-12 Thread Andy Law

All,

Apologies if this would be better asked in a Spring forum. If so, I would
appreciate guidance as to which one/where.

I have a Struts2 application with around 30 actions. Most inherit from a
common base class. We have configured the system to start to use Spring to
inject certain things into certain places. This seems to work well and we
are all currently happy bunnies.

A new requirement means that we need to have available across pretty much
every action a separate, independent bean that carries information that may
(or may not) need to be displayed on the resulting web-pages. I am wondering
what the best way is to make this bean available to each JSP.

I'm happy with injecting certain beans into certain actions, but I'm not
clear what I should be injecting *this* bean into. Ideally it should just
pop into existence and be available to the JSPs without the Actions even
being aware that it is there. It's not part of the business logic and is
purely informational. If I have to make it available through the Actions
then I would *like* to be able to inject it into the common base class with
a single configuration and have that work automatically for all sub-classes
(and this would be a useful trick for some other places in the application)
but that does not seem to be possible unless I'm missing a trick?

How should I configure this, please?

Later,

Andy
-- 
View this message in context: 
http://old.nabble.com/Some-Spring-Struts-questions-tp28533505p28533505.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: Radio options left aligned

2009-08-31 Thread Andy Law



Lee Clemens-4 wrote:
> 
> Doesn't seem to work, but maybe my description was unclear.
> 
> I'm trying to get this:
> () OptA () OptB () OptC
> 
> to look like this:
> () OptA
> () OptB
> () OptC
> 
> theme="simple" prints them all in order
> theme="xhtml" prints them inside the same td tag (same row, not each as a
> new row).
> 
> 


I don't have my docs immediately to hand at the moment, but I think that the
most important thing that you need to know is that each element in your page
can have the theme applied to it directly. Thus you can use "simple" by
default for the majority of the form and then specify your own theme for the
radiolist (using ). That way you can write
your own ftl file for just the elements that you need and not affect other
instances of the tag type that don't need the specific styling.

FWIW (and IIRC from code I wrote a while ago), coding the radiolist as a
list (ul) with each radio-option as a list element within that combined with
a div/span/specific css-style was the easiest option for getting the format
you want.

Hope that helps.

Later,

Andy

-- 
View this message in context: 
http://www.nabble.com/Radio-options-left-aligned-tp25205809p25219977.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



Is this expected behaviour for tag?

2009-08-06 Thread Andy Law

I have actions that sit underneath a set of namespaces. The namespace conveys
a piece of information to the action like a poor-man's REST.

i.e. 
/Cow/ShowDetails.action
/Pig/ShowDetails.action
etc.

I need to construct some links from within the JSP that is hit by the
individual actions and have them point at a different action within the same
namespace

e.g. links generated in the page when accessed via /Cow/ should point to
/Cow/Action2.action and links generated in the page when accessed
via /Pig/ should point to /Pig/Action2.action


If I construct my links to contain href urls derived from  tags that
look like  then I get a URL that looks like
/Action2.action. This is no good.


So I figured that I had to set the namespace, which was a pain but I could
always rework the code so that the action knows what namespace it is working
in. I did that, and I set my tag to look like this  just to prove that it would work and I ran the
application.

To my surprise, I got a URL that looked like
/Pig/putItHere/Action2.action when I ran through the Pig namespace
and /Cow/putItHere/Action2.action when I ran through the Cow
namespace.

If I rework the namespace to include a leading slash (which was what I
intended to do the first time, but I mistyped it) then my tag looks like
 and my URL looks like
/putItHere/Action2.action regardless of which namespace the code is
run through.


So I thought that I would try the obvious thing next and coded my tag to say
 and I got the same outcome as if I had
specified  i.e. no namespace inserted.


There is NO way that I have found to do what I want to do which is have the
current namespace inserted into the generated URL without anything extra
added.

Have I missed something? (obvious or not so obvious)?

Thanks in advance for anything anyone can suggest.


Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/Is-this-expected-behaviour-for-%3Cs%3Aurl%3E-tag--tp24850352p24850352.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: CSS background images, struts2

2009-08-05 Thread Andy Law


Haroon Rafique wrote:
> 
> If your file structure is somewhat like:
> 
> styles/base.css
> images/image.gif
> 
> then you can simply change your background-image directive to say:
> background-image: url('../images/image.gif');
> 
> 


and



Musachy Barroso wrote:
> 
> assuming your dir structure is like:
> 
> css
> ...main.css
> images
> someimage.jpg
> 
> you can use this in your css: url(../images/someimagejpg)
> 
> 


Now I'm at my desk, I can see that this does indeed work. Thanks for the
help guys.

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/CSS-background-images%2C-struts2-tp24811929p24822960.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: CSS background images, struts2

2009-08-04 Thread Andy Law



Wes Wannemacher wrote:
> 
> One thing I've done in the past is to treat CSS files as JSPs and use
> s:url tags or EL expressions (${contextRoot}/images/image.gif)...
> 
> 


Oh. That feels s dirty!!!

There has to be a cleaner way to do it.

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/CSS-background-images%2C-struts2-tp24811929p24816196.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: CSS background images, struts2

2009-08-04 Thread Andy Law


Haroon Rafique wrote:
> 
> On Today at 9:38am, AL=>Andy Law  wrote:
> 
> If your file structure is somewhat like:
> 
> styles/base.css
> images/image.gif
> 
> then you can simply change your background-image directive to say:
> background-image: url('../images/image.gif');
> 
> or in other words, your image path will be relative to the path from where 
> the .css file is located. So, no need to worry about context paths and/or 
> nesting levels of action URLs.
> 

Is this the case? I always thought that *all* URLs were relative to the URL
of the web page/action. If I can use a known relationship between the CSS
file and the images then it should be trivial to fix, like you say.

I'll try it in the morning.

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/CSS-background-images%2C-struts2-tp24811929p24816098.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



CSS background images, struts2

2009-08-04 Thread Andy Law

I'm trying to specify a CSS style to be applied to a table header row that
includes a reference to a background image (specifically as part of a table
that uses JQuery/tablesorter). It is causing me pain.

To clarify what may be a bit of a garbled question, my (final, effective)
html needs to look something like this

Header

and my CSS file needs to look something like...

th.myclass {
background-image: url('images/image.gif');
}


The problem is how to specify the url in the CSS file so that it works when
the page is rendered as part of the web application.


Of course, I don't know what context my web app will be deployed at, nor do
I wish to hard-code it into the css file as that will then break if I try to
deploy at a different context. I've been trawling through web pages all
afternoon trying to find the answer but with no success so far.

I have found reference to the FilterDispatcher serving static content along
with some confusing documentation about what the struts.serve.static
property actually does (starting from 
http://stackoverflow.com/questions/870440/how-does-struts-2-includes-javascript-files-in-a-jsp-from-their-struts-jar
here ) but putting my static images in a subdirectory of the template
directory (for want of a better place) still don't work.

Can someone please point me in the right direction for getting this to work?
Or point me at a work-around? 

Thanks in advance,

Andy
-- 
View this message in context: 
http://www.nabble.com/CSS-background-images%2C-struts2-tp24811929p24811929.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: Cookie Intercepter configuration

2009-02-11 Thread Andy Law


Musachy Barroso wrote:
> 
> It is a bug. This interceptor was added in 2.0.7, and it was never
> added to struts-default.xml in the 2.1 branch. Just add this to your
> struts.xml:
> 
>  class="org.apache.struts2.interceptor.CookieInterceptor"/>
> 
> for reference:
> 
> https://issues.apache.org/struts/browse/WW-2992
> 
> 


Well, I guess that answers my question from last week...

http://www.nabble.com/CookiesInterceptor-config-missing-in-2.1.6-to21790815.html

Later,

Andy

-- 
View this message in context: 
http://www.nabble.com/Cookie-Intercepter-configuration-tp21922591p21953827.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



CookiesInterceptor config missing in 2.1.6

2009-02-02 Thread Andy Law

Is it deliberate that no reference to/configuration for the cookies
interceptor is provided in struts-default.xml in the 2.1 releases?

Obviously I can work around it by configuring in my struts.xml file but it
seems bizarre that the code exists and is included in the jar, but the
configuration is not.

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/CookiesInterceptor-config-missing-in-2.1.6-tp21790815p21790815.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



FIXED - My tests fail in 2.1.6 - can someone help?

2009-02-02 Thread Andy Law


Andy Law wrote:
> 
> 've hit a painful problem as I try to migrate to 2.1.6 (from 2.0.14).
> 
> I have a class that extends ActionSupport and which calls getText() from
> within a routine. I want to test the routine to ensure that it is working
> properly. My test runs fine when I compile with 2.0.14 but disappears into
> a morass of mock object hell under 2.1.6.
> 
> 

Apologies: I should have searched harder before shouting. The answer is at
http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-UpdateUnitTests

(or at http://tinyurl.com/b6b4v5)

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/My-tests-fail-in-2.1.6---can-someone-help--tp21787233p21788755.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



My tests fail in 2.1.6 - can someone help?

2009-02-02 Thread Andy Law

All,

I've hit a painful problem as I try to migrate to 2.1.6 (from 2.0.14).

I have a class that extends ActionSupport and which calls getText() from
within a routine. I want to test the routine to ensure that it is working
properly. My test runs fine when I compile with 2.0.14 but disappears into a
morass of mock object hell under 2.1.6.

The routine to be tested is simple enough. and is reproduced below...


public String getTitle() {
String retVal = "";
String key = this.getTitlePropertyKey();
if ( key != null) {
retVal = getText(key + ".title");
}
return retVal;
}



The test compares a value in a test resource file with the value being
returned.

If I try to run this under 2.1.6, I discover that in order to call getText
in an ActionSupport object, I have to provide a Context object and a Locale
and ValueStack and a Container and an XWorkConverter (that I can't mock
because it isn't an interface and can't create because it has a protected
constructor)...

This is really making me cross. Can anyone provide some clues as to how to
get this test to work or a suggestion as to how to better refactor the whole
thing to fit 'The Struts Way'?


Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/My-tests-fail-in-2.1.6---can-someone-help--tp21787233p21787233.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



Accessing struts.xml values from an Action

2008-12-18 Thread Andy Law

This may be trivial, in which case I apologise in advance.

I have an application that has several action classes (20 or so), each of
which belongs conceptually to a *group* of actions. I would like to be able
to extract lists of Actions by group from within a JSP/Action in order to
present them to the user in logical blocks.

I would rather have the configuration for this in a single place i.e. the
struts.xml file such that if I add a new Action configuration to that file
(and add in a parameter value or something similar) then the Action will
appear in the correct slot in the main 'switchboard' page automatically
without me having to rewrite the jsp or the controller code.

So, I want to be able to extract a list of Action mappings from within the
struts.xml file based on a parameter value that I set within that file.

Is this possible? Has someone already done this?

For added bonus points, each Action has specific permissions requirements
which can be queried from the relevant Action class. I would therefore like
to be able to access the FQ classname from within the switchboard in order
to query the permission requirements and hence provide sensible filters on
the list of Actions presented.

Again, is this possible? Has someone already done this?


Many many thanks in advance to anyone who spends time reading this,
understands and can help...

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/Accessing-struts.xml-values-from-an-Action-tp21074738p21074738.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: Application based Security

2008-12-15 Thread Andy Law


Shekher wrote:
> 
> I am planing to use interceptor for this but not sure how to plan this
> 
> as using interceptor can not gurantee a robust authenticate mechanism
> what i planned is as below
> 
> if user provide the valid information store the user object in the session
> scoped map and for all incoming request to secure region check the user
> object in the session using the interceptor,but will that be a robust
> approach???
> 
> any suggestion for this
> 
> 

Only you can decide what is 'robust' in the light of the requirements of the
application that you are developing. Something that controls access to your
family's photo album probably requires less security robustness than a
banking or military application. But then, I guess you aren't developing a
military application (are you?).

Pretty much all web-based applications use session-based stuff to maintain
authentication state across requests. That's just how it works and it is
'robust' (for certain values of robust). There are all manner of things that
you can google to be told about vulnerabilities in the approach. Choose what
applies to your situation and defend against it.

Re Interceptors and actions. Again, you have to decide what route to take
and what the consequences will be if it goes wrong. For example, you can
choose to design your actions so they work independently of the Interceptor
and - if the configuration says that it is necessary - the Interceptor can
then 'intercept' the request and redirect if a requireed
authentication/authorisation is missing. If the application is run with an
incorrect configuration file, then Bad People (tm) will be able to run your
secure application actions. Alternatively, you can design your actions to
only run if they have been given the 'All Clear' from the interceptor. This
is more secure *provided* that you don't have your Action be given the all
clear via a 'SetXYZ()' routine (because that is trivial to circumvent with a
crafted URL).

You need to (a) know what your authorisation/authentication scope is, (b)
understand the way that Interceptors and Actions mesh together and (c)
design (and document) something that fits your needs. With struts2 - like
perl - there's more than one way to do things. Many of those things are
right, some of them are wrong. There is no *single* 'right' way to do things
though, that fits all situations.

Hope that gives you some ideas.

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/Application-based-Security-tp21010272p21014167.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: Application based Security

2008-12-15 Thread Andy Law


Shekher wrote:
> 
> Hi All,
> 
> We are developing an application based on Struts2 framework. We are on way
> to develop application based security so that the unauthorized user can
> not
> access the secure area,it needs the request to be from the authorized
> person.We can have the Below mentioed approach
> 
> 1) For Secure area the user must be logged in to the ysystem and have
> authorization for accessing that
> 2) For every request coming to the secured region, we need to put the
> check
> if the user is a valid one or not.
> 
> We cab think of the functionality which checks for the icoming request for
> its authentication and permits only authenticated request.
> 
> I need your suggestion about the approach we can follow in struts2 so that
> we can achieve the above mentioed points and also maintenance and
> enterprise
> integration will be area of concern.
> 
> IF any one have worked or working on similar area pleaes share his/her
> view
> how to achieve that here in struts2
> 
> Thanks in advance
> shekher
> 
> 

I think that you need to be looking at Interceptors. You can couple them as
tightly or as loosely to your Actions as you like. You can also build
systems using Interceptors that factor out the control of the authentication
and authorisation to completely separate code which makes integrating with
other enterprise systems a bit easier.

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/Application-based-Security-tp21010272p21012989.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: [S2] Does struts set null values for pojo fields?

2008-08-21 Thread Andy Law



Gawain Hammond wrote:
> 
> Thanks very much for your reply.
> 
> The problem with this type of work around is that it completely messes up
> my fiendish master plan. If it wasn't for those pesky objects with null
> values! :-P
> 
> You see, I've probably been a bit too clever for my own good, and for the
> first time I've created a single action, a single service, and single dao
> to persist objects submitted from multiple struts forms. I'm currently
> persisting about 20 domain objects this way, and this is the last issue I
> need to solve to get it all working as desired.
> 
> This issue is a pretty common occurrence in my domain model, so I'd have
> to write code to check for null values in many places for every domain
> object. I've been thinking this problem would be best solved either in the
> struts/view layer, or maybe the persistence layer. I'm spreading myself a
> bit thin trying to work it out at both ends at the same time :-)
> 
> 

Can you define an interface that is common across all the actions/model
objects. Then you can have the relevant Actions implement the interface and
write an interceptor to check the value of the specified fields and set them
to null if required after checking that the object is of the correct type
(i.e. it implements your interface)

Later,

Andy



-- 
View this message in context: 
http://www.nabble.com/-S2--Iterate-through-two-lists-tp19052842p19086980.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: paramsPrepareParams vs. staticParams

2008-08-03 Thread Andy Law


mgainty wrote:
> 
> 
> Andy-
> the short answer is you don't want 
> user-set parameters to override your static parameters.
> 
> 

Well yes - but I need the parameters for doing some prepare() work. I can
see that staticParams fires after params in the default stack. I can also
see that params is set to fire twice in the paramsPrepareParams stack and
that it fires after params. What I don't understand is why staticParams
doesn't fire twice in the struts-supplied pPP stack. Unless there is a
sensible design decision why it should not, I'm going to propose an RFE that
it should

Seems to me that the current set-up allows user-set params to overide my
static parameters if they are required in a prepare() which is just plain
wrong.


mgainty wrote:
> 
> btw for 2.1.1 you also need: "actionMappingParams"
> 
> 
> Which means your stack should be:
> 
> 
> 
> ...
> 
> 
> 
> 
> 
> 
> ...
> 
> 
> 
> ...
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> (courtesy of dale)
> http://www.nabble.com/about-paramsPrepareParamsStack-td15462644.html
> 
> Martin 
> 

Thanks. This is useful info and I missed the other thread when I searched
earlier. I'm disappointed to see that I will have to refactor stuff
(struts.xml) when I shift to 2.1.x when if they were included correctly
(IMHO) in the pPP stack that gets distributed, I wouldn't need to do that.


What's the procedure for requesting enhancements?

Later,

Andy

-- 
View this message in context: 
http://www.nabble.com/paramsPrepareParams-vs.-staticParams-tp18773842p18801209.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]



paramsPrepareParams vs. staticParams

2008-08-01 Thread Andy Law

Is there any design reason why staticParams is not called before prepare in
the paramsPrepareParams stack?

Also, in a potential RFE sort of vein, would there be any support for a
request for a way of making staticParams non-overwritable? (i.e. the params
defined in the action configuration XML and specified as non-mutable would
not be overwritten by clever folk sticking
'?paramname=value¶m2name=value2' at the end of any given URL)

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/paramsPrepareParams-vs.-staticParams-tp18773842p18773842.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: S2: possibly strange namespace use case

2008-07-31 Thread Andy Law


Jeromy Evans - Blue Sky Minds wrote:
> 
> 
> True. The Struts 2 in Action book goes into the next level detail:
> 
> http://www.manning.com/dbrown/excerpt_contents.html
> 
> but still doesn't cover exactly what you're trying to do.  I know others 
> works are in progress but not the details or schedules.
> 
> 

Thanks. I'll order that and see where it takes me (although it gets a
panning on Amazon UK - reviews on Amazon.com are more favourable).



Jeromy Evans - Blue Sky Minds wrote:
> 
> 
> You may need to delve into the source near the DefaultActionMapper and 
> ParametersInterceptor variations to understand how it ties together.
> 
> 

Already been there all morning :o}

Thanks a lot for all the advice and discussion. It's been really helpful.

I think that - for now - I'm going with a straightforward wild-card mapping
coupled with a single-set property in the Action which appears in my
empirical testing to guard against "form parameter over-riding" of the
property.

The down-side is the configuration overhead. My separate actions have
distinct results so, although I have a dozen actions that need to share this
behaviour, I have to configure them separately to do it. If I build it later
into an Interceptor then I will be able to just add that to the default
interceptor stack for a package/packages so I may take that route at a later
date.

I *think* that sounds sensible, but I've stared at too much code, struts
'documentation' and Netbeans screens over the past few days to be sure.

Later,

Andy
-- 
View this message in context: 
http://www.nabble.com/S2%3A-possibly-strange-namespace-use-case-tp18694697p18754927.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: S2: possibly strange namespace use case

2008-07-31 Thread Andy Law


Jeromy Evans - Blue Sky Minds wrote:
> 
> 
>> A short follow-up. Can you point me towards a description of where/when
>> the
>> Action object gets created and where Interceptors fit into the process.
>>
> 
> The architect's guide is a good place to start. 
> 
> http://struts.apache.org/2.0.11.2/docs/big-picture.html
> 
> There's nothing better than a good book though.
> 
> 

That's agreed!

What do you recommend? I have Kurniawan's "Struts 2 Design and Programming"
and Roughley's "Practical Apache Struts2 Web 2.0 projects" and "Starting
Struts 2". None of them go into any kind of detail about this section of
things (which is understandable since (a) it seems to be an edge case, (b)
it is a somewhat moving target and (c) the documentation on-line is 'less
than optimal')


Later,


Andy


-- 
View this message in context: 
http://www.nabble.com/S2%3A-possibly-strange-namespace-use-case-tp18694697p18750616.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: S2: possibly strange namespace use case

2008-07-30 Thread Andy Law


Jeromy Evans - Blue Sky Minds wrote:
> 
> Andy Law wrote:
>>
>> e.g.
>> /foo/Action1.action runs action1 passing in 'foo' and /bar/Action1.action
>> runs the same action passing in 'bar'.
>>
>> How should I code/configure/build this kind of thing.
>>   
> 
> 
> In Struts 2.0.x, you may be able to use wildcards in the namespace 
> depending on how many variations you need.
> 
> http://struts.apache.org/2.0.11.2/docs/wildcard-mappings.html
> 
> In Struts 2.0.x, you may also be able to use the RestfulActionMapper to 
> pass simple properties to your action through the path.
> 
> http://struts.apache.org/2.0.11.2/docs/restfulactionmapper.html
> 
> Use it with a CompositeActionMapper.
> 
> In Struts 2.1.x, use the NamedVariablePatternMatcher to pass parameters 
> through the namespace, as described in this thread:
> http://www.nabble.com/REST-plugin-URL-syntax-td17855192i20.html
> 


Jeromy,

That's enormously helpful - thanks.

A short follow-up. Can you point me towards a description of where/when the
Action object gets created and where Interceptors fit into the process.

I need to understand how I'm going to get the leading part of the URL into
the action object and my head really, really hurts right now... :o}. I'm
wondering if an interceptor might be a better, more understandable (to me)
option?

If I'm reading things right as of now, the ActionMapper route will fire (and
complete) before the Action object is created (since the ActionMapper
decides *which* Action gets created) so my options there are to put the
details of what I find in the URL path into the request object where it can
be pulled by the Action (which makes testing slightly harder), whereas an
Interceptor allows me to just magic the details into the Action. On the
other hand, the Interceptor requires a signature on the Action which could
be overruled with a Parameter in the URL?

Please tell me if I'm talking nonsense. I'm just kind of thinking out loud
while I try to get a feel for the best way to do what I need.


Later,

Andy Law

-- 
View this message in context: 
http://www.nabble.com/S2%3A-possibly-strange-namespace-use-case-tp18694697p18737366.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]



S2: possibly strange namespace use case

2008-07-28 Thread Andy Law

All,

I have a usecase that I can't find any docs for in the usual places. Of
course, it may just be that I'm not looking hard enough. However, I wonder
if anyone else has done this kind of thing.

My problem is this...

I have a series of actions that map to distinct urls ... /Action1.action,
/Action2.action etc. Each codes a wizard-style sub-application. The problem
is that I want to add in more information in the URL to the *left* of the
action url and be able to intercept and pass that information into my
actions

e.g.
/foo/Action1.action runs action1 passing in 'foo' and /bar/Action1.action
runs the same action passing in 'bar'.


How should I code/configure/build this kind of thing.


Thanks in advance for any guidance that anyone can give me.

Later,

Andy Law

-
-- 
View this message in context: 
http://www.nabble.com/S2%3A-possibly-strange-namespace-use-case-tp18694697p18694697.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: img source path constructed inside an iterate tag

2005-09-02 Thread andy law \(RI\)
Gareth,

Tragically, no. I will look into that as an option though. As you say, it is 
certainly more readable although it does *smell* like perl !

Later,

Andy

-
Yada, yada, yada...

The information contained in this e-mail (including any attachments) is 
confidential and is intended for the use of the addressee only.   The opinions 
expressed within this e-mail (including any attachments) are the opinions of 
the sender and do not necessarily constitute those of Roslin Institute 
(Edinburgh) ("the Institute") unless specifically stated by a sender who is 
duly authorised to do so on behalf of the Institute.


> -Original Message-
> From: Gareth Evans [mailto:[EMAIL PROTECTED]
> Sent: 02 September 2005 10:16
> To: Struts Users Mailing List
> Subject: Re: img source path constructed inside an iterate tag
> 
> 
> If your using the latest jsp spec (tomcat5) you could try to use:
> 
> 
>  alt="${element.name}">
>  href="/module/action-path/${element.accession}">${element.acce
> ssion}
> 
> 
> It's certainly a little tidier!
> 
> Regards,
> 
> Gareth
> 
> andy law (RI) wrote:
> > Frank,
> > 
> > As I said at the bottom of my email, I *know* I can do it 
> that way, but look at all those nested quotes - it's just 
> wrong to do stuff like that.
> > 
> > I can just about live with it for now with double quotes 
> for the HTML and singles for the embedded bean stuff i.e.
> > 
> > 
> > 
> > 
> >  property="accession"/>
> >
> > 
> > 
> > 
> > In my mind, the img tag needs a 'suffix' option where you 
> specify a bean and a property and it fills in the src url from that.
> > 
> > Does anybody actually use img tags with src values of the 
> form "abc/def?key=value" (which seems to be what the html:img 
> tag generates)
> > 
> > Thanks anyway
> > 
> > Later,
> > 
> > Andy
> > 
> > -
> > Yada, yada, yada...
> > 
> > The information contained in this e-mail (including any 
> attachments) is confidential and is intended for the use of 
> the addressee only.   The opinions expressed within this 
> e-mail (including any attachments) are the opinions of the 
> sender and do not necessarily constitute those of Roslin 
> Institute (Edinburgh) ("the Institute") unless specifically 
> stated by a sender who is duly authorised to do so on behalf 
> of the Institute.
> > 
> > 
> > 
> >>-Original Message-
> >>From: Otto, Frank [mailto:[EMAIL PROTECTED]
> >>Sent: 02 September 2005 09:52
> >>To: 'Struts Users Mailing List'
> >>Subject: AW: img source path constructed inside an iterate tag
> >>
> >>
> >>hi,
> >>
> >>you can do this in this way:
> >>
> >>
> >>
> >>" alt=" >>name="element" property="name"/>">
> >> >>property="accession"/>"> >>property="accession"/>
> >>   
> >>
> >>
> >>
> >>kind regards,
> >>
> >>frank
> >>
> >>
> >>>-Ursprüngliche Nachricht-
> >>>Von: andy law (RI) [mailto:[EMAIL PROTECTED]
> >>>Gesendet: Freitag, 2. September 2005 10:45
> >>>An: Struts Users Mailing List
> >>>Betreff: img source path constructed inside an iterate tag
> >>>
> >>>
> >>>All,
> >>>
> >>>This looks - at first sight - the place that I should be 
> >>>using a html:img tag, but now that I get down to it, I find 
> >>>that the html:img tag seems to be useful only for some 
> >>>obscure task that is beyond my limited comprehension. 
> >>>Obviously, I *am* an idiot, so once we have that out in the 
> >>>open please humour me.
> >>>
> >>>
> >>>I have a jsp that lists a set of items, each of which should 
> >>>have an icon, and a clickable link. Each item needs to be 
> >>>placed inside a row in a table. Thus, I have a bean that 
> >>>returns a list that can be iterated across using the 
> >>>logic:iterate tag.
> >>>
> >>>In side the iterate loop, I can get at the individual 
> >>>elements. Each of them is a bean and I can use bean:tags to 
> >>>get them to report their properties. So, for example I have 
> >>>code like the following:
> >>>
> >

RE: img source path constructed inside an iterate tag

2005-09-02 Thread andy law \(RI\)
Frank,

As I said at the bottom of my email, I *know* I can do it that way, but look at 
all those nested quotes - it's just wrong to do stuff like that.

I can just about live with it for now with double quotes for the HTML and 
singles for the embedded bean stuff i.e.





   



In my mind, the img tag needs a 'suffix' option where you specify a bean and a 
property and it fills in the src url from that.

Does anybody actually use img tags with src values of the form 
"abc/def?key=value" (which seems to be what the html:img tag generates)

Thanks anyway

Later,

Andy

-
Yada, yada, yada...

The information contained in this e-mail (including any attachments) is 
confidential and is intended for the use of the addressee only.   The opinions 
expressed within this e-mail (including any attachments) are the opinions of 
the sender and do not necessarily constitute those of Roslin Institute 
(Edinburgh) ("the Institute") unless specifically stated by a sender who is 
duly authorised to do so on behalf of the Institute.


> -Original Message-
> From: Otto, Frank [mailto:[EMAIL PROTECTED]
> Sent: 02 September 2005 09:52
> To: 'Struts Users Mailing List'
> Subject: AW: img source path constructed inside an iterate tag
> 
> 
> hi,
> 
> you can do this in this way:
> 
> 
> 
>   " alt=" name="element" property="name"/>">
>property="accession"/>"> property="accession"/>
>
> 
> 
> 
> kind regards,
> 
> frank
> 
> > -Ursprüngliche Nachricht-
> > Von: andy law (RI) [mailto:[EMAIL PROTECTED]
> > Gesendet: Freitag, 2. September 2005 10:45
> > An: Struts Users Mailing List
> > Betreff: img source path constructed inside an iterate tag
> > 
> > 
> > All,
> > 
> > This looks - at first sight - the place that I should be 
> > using a html:img tag, but now that I get down to it, I find 
> > that the html:img tag seems to be useful only for some 
> > obscure task that is beyond my limited comprehension. 
> > Obviously, I *am* an idiot, so once we have that out in the 
> > open please humour me.
> > 
> > 
> > I have a jsp that lists a set of items, each of which should 
> > have an icon, and a clickable link. Each item needs to be 
> > placed inside a row in a table. Thus, I have a bean that 
> > returns a list that can be iterated across using the 
> > logic:iterate tag.
> > 
> > In side the iterate loop, I can get at the individual 
> > elements. Each of them is a bean and I can use bean:tags to 
> > get them to report their properties. So, for example I have 
> > code like the following:
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > which gives me something that looks like:
> > 
> > name1   gif1.gif   abc123
> > name2   gif96.gif  abc987
> > 
> > etc.
> > 
> > 
> > What I *want* to generate is something that looks like:
> > 
> >  > href="/module/action-path/abc123">abc123
> >  > href="/module/action-path/abc987">abc987
> > 
> > 
> > i.e. generate the img and link tags dynamically using 
> > properties of the bean 'element'.
> > 
> > It seems to me from reading the docs and beating my head 
> > against the screen all day yesterday that the struts :img and 
> > :link tags don't look at beans in block or page scope inside 
> > logic:iterate tags, restricting their functionality instead 
> > to pulling name/value pairs from the request or from a Map 
> > object. Presumably they then just add those to the tail of 
> > the request ala /path/to/action?key=value (which is 
> > occasionally useful in a link, but less so in an img tag IMO).
> > 
> > So, my questions are (for those brave souls who made it this far)
> > 
> > 1) Am I doing this the 'right' way?
> > 2) Am I missing something?
> > 3) What is the path of least resistance for me to follow?
> > 4) How useful would an addition to the struts tag 
> > functionality to do this sort of thing be? (I will write it 
> > if I have to)
> > 
> > 
> > FWIW, I *know* that I can build an img tag and a link 
> > dynamically using a combination of html and  tags 
> > in the JSP, but I'm going blind working out where to use 
> > single and double quotes to keep all the tools involved comfortable.
> > 
> > 
> > Thanks in advance for your sug

img source path constructed inside an iterate tag

2005-09-02 Thread andy law \(RI\)
All,

This looks - at first sight - the place that I should be using a html:img tag, 
but now that I get down to it, I find that the html:img tag seems to be useful 
only for some obscure task that is beyond my limited comprehension. Obviously, 
I *am* an idiot, so once we have that out in the open please humour me.


I have a jsp that lists a set of items, each of which should have an icon, and 
a clickable link. Each item needs to be placed inside a row in a table. Thus, I 
have a bean that returns a list that can be iterated across using the 
logic:iterate tag.

In side the iterate loop, I can get at the individual elements. Each of them is 
a bean and I can use bean:tags to get them to report their properties. So, for 
example I have code like the following:









which gives me something that looks like:

name1   gif1.gif   abc123
name2   gif96.gif  abc987

etc.


What I *want* to generate is something that looks like:

abc123
abc987


i.e. generate the img and link tags dynamically using properties of the bean 
'element'.

It seems to me from reading the docs and beating my head against the screen all 
day yesterday that the struts :img and :link tags don't look at beans in block 
or page scope inside logic:iterate tags, restricting their functionality 
instead to pulling name/value pairs from the request or from a Map object. 
Presumably they then just add those to the tail of the request ala 
/path/to/action?key=value (which is occasionally useful in a link, but less so 
in an img tag IMO).

So, my questions are (for those brave souls who made it this far)

1) Am I doing this the 'right' way?
2) Am I missing something?
3) What is the path of least resistance for me to follow?
4) How useful would an addition to the struts tag functionality to do this sort 
of thing be? (I will write it if I have to)


FWIW, I *know* that I can build an img tag and a link dynamically using a 
combination of html and  tags in the JSP, but I'm going blind 
working out where to use single and double quotes to keep all the tools 
involved comfortable.


Thanks in advance for your suggestions and help.

Later,

Andy

-
Dr. Andy Law

Head of Bioinformatics - Roslin Institute

Unfortunately, legal niceties require me to add the following to this message...

The information contained in this e-mail (including any attachments) is 
confidential and is intended for the use of the addressee only.   The opinions 
expressed within this e-mail (including any attachments) are the opinions of 
the sender and do not necessarily constitute those of Roslin Institute 
(Edinburgh) ("the Institute") unless specifically stated by a sender who is 
duly authorised to do so on behalf of the Institute.
 

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