You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Terry Brick <te...@yahoo.com> on 2003/08/01 00:42:20 UTC

Please Help With Simple Tiles Problem

I'm using struts 1.1 and having trouble with a simple Tile function.  I've searched the archives and doc, but for some reason I just can't seem to get a grip on a lot of this tile stuff.  All I want to do is embed a tile within a tile within a page.  Here's what I have now:

 

tiles-defx.xml (snippet)
=================================
<definition name="layout.default" path="/tls/layout.jsp">
 <put name="title" value="my title" direct="true"/>
 <put name="header" value="/tls/header.jsp"/>
</definition>


<definition name="form.default" extends="layout.default">
 <put name="body" value="/tls/wrapform.jsp"/>
</definition>


<definition name="form.user" extends="form.default">
 <put name="title" value="form title" direct="true"/>
 <put name="form-body" value="/tls/user_form.jsp"/>
</definition>

 

In layout.jsp  (snippet)
===================================
<tiles:insert attribute="body"/>


In wrapform.jsp  (snippet)
====================================
<tiles:insert attribute="form-body"/>

 

I get an error saying that my "form-body" attribute does not exist.  And when I swap <tiles:insert> with <tiles:get>, I don't get an error, but I also don't get my form-body content.  I can see that what I have defined doesn't make much sense, but I can't figure it out.
What I want is, when I call "form.user" for it to give me the folloing content structure....
(if these tags represented the content of JSP's)

<layout.jsp>
   <wrapform.jsp>
      <user_form.jsp/>
   </wrapform.jsp>
</layout.jsp>

Could someone please show me how to do this?
Thank you


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

Re: Struts w/EJB

Posted by James Mitchell <jm...@apache.org>.
Download modelj from sourceforge and try it.  Supply the path to your
j2ee.jar and build the sample app in 2 minutes.  Modelj will create a
struts/ejb application for you from one single config file.  Using JBoss,
all you have to do is setup a default data source and deploy your
sample.ear.

http://sourceforge.net/projects/modelj


--
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org
678-910-8017
AIM:jmitchtx


----- Original Message ----- 
From: "Martin Naskovski" <mn...@san.rr.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Thursday, July 31, 2003 7:01 PM
Subject: Struts w/EJB


> Hello all. Is there an app that demonstrates the use of Struts & EJB as a
> persistence layer? I checked out Struts-Resume from Matt Raible, but it
> uses Hibernate... Is there anything available w/EJB's? Thanks.
>
> Martin
> --
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Struts w/EJB

Posted by Vic Cekvenich <vi...@baseBeans.com>.
Maybe EJB should be used with JSF (and blue prints 
http://java.sun.com/blueprints/code/index.html) instead of Struts.

Struts is more like this http://ibatis.com/jpetstore/jpetstore.html.
.V

Erik Price wrote:
> 
> 
> Martin Naskovski wrote:
> 
>> Hello all. Is there an app that demonstrates the use of Struts & EJB as a
>> persistence layer? I checked out Struts-Resume from Matt Raible, but it
>> uses Hibernate... Is there anything available w/EJB's? Thanks.
> 
> 
> 
> http://xpetstore.sf.net/
> 
> 
> There are two implementations of Xpetstore, one that uses EJB and one 
> that just uses servlets.  Check out the EJB one, it works great with JBoss.
> 
> Note, I personally don't think that using EJB is fundamentally different 
> from any other persistence layer, at least not in reference to Struts, 
> so you should be able to look at just about any sample code and figure 
> out some best practices.  It all boils down to the fact that you have 
> Struts Actions, which receive HTTP requests from the client, and which 
> then delegate the work to other objects.  Whether those objects are 
> session beans that perform some task by calling EJB or Hibernate 
> objects, or whether you're going the simple route (what I'm doing b/c my 
> needs are so trivial) and just having your Struts Actions directly 
> manipulate Data Access Objects which use JDBC business delegates, it's 
> not really much different.
> 
> The only big difference I've seen is that some people believe you should 
> abstract your model into a layer just beyond Struts Actions so that you 
> can switch from Struts to another framework if necessary.  But the other 
> line of reasoning is that this is a lot of extra work if you have no 
> plans to leave Struts.
> 
> My 2 cents.
> 
> 
> Erik

-- 
Vic Cekvenich,
Struts Instructor,
1-800-917-JAVA

Advanced <a href ="baseBeans.com">Struts Training</a>, mentoring and 
project recovery in North East.
Open Source <a href ="baseBeans.com">Portal Content Management</a> 
basicPortal  software.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Struts w/EJB

Posted by Erik Price <ep...@ptc.com>.

Martin Naskovski wrote:
> Hello all. Is there an app that demonstrates the use of Struts & EJB as a
> persistence layer? I checked out Struts-Resume from Matt Raible, but it
> uses Hibernate... Is there anything available w/EJB's? Thanks.


http://xpetstore.sf.net/


There are two implementations of Xpetstore, one that uses EJB and one 
that just uses servlets.  Check out the EJB one, it works great with JBoss.

Note, I personally don't think that using EJB is fundamentally different 
from any other persistence layer, at least not in reference to Struts, 
so you should be able to look at just about any sample code and figure 
out some best practices.  It all boils down to the fact that you have 
Struts Actions, which receive HTTP requests from the client, and which 
then delegate the work to other objects.  Whether those objects are 
session beans that perform some task by calling EJB or Hibernate 
objects, or whether you're going the simple route (what I'm doing b/c my 
needs are so trivial) and just having your Struts Actions directly 
manipulate Data Access Objects which use JDBC business delegates, it's 
not really much different.

