Since my summer article on java.net I developed a different approach
to page-embeddable Struts components. Now I can create them working on
any SRV2.3/JSP1.2 compatible container including Tomcat 4.x and Tomcat
5.x.

Important: this is not an Ajax approach. Despite that the
Redirect-after-Post pattern which I am using to implement the
embeddable components is less relevant for ajaxified applications, it
still makes a lot of sense for applications that do not use
client-side scripting. Also, this approach can be easily combined with
Ajax flavor where the component returns bare HTML chunk as modified
view instead of fancy XML. Author of Simple Web Framework calls this
approach In-Place Updating (IPU). I don't like how abbreviation
sounds, but I like expanded name ;-)

Check out live sample, which shows MailReader implemented with new
component technique: http://www.superinterface.com/mailreadercmp (Only
home page is of interest).

What you see is a page with an HTML table. The table contains three
cells. Left-top cell corresponds to default view for the home page,
and contains welcome/main menu. Nothing interesting there, just a menu
which displays links relevant to user's state.

The other two cells are of more interest. The right cell embeds login
component, the left-bottom cell embeds locale component.

Use "user"/"pass" to log in, or create a new user if someone changed
the password. See how the page reloads and other components change
their presentation. Also try Back, Forward and Refresh buttons.

Note that input is submitted to components *directly*. Request is not
routed through Home action. Components are built in a way that they
can be embedded into a page, but they do not know at design time which
page they will be embedded into. They are informed about their parent
page at runtime.

So, the home page is kind of a simple portal page, but without portlet
engine and portlet API.

Components, once developed, can be inserted into any page with a
simple <jsp:include> tag.

The home page looks like this:
------------------------------

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://struts.apache.org/tags-bean"; prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic"; prefix="logic" %>

<html>
  <head>
    <html:base/>
  </head>

  <body>
  <h3>MailReader Home Page</h3>

  <table border="1">
  <tr>

  <!-- State-sensitive Main Menu goes here -->
  <td>
    ...
  </td>

  <!-- This is login component -->
  <td rowspan="2">
    <jsp:include page="loginComponent.jsp"/>
  </td>

  </tr>

  <tr>

  <!-- This is locale component -->
  <td>
  <jsp:include page="localeComponent.jsp" flush="false">
    <jsp:param name="DIALOG-PARENT-LOCATION" value="HomeAggregate.do"/>
  </jsp:include>
  </td>

  </tr>
  </table>

</body>
</html>
=== cut here ===

The live site and source code presented here is a preview before I
release the code for next version of Struts Dialogs. Hopefully, this
preview will start further discussion. Is there interest in such
approach?

Michael.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to