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 / First Aid / September 2005

Tip: Looking for answers? Try searching our database.

J2EE template

Thread view: 
www.douglassdavis.com - 12 Sep 2005 06:25 GMT
All the examples I see for servlets use a PrintWriter to write out an
HTML page.  This seems rather tedious.  Is there a way in the J2EE
specification that I could use to create an html template, and then use
the servlet to just "fill in the blanks" of the template?
Roedy Green - 12 Sep 2005 06:30 GMT
>All the examples I see for servlets use a PrintWriter to write out an
>HTML page.  This seems rather tedious.  Is there a way in the J2EE
>specification that I could use to create an html template, and then use
>the servlet to just "fill in the blanks" of the template?

That is a rough description of JSP.  See
http://mindprod.com/jgloss/jsp.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

http://www.douglassdavis.com - 12 Sep 2005 06:53 GMT
> >All the examples I see for servlets use a PrintWriter to write out an
> >HTML page.  This seems rather tedious.  Is there a way in the J2EE
[quoted text clipped - 3 lines]
> That is a rough description of JSP.  See
> http://mindprod.com/jgloss/jsp.html

okay... cool, I'll check that out.

What about something that can be done similar to smarty.php.net?  For
instance, if i wanted to -totally separate- the display part from the
business logic, I could use a template, and fill in the blanks.  When I
want a new look, I can just change templates.

Also, I don't have to worry at all about any HTML when programming the
logic.
Jon Martin Solaas - 12 Sep 2005 12:05 GMT
> okay... cool, I'll check that out.
>
[quoted text clipped - 5 lines]
> Also, I don't have to worry at all about any HTML when programming the
> logic.

Oh boy does that exist... There are incredibly many frameworks that can
handle this for you in various ways. Most are additions to J2EE, ie.
they are implemented on top of servlets (or jsp), but Java Server Faces
is *part* of J2EE itself. Struts is the "defacto standard", but lots of
others exist. Some template-oriented, some component/event-oriented etc.
Most implement the MVC pattern. You really should spend some time
evaluating some of the more common technologies to pick one that suits
your needs.

Signature

Jon Martin Solaas

Malte - 12 Sep 2005 15:27 GMT
You can go grossly overboard and make sure all your data is xml. Then
just apply your xsl and you're OK. I have done that for 4-5 projects.
Thomas Hawtin - 12 Sep 2005 18:20 GMT
>>>All the examples I see for servlets use a PrintWriter to write out an
>>>HTML page.  This seems rather tedious.  Is there a way in the J2EE
>>>specification that I could use to create an html template, and then use
>>>the servlet to just "fill in the blanks" of the template?

IMO, serlets are introduced badly (see server-side programming is just
the same as GUI). generally it's a bad idea to use servlets as
templates. Use them as a wrapper to decode and kick off operations from
the request and then forward onto a dynamically determined JSP.

It would help if JSPs were introduced before Servlets. It's rather
easier to do Hello World in a JSP.

>>That is a rough description of JSP.  See
>>http://mindprod.com/jgloss/jsp.html

> What about something that can be done similar to smarty.php.net?  For
> instance, if i wanted to -totally separate- the display part from the
> business logic, I could use a template, and fill in the blanks.  When I
> want a new look, I can just change templates.

See also JSTL. having a quick look at that site, it even looks quite
similar, superficially. JSTL uses tags, which you can write yourself,
although I would suggest you start with just JSTL and scriptlets where
necessary (scriptlets are embedded fragments of Java code).

Tom Hawtin

[Followup-to: comp.lang.java.help]
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

Bryce - 13 Sep 2005 16:31 GMT
>>>>All the examples I see for servlets use a PrintWriter to write out an
>>>>HTML page.  This seems rather tedious.  Is there a way in the J2EE
[quoted text clipped - 8 lines]
>It would help if JSPs were introduced before Servlets. It's rather
>easier to do Hello World in a JSP.

Servlets and JSPs approach different problems. JSPs are great for
implementing your presentation (HTML) stuff, but horrible for building
logic. Servlets on the other had, are good for programming logic (or,
as I always do, delegating to another class to do logic).

Servlet will get the data, save in session or request, then dispatch
to a JSP.. Works great for me

>>>That is a rough description of JSP.  See
>>>http://mindprod.com/jgloss/jsp.html
[quoted text clipped - 12 lines]
>
>[Followup-to: comp.lang.java.help]

--
now with more cowbell
Bryce - 12 Sep 2005 15:45 GMT
>All the examples I see for servlets use a PrintWriter to write out an
>HTML page.  This seems rather tedious.  Is there a way in the J2EE
>specification that I could use to create an html template, and then use
>the servlet to just "fill in the blanks" of the template?

JSPs
Velocity

Just to name 2.

--
now with more cowbell


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.