struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David G. Friedman" <>
Subject RE: [Tiles] Action class to retrieve list and send to tile
Date Wed, 22 Dec 2004 19:46:41 GMT

Have you tried adding redirect="false" on your <forward..> elements?  This
will make sure all action chaining stays within the request and DOES NOT
make client redirects which would lose data.  Also your "/accOptions" as a
double left arrow "<<" (syntax error).


-----Original Message-----
From: Ritchie Warsito []
Sent: Tuesday, December 21, 2004 1:27 PM
Subject: [Tiles] Action class to retrieve list and send to tile

Hi I'm new to all of this. I'll try to keep it clear.
I've playing around with tiles in a struts application that does mostly

My tiles-defs.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD
Tiles Configuration 1.1//EN" "tiles-config_1_1.dtd" >
  <definition name="mslDefLayout" path="/layouts/mslDefaultLayout.jsp" >
      <put name="title" value="Hypotheekbank Curacao" />
      <put name="header" value="/jsp/header.jsp" />
      <put name="footer" value="/jsp/footer.jsp" />
      <put name="menu" value="/jsp/officeMenu.jsp" />
  <definition name="index" extends="mslDefLayout">
        <put name="body" value="/jsp/huiskopen.jsp"/>
    <definition name="account" extends="mslDefLayout">
        <put name="body" value="/jsp/accOptions.jsp"/>

This setup is to reduce the amount of jsp pages, the ones that only
define your content and in what definition to load it in.
I'm calling on for instance, This will call on an action
DoTiles that has nothing more than a forward mapping in it to the right
definition, in this case "account"

Here is my struts-config.xml:
<action-mappings >
      <action path="/index" type="">
         <forward name="success" path="index" />
      <<action path="/accOptions" type="">
         <forward name="success" path="account" />
      <action path="/getAccountAction"
         <forward name="success" path="/accOptions" />
      <action path="/getMortgageAction"
          <forward name="sucess" path="mortgage" />

   <controller bufferSize="4096" debug="0" />
   <message-resources parameter="com.tiles.struts.ApplicationResources" />
   <plug-in className="org.apache.struts.tiles.TilesPlugin" >
       <set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
       <set-property property="moduleAware" value="true" />
       <set-property property="definitions-parser-validate" value="true" />

Now that works. What I'm trying now is the following:
I have one DTO class, one Business/Service class and one action class
The CustomerDAO has a public List getCustomerList method in it I want to
call on in the Action like this:
public ActionForward execute(
        ActionMapping mapping,
        ActionForm form,
        HttpServletRequest request,
        HttpServletResponse response) {

        List customerList = CustomerDAO.getInstance().getCustomerList();
        request.setAttribute("customer", customerList);
        return (mapping.findForward("success"));

So this forward (as you can see in my struts-config) should call on the
accOptions action that loads the "account" definition, so the List will
show in the jsp I defined in the tiles-defs for "account".
That jsp looks like this:
<logic:iterate name="customer" id="customer" scope="request"
   <tr><td>Name:</td><td><bean:write name="customer" property="name"
scope="request" /></td></tr>
   <tr><td>Address:</td><td><bean:write name="customer"
property="address" scope="request" /></td></tr>
   <tr><td>City:</td><td><bean:write name="customer" property="city"
scope="request" /></td></tr>
   <tr><td>Number of Mortgages:</td><td><bean:write name="customer"
property="noofmortgages" scope="request"  /></td></tr>

Only problem is, it ain't working. Seems like by calling a double action
forward it loses it's session or something.
So how can I accomplish what I want? Any idea's on this. It might be
simple, but it's all new for me, so I have no clue anymore.
I hope it isn't too long, but I wanted to give as much needed detail as

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message