RE: Proposal: Support nested tags where only attributes can be used

2001-06-15 Thread Dean Wampler



 -Original Message-
 From: Niall Pemberton [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 13, 2001 6:19 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: Proposal: Support nested tags where only
 attributes can be
 used


 I dont really get what your saying. In your template (i.e.
 t.jsp) you define
 the formatting for the common look and feel of all your
 pages, for example
 page titles, a side bar and footers. If on some pages you
 don't need all of
 them you just leave them out - for example if you didn't need
 a footer then
 don't do a template:get for it on your jsp page - it still
 works fine.

Let me clarify a bit.  I expect to have two, maybe three, templates, for two
or three different types of pages.  For example, help pages will look
different than regular pages, administrator pages will look different than
regular-user pages, etc.  Within these page groups, I expect to have maybe
5-10 pages.  I wanted to avoid writing stuff like

  template:insert template=t.jsp
template:put name=pageTitle direct=true
   bean:message key=login.title/
/template:put
template:put name=pageThis direct=true
   bean:message key=login.this/
/template:put
template:put name=pageThat direct=true
   bean:message key=login.that/
/template:put
template:put name=pageTheOther direct=true
   bean:message key=login.theOther/
/template:put
...
  /template:insert

for every single page when I could just define one thing for each page:

  template:insert template=t.jsp
template:put name=page content=login direct=true/
  /template:insert

and have the template page t.jsp construct all the other items
dynamically.

HOWEVER, after thinking about it a bit, I've decided that maybe this
approach is too clever, because the stuff you end up doing, like

  h1Title is
bean:message
  bean:key
template:get name=page/.title
  /bean:key
/bean:message
  /h1

isn't so easy to read, is it?  Perhaps the wasted effort of all those
template:put's isn't so bad if you get a cleaner t.jsp file with
statements like

  h1title is bean:message key=pageTitle//h1

instead.

So, you're original suggestion of using

template:put name=pageTitle direct=true
   bean:message key=login.title/
/template:put

actually solved the insurmountable problems I had, for which I thank you.  I
think I'll shelve my proposed enhancement for now, unless others are really
interested in it.


dean

 (deleted) ...




RE: Proposal: Support nested tags where only attributes can be used

2001-06-15 Thread Craig R. McClanahan



On Fri, 15 Jun 2001, Dean Wampler wrote:

  From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
 
  You might want to have a look at the JSP Specification as
  well.  Some of
  the things you discuss are just plain not legal in JSP.
 
 I'll review the JSP spec. I admit that I'm approaching this with a more XML
 frame of reference.
 
 Thanks,
 dean
 

Dean, I also want to apologize to you (and the list) for the tone of this
message.  It came across *much* harsher than I really intended, and can
only claim still-catching-up-on-sleep-after-JavaOne as an excuse :-(.

 
   Thanks,
   dean
  

Craig




RE: Proposal: Support nested tags where only attributes can be used

2001-06-15 Thread Niall Pemberton


How about a custom tag, which combines bean:message and template:get
functionality?

For example

   h1Title is myTaglib:message template=page suffix=.title//h1

I've attached a tag like this.


Niall



 -Original Message-
 From: Dean Wampler [mailto:[EMAIL PROTECTED]]
 Sent: 15 June 2001 17:28
 To: 'Niall Pemberton'; [EMAIL PROTECTED]
 Cc: Dean Wampler (E-mail)
 Subject: RE: Proposal: Support nested tags where only attributes can be
 used

 I wanted to avoid writing stuff like

   template:insert template=t.jsp
 template:put name=pageTitle direct=true
bean:message key=login.title/
 /template:put
 template:put name=pageThis direct=true
bean:message key=login.this/
 /template:put
 template:put name=pageThat direct=true
bean:message key=login.that/
 /template:put
 template:put name=pageTheOther direct=true
bean:message key=login.theOther/
 /template:put
 ...
   /template:insert

 for every single page when I could just define one thing for each page:

   template:insert template=t.jsp
 template:put name=page content=login direct=true/
   /template:insert

 and have the template page t.jsp construct all the other items
 dynamically.


 amarda.tld
 MessageTag.java


RE: Proposal: Support nested tags where only attributes can be used

2001-06-14 Thread Niall Pemberton

For the example you give, the following works just as well in existing
Struts:

In your JSP page:

 template:insert template=t.jsp
   template:put name=pageTitle direct=true
  bean:message key=login.title/
   /template:put
 /template:insert

 Now, in t.jsp

 %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
 ...
 h1Title is template:get name=pageTitle//h1


Niall


 -Original Message-
 From: Dean Wampler [mailto:[EMAIL PROTECTED]]
 Sent: 15 June 2001 01:28
 To: [EMAIL PROTECTED]
 Cc: Dean Wampler (E-mail)
 Subject: Proposal: Support nested tags where only attributes can be used


 I'm new to struts, so bear with me.

 I have been working with the bean and template tags. I have
 found that a
 straightforward (if a bit tedious to do...) enhancement would make it much
 easier to construct JSP pages in ways useful for me.  Basically, I would
 like to use nested tags to specify some information to outer tag,
 information that currently is specified only through attributes.

 Here's an example.  Suppose I have a JSP page that uses the
 template:insert construct:

 ...
 %@ taglib uri=/WEB-INF/struts-template.tld prefix=template %
 ...
 template:insert template=t.jsp
   template:put name=pageName content=login direct=true/
 /template:insert

 Now, in t.jsp, I would like to use the message tag with the parameter
 pageName as a prefix.  Something that might look like:

 %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
 ...
 h1Title is bean:message key='template:get
 name=pageName/%=.title%'//h1

 or perhaps

 h1Title is bean:message key='%=template:get
 name=pageName/+.title%'//h1

 There are two problems: (i) this is ugly and not easy to use by most HTML
 designers, (ii) it doesn't work anyway.  By the time the code
 gets compiled
 to a servlet, it appears that the key='...' expression ends up key=''.
 That is, 'template:get name=pageName/' is effectively empty.

 However, the following message tag structure would solve both problems and
 support the capability I'm after (indentation is
 for clarity...):

 h1Title is
   bean:message
 bean:key
   template:get name=pageName/.title
 /bean:key
   /bean:message
 /h1

 In other words, support nested tags to specify the key and perhaps other
 attributes, so that specifying the values of the attributes is more
 flexible.

 Many of the ant tasks support capabilities like this and it greatly
 enhances the power and flexibility of build files.

 I have looked at the code for MessageTag (and others).  This extension is
 straightforward to implement and it can be done in a backwards compatible
 way (that is, the old attribute syntax will still work fine).

 I'm willing to implement the changes, but before I do so, I
 wanted to check
 with the rest of you to see if there are any good reasons not to proceed.

 Thanks,
 dean

 Dean Wampler, Ph.D.
 [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
 http://www.powerhousetechnology.com/

 I want my tombstone to say:

   Unknown Application Error in Dean Wampler.exe.
   Application Terminated.
  [OK] [Cancel]





RE: Proposal: Support nested tags where only attributes can be used

2001-06-14 Thread Niall Pemberton

I dont really get what your saying. In your template (i.e. t.jsp) you define
the formatting for the common look and feel of all your pages, for example
page titles, a side bar and footers. If on some pages you don't need all of
them you just leave them out - for example if you didn't need a footer then
don't do a template:get for it on your jsp page - it still works fine.

If you have specific messages unique to a page them just put them straight
on the page - if you want to prefix them with the page name then it seems
easier to me to just specify it straight in bean:message
key=pagename.something format.

Personally we don't tie our messages to pages, more to the business area,
that way they're often re-used among pages.

I don't know if this is useful to you because I didn't really get what your
trying to resolve.

Niall

 -Original Message-
 From: Dean Wampler [mailto:[EMAIL PROTECTED]]
 Sent: 15 June 2001 01:57
 To: [EMAIL PROTECTED]
 Subject: RE: Proposal: Support nested tags where only attributes can be
 used


 Interesting!  I didn't know that.  Certainly that would help.
 It's actually
 another example of the kind of flexibility I'm thinking about.

 One disadvantage, though.  It requires that the outer page know all the
 messages the inner page wants to use.  I would rather keep this
 coupling to
 a minimum (e.g., just pass the prefix, like I've shown), especially if I
 have lots of similar outer pages (and I will...).  This way, if I add and
 use a new message or resource in the inner page I don't have to add
 corresponding tags to the outer pages, too.

 Thanks,
 dean

  -Original Message-
  From: Niall Pemberton [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, June 13, 2001 5:43 PM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: RE: Proposal: Support nested tags where only
  attributes can be
  used
 
 
  For the example you give, the following works just as well in existing
  Struts:
 
  In your JSP page:
 
   template:insert template=t.jsp
 template:put name=pageTitle direct=true
bean:message key=login.title/
 /template:put
   /template:insert
 
   Now, in t.jsp
 
   %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
   ...
   h1Title is template:get name=pageTitle//h1
 
 
  Niall
 
 
   -Original Message-
   From: Dean Wampler [mailto:[EMAIL PROTECTED]]
   Sent: 15 June 2001 01:28
   To: [EMAIL PROTECTED]
   Cc: Dean Wampler (E-mail)
   Subject: Proposal: Support nested tags where only
  attributes can be used
  
  
   I'm new to struts, so bear with me.
  
   I have been working with the bean and template tags. I have
   found that a
   straightforward (if a bit tedious to do...) enhancement
  would make it much
   easier to construct JSP pages in ways useful for me.
  Basically, I would
   like to use nested tags to specify some information to outer tag,
   information that currently is specified only through attributes.
  
   Here's an example.  Suppose I have a JSP page that uses the
   template:insert construct:
  
   ...
   %@ taglib uri=/WEB-INF/struts-template.tld prefix=template %
   ...
   template:insert template=t.jsp
 template:put name=pageName content=login direct=true/
   /template:insert
  
   Now, in t.jsp, I would like to use the message tag with
  the parameter
   pageName as a prefix.  Something that might look like:
  
   %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
   ...
   h1Title is bean:message key='template:get
   name=pageName/%=.title%'//h1
  
   or perhaps
  
   h1Title is bean:message key='%=template:get
   name=pageName/+.title%'//h1
  
   There are two problems: (i) this is ugly and not easy to
  use by most HTML
   designers, (ii) it doesn't work anyway.  By the time the code
   gets compiled
   to a servlet, it appears that the key='...' expression
  ends up key=''.
   That is, 'template:get name=pageName/' is effectively empty.
  
   However, the following message tag structure would solve
  both problems and
   support the capability I'm after (indentation is
   for clarity...):
  
   h1Title is
 bean:message
   bean:key
 template:get name=pageName/.title
   /bean:key
 /bean:message
   /h1
  
   In other words, support nested tags to specify the key
  and perhaps other
   attributes, so that specifying the values of the attributes is more
   flexible.
  
   Many of the ant tasks support capabilities like this and
  it greatly
   enhances the power and flexibility of build files.
  
   I have looked at the code for MessageTag (and others).
  This extension is
   straightforward to implement and it can be done in a
  backwards compatible
   way (that is, the old attribute syntax will still work fine).
  
   I'm willing to implement the changes, but before I do so, I
   wanted to check
   with the rest of you to see if there are any good reasons
  not to proceed.
  
   Thanks,
   dean
  
   Dean Wampler, Ph.D.
   [EMAIL PROTECTED]
   mailto:[EMAIL PROTECTED]
   http

Re: Proposal: Support nested tags where only attributes can be used

2001-06-14 Thread Craig R. McClanahan



On Thu, 14 Jun 2001, Dean Wampler wrote:

 h1Title is
   bean:message
 bean:key
   template:get name=pageName/.title
 /bean:key
   /bean:message
 /h1
 

There's a pretty significant problem with this -- the JSP page compiler
will consider .title to be template text, and will just copy it to the
output page.

That's not to say we couldn't make the bean:message tag smarter about
where it gets its key from, but we have to obey the rules of the language
we're writing for.  The typical way to deal with dynamic stuff at runtime
is to use a runtime expression.

 In other words, support nested tags to specify the key and perhaps other
 attributes, so that specifying the values of the attributes is more
 flexible.
 
 Many of the ant tasks support capabilities like this and it greatly
 enhances the power and flexibility of build files.
 
 I have looked at the code for MessageTag (and others).  This extension is
 straightforward to implement and it can be done in a backwards compatible
 way (that is, the old attribute syntax will still work fine).
 
 I'm willing to implement the changes, but before I do so, I wanted to check
 with the rest of you to see if there are any good reasons not to proceed.
 

You might want to have a look at the JSP Specification as well.  Some of
the things you discuss are just plain not legal in JSP.

 Thanks,
 dean
 
 Dean Wampler, Ph.D.
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 http://www.powerhousetechnology.com/
 
 I want my tombstone to say:
 
   Unknown Application Error in Dean Wampler.exe.
   Application Terminated.
  [OK] [Cancel]
 
 
Craig