Struts template tag

2002-11-18 Thread Jean-Baptiste Onofré
Hello all,

i would like to use template tags.

For exemple, i will define a JSP template like this :

%@ taglib uri=/WEB-INF/struts-template.tld prefix=template %
html
head
titletemplate:get name=title//title
link rel=stylesheet type=text/css href=toto.css/
/head
body
template:get name=subtitle/br
template:get name=corpus/br


In the using JSP, can i use bean in ApplicationResource or in request
scope in put of the template ? like this :

%@ taglib uri=/WEB-INF/struts-template.tld prefix=template %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %

template:insert template=/template.jsp
template:put name=title content=index.title direct=true/
!--
// it's like bean:message key=index.title/
--
template:put name=subtitle content=toto.name direct=true/
!--
// it's like bean:write name=toto property=name/
--
template:put name=corpus content=index.corpus direct=true/
!--
// it's like bean:message key=index.corpus/
--
/template:insert

Blablabla

/body
/html



Must i define a template with all html page or can i use two template in
one page like this :

template:insert template=/beginning.jsp
...
/template:insert

Blablablabla

template:insert template=/end.jsp
...
/template:insert




Actualy, i use jsp:include, one for the beginning of the JSP and one
for the end of the JSP.

If someone can mail me a sample or help for me :)

Best regards
-- 
Jean-Baptiste Onofré (Nanthrax)
Membre fondateur de phpFR.org
http://www.phpfr.org
[EMAIL PROTECTED]
Membre fondateur du LUG Béziers
http://www.lug-beziers.org
[EMAIL PROTECTED]

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




Re: Struts template tag

2002-11-18 Thread David Graham
The template tags are deprecated in 1.1 in favor of Tiles.

David







From: Jean-Baptiste Onofré [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Struts template tag
Date: Mon, 18 Nov 2002 17:08:06 +0100

Hello all,

i would like to use template tags.

For exemple, i will define a JSP template like this :

%@ taglib uri=/WEB-INF/struts-template.tld prefix=template %
html
head
titletemplate:get name=title//title
link rel=stylesheet type=text/css href=toto.css/
/head
body
template:get name=subtitle/br
template:get name=corpus/br


In the using JSP, can i use bean in ApplicationResource or in request
scope in put of the template ? like this :

%@ taglib uri=/WEB-INF/struts-template.tld prefix=template %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %

template:insert template=/template.jsp
	template:put name=title content=index.title direct=true/
	!--
		// it's like bean:message key=index.title/
	--
	template:put name=subtitle content=toto.name direct=true/
	!--
		// it's like bean:write name=toto property=name/
	--
	template:put name=corpus content=index.corpus direct=true/
	!--
		// it's like bean:message key=index.corpus/
	--
/template:insert

Blablabla

/body
/html



Must i define a template with all html page or can i use two template in
one page like this :

template:insert template=/beginning.jsp
	...
/template:insert

Blablablabla

template:insert template=/end.jsp
	...
/template:insert




Actualy, i use jsp:include, one for the beginning of the JSP and one
for the end of the JSP.

If someone can mail me a sample or help for me :)

Best regards
--
Jean-Baptiste Onofré (Nanthrax)
Membre fondateur de phpFR.org
http://www.phpfr.org
[EMAIL PROTECTED]
Membre fondateur du LUG Béziers
http://www.lug-beziers.org
[EMAIL PROTECTED]

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


_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus


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



Re: Struts template tag

2002-11-18 Thread Jean-Baptiste Onofré
Thanks for info,

but i'm in 1.0.2 in my dev.

I will try that i have write :)

Best regards
-- 
Jean-Baptiste Onofré (Nanthrax)
Membre fondateur de phpFR.org
http://www.phpfr.org
[EMAIL PROTECTED]
Membre fondateur du LUG Béziers
http://www.lug-beziers.org
[EMAIL PROTECTED]

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




Problem using nested struts template tag

2002-08-15 Thread Ying Gao

I use nested template tag as the following:

template:insert template=template.jsp

  template:put name=header content=header.jsp/

  template:put name=content direct=true
 template:insert template=contentTemplate.jsp
 template:put name=contentTitleImage
content=images/content_01.gif direct=true/
 template:put name=contentTable content=myContent.jsp/
 /template:insert
  /template:put

  template:put name=footer content=footer.jsp/

/template:insert

template.jsp is a template that contains header, content and footer.
contentTemplate.jsp is a template that contains a title image and a detail
content jsp to which I pass myContent.jsp. It works fine except that the
browser (both IE and Netscape) keeps busy for a while after the page header,
content and footer are loaded. It seems that the browser tries to load
something else.
JavaScript won't work until the browser finish loading. I have no idea what
it is loading.
It only happens when I use template:put tag to pass a content
(myContent.jsp) to the nested
template (contentTemplate.jsp) without using 'direct=true'. If I use
'direct=true'
the browser returns immediately but that is not what I want. I want the
content to be
included instead of printed directly.
Does anyone know what the problem is? Is there any solution or workaround?
Thanks.

Iris


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




Re: struts-template tag library vs. jsp:include/

2001-03-19 Thread Jim Newsham


Thank you for your reply, but this didn't really answer my question.  Let me
rephrase.  I am talking about jsp:include/, which is a dynamic templating
mechanism, as opposed to %@ include %, which is static.  As I understand it:

jsp:include/ and struts-template:*/ are both dynamic templating mechanisms
-- they are re-evaluated at runtime whenever referenced.  They allow you to
create a template with placeholders for dynamic values which you will supply at
runtime.  This is where they are similar.  What I'm interested in hearing is
how they differ.

