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 / Tools / May 2004

Tip: Looking for answers? Try searching our database.

Custom tags question

Thread view: 
Amy Johnson - 10 May 2004 21:35 GMT
I have an web application that displays the results of a database query.
I think the way to set it up is to have a JSP that utilizes a servlet to
do the query, then displays the results using custom tags. Does this
sound right?

Thanks,

Amy
John C. Bollinger - 10 May 2004 23:08 GMT
> I have an web application that displays the results of a database query.
> I think the way to set it up is to have a JSP that utilizes a servlet to
> do the query, then displays the results using custom tags. Does this
> sound right?

It sounds as if you are thinking of invocation of the servlet as similar
to a method call.  This is not correct.  Also, how or whether you use
custom tags is a function of the tag libraries you have or are prepared
to write.

There are two different, fairly common paradigms that sound like they
might be applicable:

1) A servlet performs the database lookup and displays the results via a
JSP (with or without presentation-oriented custom tags).  The servlet,
not the JSP, is the principal actor here, and JSP is best invoked by
forwarding the request to it (as opposed to via an HTTP redirect).

2) A JSP uses data retrieval custom tags to perform the database lookup,
and presents the results either directly or with the aid of
presentation-oriented custom tags.  The JSP is the principal actor here,
and there is no pure servlet involved.

Those are mutually exclusive alternatives, either one of which might
suit you (but not both together).  They are by no means the only
alternatives, but in my opinion they are the best options for most
situations.

John Bollinger
jobollin@indiana.edu
Amy Johnson - 11 May 2004 00:23 GMT
I had sort of figured that out after I posted the question. So good. I'm
on the right track. Are there any differences in terms of why one would
use one option over the other? It seems that it's just a matter of
personal preference. Is that the case?

thanks very much -

Amy

>> I have an web application that displays the results of a database
>> query. I think the way to set it up is to have a JSP that utilizes a
[quoted text clipped - 26 lines]
> John Bollinger
> jobollin@indiana.edu
John C. Bollinger - 11 May 2004 14:35 GMT
> I had sort of figured that out after I posted the question. So good. I'm
> on the right track. Are there any differences in terms of why one would
> use one option over the other? It seems that it's just a matter of
> personal preference. Is that the case?

There is some degree of personal preferrence involved.  On the other
hand, the servlet solution is often preferrable when there are data
processing requirements above and beyond simple data retrieval.  You'll
get more out of custom tags if they're reusable in multiple JSPs -- if
you are planning them to support just one, in just one project, then you
would probably end up doing a lot more work than is really necessary.
Either way can be made to work; after all, JSP is just a convenient way
to write a presentation-heavy servlet.

John Bollinger
jobollin@indiana.edu

>>> I have an web application that displays the results of a database
>>> query. I think the way to set it up is to have a JSP that utilizes a
[quoted text clipped - 27 lines]
>> John Bollinger
>> jobollin@indiana.edu
Amy Johnson - 11 May 2004 16:40 GMT
Well, that's what I have - a presentation heavy servlet. Thanks for the
info.

Amy

>> I had sort of figured that out after I posted the question. So good.
>> I'm on the right track. Are there any differences in terms of why one
[quoted text clipped - 44 lines]
>>> John Bollinger
>>> jobollin@indiana.edu


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.