struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Villalba Arias, Fredy [BILBOMATICA]" <fvilla...@mailext.com>
Subject Struts and Pajes
Date Tue, 03 Feb 2004 16:51:58 GMT
Hi to y’all,

 

I’m trying to integrate Pajes (www.apache.org), a Servlet Presentation Framework, with Struts.
The idea is to use Struts’ MVC separation (Action, ActionForms, ActionServlet, etc…) WITHOUT
using Struts’ presentation tools (i.e. no JSP, ergo no JSP Tags), just plain XHTML templates
(in conjunction with the Pajes framework I just mentioned).

 

I’m not interested in an XSLT-based solution (for now).

 

The problem I’ve come across:

 

For connecting with Pajes, I’ve thought about a Servlet (kind of a “View” Dispatcher)
that should be the “entry point” to all Pajes-related requests. Then, one would do things
like this:

 

package org.gn.samples.strutspajes.login;

 

…

 

public class MyFirstAction extends Action {

 

  public ActionForward execute(ActionMapping actionMapping…) {

    MyFirstActionForm theActionForm = (LoginActionForm) actionForm;

    if (…) {

      return actionMapping.findForward("/some_other_typically_mapped_page");

    } else {

      …

      ActionForward af = new PajeViewActionForwardFactory.generate("fully.qualified.view.generator.pajes.classname”,
"theTemplateFilename.html", request);

      return af;

    }

  }

}

 

… where the generated ActionForward object points to the aforementioned Servlet, including
on that URL the corresponding parameters. Examples:

 

“/PajeDispatcher?template=Login.html&factory=org.gn.samples.strutspajes.login.LoginPageView"
(in case this is the default web application)

 

“/webappname/PajeDispatcher?template=ProductCatalog.html&factory=org.gn.samples.strutspajes.login.NavigateProductCatalogPageView"
(in case this is not the default web application and the name is “webappname”)

 

This solves the problem of “delegating” from Struts to Pajes.

 

HOWEVER, I have not solved yet the data access method part. I NEED TO BE ABLE TO RECOVER THE
APPROPRIATE ActionForm object FROM THAT Servlet (actually, in a factory class, but I don’t
want to bother you with all the details) so that the view-generating class can “paint”,
WITHOUT REPLICATING THE ActionForm Management (especially, the scopes management) ALREADY
PERFORMED BY Struts. HOW CAN I DO THAT???

 

(1)     Is there some method (+ class) that, given an Action class (/classname), returns the
ActionForm object its currently associated to? (if any)

(2)     What’s the minimal information that one needs to retrieve an Action’s corresponding
ActionForm object?

(3)     How can I do it from an ordinary Servlet?

 

Note that I’m trying to avoid passing it through the Session. My initial idea was to take
advantage of the classes behind the tag libs that do this, but from what I’ve seen so far
(I mean, its source code), that is not possible (the code is too tied to a JSP environment).

 

This is my first “effort”. Therefore, I’m not worried about being able to do EVERYTHING
that can be done through the tag libs. For now, the only thing I look forward is to be able
to recover the appropriate ActionForm object associated to that Action from where redirection
took place (ActionForward, that is).

 

I’d really appreciate any thoughts on this matter.

 

Thanx,

Freddy.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message