Hi Ted,

what if I wrote a HOW-TO on creating Struts/JSP web components? Not
standalone ones that can be created with Struts Dialogs, but real page
fragments, that are created using bare JSP, five or so tags and any
action framework like Struts or WebWork?

I started up a new project on SourceForge, called JSP Controls. This
is basically a further improvement on ideas of Struts Dialogs. The
deficiencies of current servlet spec forced me to handle input and
output on a JSP page, basically creating a sort of view helper thing.
The best feature is that a component is fully independent of page it
is contained in, and can work both in in-place update mode (Ajax mode
or, some may say, AHAH mode, whatever) as well as in standard
synchronous mode using good old redirection.

I started moving some stuff from Struts Dialogs to JSP Controls, and a
new project is simpler and more powerful. I think demo while not
looking terribly mindblowing, shows the features:
http://www.superinterface.com/jspcontrols/index.html

This is how the source code for login component looks like:

=== cut here ===
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/lib/jspcontrols.tld" prefix="jc" %>
<span id="LoginComponent">

  <%-- Accept phase --%>

  <jc:accept>
    <jc:handler event="login">
      <jsp:include page="/login.do" />
    </jc:handler>
    <jc:handler event="logout">
      <jsp:include page="/logout.do" />
    </jc:handler>
    <jc:reload/>
  </jc:accept>

  <%-- Render phase --%>

  <jc:prerender> ... </jc:prerender>
  <jc:render view="notloggedin"> ... </jc:render>
  <jc:render view="loggedin"> ... </jc:render>
</span>
=== cut here ===

The sample above uses simple Actions, but dispatching action also can be used.

The Mini Blogger uses Ajax mode if possible for Comment Component,
when you click on "Add Comment" or "Cancel". If you submit a comment,
it uses full page reload, but composite page knows nothing about what
happened. Login Component uses page reload because I needed to update
Admin Component *after* I changed the user status, so doing this in
Ajax mode did not ensure proper sequencing. I am working on that. The
login/password for admin mode is "user"/"password" like in MailReader.

I am going to rewrite MailReader using this page fragment technology,
should look really cool.

Michael.

On 1/2/06, Ted Husted <[EMAIL PROTECTED]> wrote:
> I updated the page to mention the common technique of using BeanUtils
> and to cite the links Michael suggested in a prior thread.
>
> Of course, data conversion and formatting between the presentation and
> business tiers is a rich topic, and more could be said here. Patches
> welcome. We could also extend the new Cookbook application to include
> more data conversion and formatting examples.
>
> -Ted.
>
> On 1/2/06, Marky Goldstein <[EMAIL PROTECTED]> wrote:
> > http://struts.apache.org/struts-action/faqs/actionForm.html
> >
> > This example should show the example fields of type
> > - date
> > - etc.
> > as well...
> >
> > (more complex data types used in java applications).
> >
> > This is still a gap in the Struts 1.3 documentation...
> >
> > Can we extend the documentation on how you
> > handle HTML/JSP and ActionForm / POJOs to use
> > ALL the java data types?
> >
> > Any comment on this?
> > Thanks,
> > Best regards,
> > Marky
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to