I assume that struts-template offers some improvement over jsp:include,
otherwise it serves no purpose.  So my question is, what does struts-template
offer as an improvement over jsp:include?  The answer may be as simple as "it
provides a consistent and readable syntax", or it may be more substantial.

Thank you,

Jim Newsham


Robert Taylor wrote:

 Although it doesn't discuss struts template tag specifically, the J2EE
 BluePrint has a good section on the comparison of JSP includes and using
 templates. I believe it is in section 10.3 where it discuss the Sample
 Application: View.
 http://java.sun.com/j2ee/blueprints/sample_application/view/index.html

 HTH,

 Robert

  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
  Jim Newsham
  Sent: Friday, March 16, 2001 9:20 PM
  To: [EMAIL PROTECTED]
  Subject: struts-template tag library vs. jsp:include/
 
 
 
  Hi,
 
  What are the differences between using the struts template tag library and
  jsp's include action?  What are the advantages and trade-offs of each?
 
  Thanks,
 
  Jim Newsham
 
 
 
 
 




RE: struts-template tag library vs. jsp:include/

2001-03-19 Thread Troy Hart

the biggest thing for me is that you limit the potential layout bugs, and
you make it possible to change the layout, site wide, with the editing of a
single file. The alternative (just using jsp:include.../) forces you to
replicate the layout framework (typically this includes a set of nested
tables where you set the header, footer, sidebar, and etc...) on every
single jsp page.

Troy


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Jim Newsham
Sent: Friday, March 16, 2001 7:20 PM
To: [EMAIL PROTECTED]
Subject: struts-template tag library vs. jsp:include/



Hi,

What are the differences between using the struts template tag library and
jsp's include action?  What are the advantages and trade-offs of each?

Thanks,

Jim Newsham






RE: struts-template tag library vs. jsp:include/

2001-03-19 Thread Troy Hart

The template custom actions (including "insert", "put", and "get") are
absolutely distinct from the JSP "include" action. I would recommend that
you review the code for the struts-template web application that comes with
struts1.0 beta 1. In a nutshell, the template allows you to define a single
template page that lays out a set of components by referencing the
components by name.

Let's say the following is the contents of a file called
"/somePageLayoutSetup.jsp":
---
%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template' %
template:insert template="/myTemplate.jsp"
template:put name="title" content="Some Page Title" direct="true"/
template:put name="header" content="/header.jsp" /
template:put name="footer" content="/footer.jsp" /
template:put name="main-body" content="/somePage.jsp" /
/template:insert
---

Now then, here is the template, "/myTemplate.jsp":
---
%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template' %
html
head
titletemplate:get name="title" //title
/head
body
table
trtdtemplate:get name="header" //td/tr
trtdtemplate:get name="main-body" //td/tr
trtdtemplate:get name="footer" //td/tr
/table
I can also put any static stuff that I desire directly on this layout
template...
/body
---

This is obviously a simple example but it illustrates the point. Namely, you
have a page that references a layout template and "put"s named components
into a context such that the referenced template can "get" at them.
Obviously, the power here is that for any given page on your site you only
need to know what the components of the layout are, not how they are laid
out. When you want to change the way they are laid out you only need to
change the layout JSP (assuming components don't change). The mechanism that
is used by the jsp:include.../ action is (as I understand) functionally
equivalent to, if not exactly the same as, that used by the template:get
name=.../ (when the named element was "put" with "direct='false'", which is
the default).

Like I said initially, a review of the "struts-template" web app. will clear
this up for you.

Good luck,

Troy


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Jim Newsham
Sent: Monday, March 19, 2001 12:59 PM
To: [EMAIL PROTECTED]
Subject: Re: struts-template tag library vs. jsp:include/



Thank you for your reply, but this didn't really answer my question.  Let me
rephrase.  I am talking about jsp:include/, which is a dynamic templating
mechanism, as opposed to %@ include %, which is static.  As I understand
it:

jsp:include/ and struts-template:*/ are both dynamic templating
mechanisms
-- they are re-evaluated at runtime whenever referenced.  They allow you to
create a template with placeholders for dynamic values which you will supply
at
runtime.  This is where they are similar.  What I'm interested in hearing is
how they differ.

I assume that struts-template offers some improvement over jsp:include,
otherwise it serves no purpose.  So my question is, what does
struts-template
offer as an improvement over jsp:include?  The answer may be as simple as
"it
provides a consistent and readable syntax", or it may be more substantial.

Thank you,

Jim Newsham


Robert Taylor wrote:

 Although it doesn't discuss struts template tag specifically, the J2EE
 BluePrint has a good section on the comparison of JSP includes and using
 templates. I believe it is in section 10.3 where it discuss the Sample
 Application: View.
 http://java.sun.com/j2ee/blueprints/sample_application/view/index.html

 HTH,

 Robert

  -Original Message-----
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
  Jim Newsham
  Sent: Friday, March 16, 2001 9:20 PM
  To: [EMAIL PROTECTED]
  Subject: struts-template tag library vs. jsp:include/
 
 
 
  Hi,
 
  What are the differences between using the struts template tag library
and
  jsp's include action?  What are the advantages and trade-offs of each?
 
  Thanks,
 
  Jim Newsham
 
 
 
 
 




struts-template tag library vs. jsp:include/

2001-03-16 Thread Jim Newsham


Hi,

What are the differences between using the struts template tag library and
jsp's include action?  What are the advantages and trade-offs of each?

Thanks,

Jim Newsham