Possibly Stupid Question

2001-01-05 Thread James Howe

I want to generate a link tag for a page which takes three parameters.  The 
values of the parameter come from a bean which is available to the 
page.  The end result should look something like this:

a href="foo.do?parm1=val1parm2=val2parm3=val3"Link/a

The values for val1, val2 and val3 come from a bean which happens to be the 
current bean for an iterate tag.  In other words, I'm going to have a table 
of items and each cell in the table is going to have unique values for the 
parameters.

What is the easiest way to do this using struts?  I've used the form:link 
tag before, but I think I can only pass one parameter with this tag.  I've 
tried using snippets of java code ("%= bean.getFoo() %" for example) but 
this code ended up being quite verbose because I had to cast "bean" to the 
proper type before I could call "getFoo()".  I'm thinking there must be a 
cleaner way to handle this situation.  The only other way I've thought 
about would be to have the bean answer an "optionsString" as one of its 
properties, but I would rather not have that code in my bean.

Thanks for any suggestions.




Re: Possibly Stupid Question

2001-01-05 Thread Craig R. McClanahan

James Howe wrote:

 I want to generate a link tag for a page which takes three parameters.  The
 values of the parameter come from a bean which is available to the
 page.  The end result should look something like this:

 a href="foo.do?parm1=val1parm2=val2parm3=val3"Link/a

 The values for val1, val2 and val3 come from a bean which happens to be the
 current bean for an iterate tag.  In other words, I'm going to have a table
 of items and each cell in the table is going to have unique values for the
 parameters.

 What is the easiest way to do this using struts?  I've used the form:link
 tag before, but I think I can only pass one parameter with this tag.  I've
 tried using snippets of java code ("%= bean.getFoo() %" for example) but
 this code ended up being quite verbose because I had to cast "bean" to the
 proper type before I could call "getFoo()".  I'm thinking there must be a
 cleaner way to handle this situation.  The only other way I've thought
 about would be to have the bean answer an "optionsString" as one of its
 properties, but I would rather not have that code in my bean.



The Struts 1.0 version of the form:link tag lets you use the "name" (or "name"
and "property") attributes to identify a Map that contains request parameters to
be added to the end of the request URI.  You might find it useful for this
purpose.


 Thanks for any suggestions.

Craig





Possibly Stupid Question

2001-01-05 Thread James Howe

I want to generate a link tag for a page which takes three parameters.  The 
values of the parameter come from a bean which is available to the 
page.  The end result should look something like this:

a href="foo.do?parm1=val1parm2=val2parm3=val3"Link/a

The values for val1, val2 and val3 come from a bean which happens to be the 
current bean for an iterate tag.  In other words, I'm going to have a table 
of items and each cell in the table is going to have unique values for the 
parameters.

What is the easiest way to do this using struts?  I've used the form:link 
tag before, but I think I can only pass one parameter with this tag.  I've 
tried using snippets of java code ("%= bean.getFoo() %" for example) but 
this code ended up being quite verbose because I had to cast "bean" to the 
proper type before I could call "getFoo()".  I'm thinking there must be a 
cleaner way to handle this situation.  The only other way I've thought 
about would be to have the bean answer an "optionsString" as one of its 
properties, but I would rather not have that code in my bean.

Thanks for any suggestions.