×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
"gotten us as close to MVC as possible"
Probably the "us" is the important qualifier here Joe. I have seen
plenty of jsp and other code over the past couple of years and every
implementation is different. Some are more MVC, some are less. That
probably reflects the skills and previous programming orientation of the
programmer.
Me, I am a "seat of the pants" programmer who basically grew up on RPG
(and probably more VB and .asp than I care to admit to...) But, what I
REALLY liked about the first interactive RPG program I wrote was that
there was this "magic" built into the structure. If I had a file with
three fields, FLDA and FLDB and FLDC and I wanted to read and write that
to a screen all I needed to do in SDA was to have a screen format that
had the same field names and characteristics and, viola! Done! I read
the file format, write the screen format, then read the screen format
and write to the file. (I THINK that is the correct sequence). All the
data movement intricacies were taken care of (yeah, lots of editing
needed to be done, but I learned some of that the hard way...)
In any case, when I decided to move to HTML I looked for something that
worked the same way. I wanted to retrieve the screen format (HTML),
retrieve the data and write the whole thing out and FreeMarker was the
first thing I tripped across that did that. I didn't have to worry
about much on the client side, HTML or otherwise. No taglib references,
no other components to worry about. The server does the heavy lifting
and sends out the HTML. You're right, Freemarker isn't smart about HTML
at all, it just slavishly reads the HTML template, replaces the field
"markers" with data and outputs it. At that point the output is sent it
to the HTTP server. You could just as easily output to a report in PDF
if you wanted to. It is just a templating tool.
I really liked the simplicity though: Just an HTML template to mark up
(like my SDA example). Just expose the data to the HTML form. Output
the result.
OK. That is a simple explanation. I know that JSP's do something
similar and, when properly implemented, can actually be maintained over
time. With FM I can have a web designer design the page without any
knowledge of how it will be used by the server. I can replace the text
fields with my field markers that refer to the servlet data and it is
ready for Freemarker. Again, that is greatly simplified but it matches
the model I am familiar with.
If I have learned anything over the years, regardless of the "right
solution", one programmer's delight is another one's nemesis. Variety
is the spice of life.
Pete
Joe Pluta wrote:
I find this statement interesting, Pete. Why do you consider FreeMarker
more MVC than JSP? With a properly written JSP, all the model
information is passed via beans, and the JSP simply displays them. Why
is this less MVC than FreeMarker? FreeMarker is just a text generator,
sort of like XSLT, and as such isn't very smart about things like HTML.
You have to actually embed your HTML code in the FreeMarker template,
which makes it roughly equivalent to a JSP (except interpreted).
Joe
From: Pete Helgren
JSP's kind of
muddy the waters between client side and server side so perhaps there
is
a way with JSP's to do this.
I am by no means an experienced .jsp programmer. We moved to
FreeMarker
so we could avoid JSP's. Freemarker, being a server side engine has
gotten us a close to MVC as possible....but I am digressing here.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.