Hi
In my JSP i have some scriptet code that defines the method
display(ArrayList a, String s)
and is called using
<%=display(personDetails.getList1, "List 1")%>
<%=display(personDetails.getList2, "List 2")%>
This method performs some checks on the ArrayList and writes some html
code and text to the screen.
I'd like to clean up the code (using Struts) and move this method into
a separate helper class
Is there a variation on <bean:write name="personDetails"
property="display"/> that i can use to call display(ArrayList a, String
s). I need to be able to pass in the arguments (to output p.getList1
and p.getList2 and perform some other logic)
Thanks for any help
Andrew Thompson - 14 Nov 2005 11:30 GMT
...
> Thanks for any help
It helps to ask a question.
..and if the question is 'how do I do the above?',
expect a lot of 'buy a book' type answers.
This group is a dicsussion group that can be good for
specific answers to specific technical questions, but
not so much for tutoring.
Darren - 14 Nov 2005 14:41 GMT
> ...
> > Thanks for any help
>
> It helps to ask a question.
Is there a variation on <bean:write name="personDetails"
property="display"/> that i can use to call display(ArrayList a, String
s).
reads like a question to me despite the lack of a question mark.
> ..and if the question is 'how do I do the above?',
> expect a lot of 'buy a book' type answers.
>
> This group is a dicsussion group that can be good for
> specific answers to specific technical questions, but
> not so much for tutoring.
Andrew Thompson - 14 Nov 2005 14:59 GMT
>>...
>>
[quoted text clipped - 7 lines]
>
> reads like a question to me despite the lack of a question mark.
I did not jump out as a question to me as someone *scanning*
for the mark that denotes a question.
But now you point it out. OK - it is a question for all
but the '?'. I missed it.
Darren - 15 Nov 2005 00:25 GMT
> >>...
> >>
[quoted text clipped - 13 lines]
> But now you point it out. OK - it is a question for all
> but the '?'. I missed it.
No worries mate, we've all done it. :)
Robert Klemme - 14 Nov 2005 13:05 GMT
> Hi
>
[quoted text clipped - 15 lines]
> String s). I need to be able to pass in the arguments (to output
> p.getList1 and p.getList2 and perform some other logic)
Not that I know of. In this case I'd rather write a custom tag that does
the transformation you need. An alternative approach could be to use
include to call another servlet / JSP that carries your helper code. If
it's a JSP and you're on Tomcat 5 or newer you might be able to do it with
the new expression language. But from the little info I have a custom tag
seems more appropriate.
Kind regards
robert
Tim B - 15 Nov 2005 02:22 GMT
> Hi
>
[quoted text clipped - 17 lines]
>
> Thanks for any help
you could just import the helper class and still use an expression
<%=MyHelperClass.display(personDetails.getList1, "List 1")%>
or if the 'some other logic' you have in you display method is simple
enough, you might be able to replace it with Struts logic tags, such as
<logic:iterate> and <logic:equal>