× 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.


  • Subject: RE: beans and JSPs and stuff...
  • From: "Stone, Brad V (TC)" <bvstone@xxxxxxxxxxxxxx>
  • Date: Tue, 27 Feb 2001 13:03:26 -0600

> >No they don't!  Not if you're using stylesheets and SSI.  
> Then you can just
> >change HTML files just as you would JSPs.  Move the SSI 
> include around on
> >the page and it moves the dynamic content.  Change the 
> stylesheet to change
> >the look. 
> ----------
> Not if there's any HTML in the SSI, Brad.  Unless the SSI is 
> returning pure data, there is some formatting.  

Stylesheets, XML, whatever you want to use to change the look and feel.
Nothing returns "pure data" in the sense you are talking about.

Now, if 
> you've done some VERY astute programming in your SSI and it 
> uses inline styles that are defined by the style sheet, then 
> you may be able to get around some of the problem.  

Finally, you see the term "stylesheet" that I've been using all along.

Or if 
> your SSI accepts style parameters.  In that case, an SSI as 
> you've presented it can indeed act a lot like a JSP widget.  
> But that's a lot of programming.

JSP doesn't magically make coding go away.  The coding has to be done
somewhere.  It's not a lot of coding.  

> 
> Here's an example.  To establish an editable table on my JSP, 
> I do the following:
> 
> Servlet:
> --------
> ServerFactory factory = new ServerFactory();
> Server server = factory.getServer("SERVERID");
> DataTable table = new DataTable(server);
> table.load();
> session.putValue("widget", new DataTableWidget(table));
> 
> JSP:
> ----
> <HTML>
> <HEAD><TITLE>My Data Table</TITLE></HEAD>
> <BEAN name="widget" type="DataTableWidget"></BEAN>
> <BODY>
> <%= widget %>
> </BODY>
> </HTML>
> 
> That's it.  But, let's say I want a new style.  I do 
> something like this before displaying the widget:
> 
> <% widget.setStyle(TABLESTYLE); %>
> 
> The widget now will use the style TABLESTYLE, which I can 
> define in my style sheet.
> 
> How would you do it with an SSI?  How would you define the 
> fonts in your headings?  Or the fact that you want errors to 
> appear as white letters on a read background?  With an 
> object-based language like Java, I have much more flexibility 
> in adding methods as required to extend the capabilities of 
> my widgets and expose those methods to the JSP designer.  How 
> will you do the same thing with an SSI?

I assign classes (for the 100th time).  Then the stylesheet defines what
font, background, type size, etc. are used.  If it's an error, my CGI
program knows that and gives it a different class while it's writing it out,
therefore displaying it differently.  

> 
> 
> 
> >> The only way around this is to write a CGI program that in 
> >> essence reads a specialized HTML page and plugs in your 
> >> dynamic content wherever it's needed.
> -------
> >No it's not Joe.  I know I show my ignorance with Java and 
> OO often, but
> >this statement tells me that you probably haven't done quite 
> as much CGI
> >programming as I.  But then again, that's your "argument" 
> for JSPs.  You
> >don't need to.  But, still, my point stays.  
> -------
> Okay, show me how to do what I just did with an SSI.  Then we 
> can give the list readers two different approaches.  In fact, 
> I would go so far as to say we ought to build a library of 
> these things.  I'd be happy to host them on Java400.net as 
> soon as I get it running on my AS/400.

<HTML>
<HEAD><TITLE>My Data Table</TITLE></HEAD>
<BODY>
<!--#exec cgi="/cgi-bin/mycgipgm"-->
</BODY>
</HTML>

mycgipgm reads data, any env. vars it needs to decide what styles to apply,
and reads a database and outputs a table.  Same as your widget, or the code
behind it.

Stylesheet defines font, color, style, etc of the classes.  Pretty simple
actually.  If you want to change styles between pages, you can set the
stylesheet location accordingly.

This is basic web knowledge, you just have to know how to make your CGI
program output the correct data.  Just like your widget output a table with
data in it and specify the styles you want, my CGI program does the same.

CGI is CGI is CGI.  Somewhere down the line you have to have something
outputting dynamic HTML.  Because it's hidden in a widget does not mean it
isn't there.  And as you can see from our examples, we simply have a spot in
our HTML that is "replaced" by dynamically generated HTML.  It's all the
same in the end.

Brad
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.