Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

Remove scriptlets from JSP

Thread view: 
stephenfu1@gmail.com - 14 Nov 2005 11:21 GMT
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>


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.