The only big difference I've seen is that some people believe you should 
abstract your model into a layer just beyond Struts Actions so that you 
can switch from Struts to another framework if necessary.  But the other 
line of reasoning is that this is a lot of extra work if you have no 
plans to leave Struts.

My 2 cents.


Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Struts w/EJB

Posted by Martin Naskovski <mn...@san.rr.com>.
Hello all. Is there an app that demonstrates the use of Struts & EJB as a
persistence layer? I checked out Struts-Resume from Matt Raible, but it
uses Hibernate... Is there anything available w/EJB's? Thanks.

Martin
--


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Please Help With Simple Tiles Problem

Posted by Terry Brick <te...@yahoo.com>.
Thanks.  I've seen that page and many other.  Believe, I feel stupid from seeing so many examples and not being able to figure it out.  But I'm getting a mental block somewhere that just isn't allowing me to grasp something.

Barry Volpe <st...@childrencare.com> wrote:Tiles can function stand alone from struts but is incorporated in struts
1.1.
Here is the website of the originator of tiles. Part way down the page are
some example tiles war files that I found helpful.

http://www.lifl.fr/~dumoulin/tiles/

Barry


----- Original Message -----
From: "Terry Brick" 
To: 
Sent: Thursday, July 31, 2003 3:42 PM
Subject: Please Help With Simple Tiles Problem


>
> I'm using struts 1.1 and having trouble with a simple Tile function. I've
searched the archives and doc, but for some reason I just can't seem to get
a grip on a lot of this tile stuff. All I want to do is embed a tile within
a tile within a page. Here's what I have now:
>
>
>
> tiles-defx.xml (snippet)
> =================================
> 
> 


> 


> 
>
>
> 
> 


> 
>
>
> 
> 


> 


> 
>
>
>
> In layout.jsp (snippet)
> ===================================
> 
>
>
> In wrapform.jsp (snippet)
> ====================================
> 
>
>
>
> I get an error saying that my "form-body" attribute does not exist. And
when I swap with , I don't get an error, but I
also don't get my form-body content. I can see that what I have defined
doesn't make much sense, but I can't figure it out.
> What I want is, when I call "form.user" for it to give me the folloing
content structure....
> (if these tags represented the content of JSP's)
>
> 
> 
> 
> 
> 
>
> Could someone please show me how to do this?
> Thank you
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

Re: Please Help With Simple Tiles Problem

Posted by Barry Volpe <st...@childrencare.com>.
Tiles can function stand alone from struts but is incorporated in struts
1.1.
Here is the website of the originator of tiles.  Part way down the page are
some example tiles war files that I found helpful.

http://www.lifl.fr/~dumoulin/tiles/

Barry


----- Original Message -----
From: "Terry Brick" <te...@yahoo.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, July 31, 2003 3:42 PM
Subject: Please Help With Simple Tiles Problem


>
> I'm using struts 1.1 and having trouble with a simple Tile function.  I've
searched the archives and doc, but for some reason I just can't seem to get
a grip on a lot of this tile stuff.  All I want to do is embed a tile within
a tile within a page.  Here's what I have now:
>
>
>
> tiles-defx.xml (snippet)
> =================================
> <definition name="layout.default" path="/tls/layout.jsp">
>  <put name="title" value="my title" direct="true"/>
>  <put name="header" value="/tls/header.jsp"/>
> </definition>
>
>
> <definition name="form.default" extends="layout.default">
>  <put name="body" value="/tls/wrapform.jsp"/>
> </definition>
>
>
> <definition name="form.user" extends="form.default">
>  <put name="title" value="form title" direct="true"/>
>  <put name="form-body" value="/tls/user_form.jsp"/>
> </definition>
>
>
>
> In layout.jsp  (snippet)
> ===================================
> <tiles:insert attribute="body"/>
>
>
> In wrapform.jsp  (snippet)
> ====================================
> <tiles:insert attribute="form-body"/>
>
>
>
> I get an error saying that my "form-body" attribute does not exist.  And
when I swap <tiles:insert> with <tiles:get>, I don't get an error, but I
also don't get my form-body content.  I can see that what I have defined
doesn't make much sense, but I can't figure it out.
> What I want is, when I call "form.user" for it to give me the folloing
content structure....
> (if these tags represented the content of JSP's)
>
> <layout.jsp>
>    <wrapform.jsp>
>       <user_form.jsp/>
>    </wrapform.jsp>
> </layout.jsp>
>
> Could someone please show me how to do this?
> Thank you
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Please Help With Simple Tiles Problem

Posted by Terry Brick <te...@yahoo.com>.
Ok, I've finally gotten this to work.  However, I
don't think it's the "right" solution and it's
certainly not one I'm happy with.  But maybe by
showing how I'm getting it to work, that will better
communicate to people what I'm trying SO HARD to do.

This works:

<definition name="page" path="page.jsp"/>

<definition name="form1" extends="page">
   <put name="body" value="form1a"/>
<definition>

<definition name="form1a" path="form_wrapper.jsp">
   <put name="form-body" value="form1.jsp"/>
</definition>

So this gives me...
<page.jsp>
  <form_wrapper.jsp>
    <form1.jsp/>
  </form_wrapper.jsp>
</page.jsp>

The problem is that "form1.jsp" will not always be
"form1.jsp".  I want to be able to swap that for a
"form2.jsp", "form3.jsp", etc.  Using this method, I
would have to add TWO definitions into the
tile-defs.xml for each new form I wanted!  (form2,
form2a, form3, form3a, etc)
There must be a better way where I only have to add a
single definition for each new form.  Any ideas? 
Advice is much appreciated. Thanks.




__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org