Templating Mechanism

2000-11-12 Thread Vincent Harcq

After reading the User Guide, I am not sure if Struts does have a Templating
Mechanism or not.
By that I mean one (or 2 or 3) that defines the basic structure of the site
in 3 (for example) parts : a header, the left panel and a body.  This
template will always be the jsp:forward and have two jsp:include to include
the two static (for example) header and left panes pages and one jsp:include
that would get a parameter from the request to now which page to include.
Something similar to the PetStore example.

I like that because it push a lot of DIV or LAYER HTML code in only the
template page.

Is it possible ?


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




Re: Templating Mechanism

2000-11-12 Thread Matas_Veitas



Take a look at this Sept Javaworld article. It explains how to use a JSP
template mechanism with  three custom tags.

http://www.javaworld.com/javaworld/jw-09-2000/jw-0915-jspweb.html

Matt





"Vincent Harcq" [EMAIL PROTECTED] on 11/12/2000 10:46:39 PM

Please respond to [EMAIL PROTECTED]; Please respond to
  [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: Matas Veitas/AMS/AMSINC)

Subject:  Templating Mechanism

After reading the User Guide, I am not sure if Struts does have a Templating
Mechanism or not.
By that I mean one (or 2 or 3) that defines the basic structure of the site
in 3 (for example) parts : a header, the left panel and a body.  This
template will always be the jsp:forward and have two jsp:include to include
the two static (for example) header and left panes pages and one jsp:include
that would get a parameter from the request to now which page to include.
Something similar to the PetStore example.

I like that because it push a lot of DIV or LAYER HTML code in only the
template page.

Is it possible ?


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com











Re: Struts docs?

2000-11-12 Thread Steven D. Wilkinson

Can you give some more information on finding this link?
I selected Programming|Java and tried to view through the articles (requires a
login, which I have) and after the second click on "More Articles" link there
are no more articles.
Then I tried to search on the author's name with no success.
Is there another way to find the article?

Thanks in advance

Nikolaus Rumm wrote:

 - Original Message -
 From: "Mike Campbell" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, November 03, 2000 10:53 PM
 Subject: Struts docs?

  Are the docs on the jakarta site (the user guide) and the example app
 about all the documentation there is for struts?
 
  I'm new to a lot of this and the going is a bit slow for me, so a little
 hand-holding; maybe the most small, basic app I could look
  might be helpful.
 
  Thanks.
 
 

 InformIT had an introduction example. Due to the session-based site layout I
 can't send you the exact URL, but go to http://www.informit.com/,
 Programming/Java and look for Maneesh Sahu's article on struts. It describes
 how to build a discussion board based on struts.

 kind regards

 Nikolaus Rumm

--
-
Steven D. Wilkinson, [EMAIL PROTECTED]

Co-author: Professional JSP, Wrox Press Inc.; ISBN: 1861003625
Silent author: Developing Java Servlets, Sams; ISBN: 0672316005





Re: Struts docs?

2000-11-12 Thread Steven D. Wilkinson

Please ignore.  I found it.

"Steven D. Wilkinson" wrote:

 Can you give some more information on finding this link?
 I selected Programming|Java and tried to view through the articles (requires a
 login, which I have) and after the second click on "More Articles" link there
 are no more articles.
 Then I tried to search on the author's name with no success.
 Is there another way to find the article?

 Thanks in advance

 Nikolaus Rumm wrote:

  - Original Message -
  From: "Mike Campbell" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, November 03, 2000 10:53 PM
  Subject: Struts docs?
 
   Are the docs on the jakarta site (the user guide) and the example app
  about all the documentation there is for struts?
  
   I'm new to a lot of this and the going is a bit slow for me, so a little
  hand-holding; maybe the most small, basic app I could look
   might be helpful.
  
   Thanks.
  
  
 
  InformIT had an introduction example. Due to the session-based site layout I
  can't send you the exact URL, but go to http://www.informit.com/,
  Programming/Java and look for Maneesh Sahu's article on struts. It describes
  how to build a discussion board based on struts.
 
  kind regards
 
  Nikolaus Rumm

 --
 -
 Steven D. Wilkinson, [EMAIL PROTECTED]

 Co-author: Professional JSP, Wrox Press Inc.; ISBN: 1861003625
 Silent author: Developing Java Servlets, Sams; ISBN: 0672316005

--
-
Steven D. Wilkinson, [EMAIL PROTECTED]

Co-author: Professional JSP, Wrox Press Inc.; ISBN: 1861003625
Silent author: Developing Java Servlets, Sams; ISBN: 0672316005





Replacing builtin Tomcat 3.1 in JB4

2000-11-12 Thread Alec Bau

Anybody tried replacing Tomcat 3.1 that comes bundled with JB4 with latest 3.2
without messing with Open API?

I have no problem running Tomcat 3.2 under JB4 as an application with servlet
debugging working fine. But what's lost is ability to mark JB4 projects as
JSP/Servlets an thus such niceties as JSP debugging, internal browser, http
trace, etc. I would prefer not to downgrade to 3.1 because our production
environment is 3.2 and we rely on some later bug fixes and features.

Thanks,
Alec





Re: Some thoughts on / problems with Struts (mostly tag related)

2000-11-12 Thread Pierre Métras

Hi

I support most of the points raised by Matthias, as I encountered the same
problems/interrogations. And everyone who have tried to extend Struts tags
or implement forms created by designers have surely encountered them...

 Automatic bean creation !
 Multiple select
 form-tags and nested properties !
 name attribute in form tags !!
If version 1.0 has to be incompatible with version 0.5, now is the time to
take that sort of decision

 Generating id= in the html output !
 form "method=get" will not work in every container
 styleClass attribute !

 (defaults) values in form tags !
I don't apply totally for this one as I don't want to have localised values
stored in forms, even initializations.

 code bloat due to unneccessary extension of BodySupport !!

 tags that work with collection of presentation things !
I would add that the errors tag can't be used due to bad design. Solutions
have been suggested for the past months...

 Standard HTML attributes !!

 Matthias


Pierre Métras





Re: Templating Mechanism

2000-11-12 Thread David Geary

The template mechanism in the article is nearly identical to the one in
Struts. See org.apache.struts.taglib.template.


david

[EMAIL PROTECTED] wrote:

 Take a look at this Sept Javaworld article. It explains how to use a JSP
 template mechanism with  three custom tags.

 http://www.javaworld.com/javaworld/jw-09-2000/jw-0915-jspweb.html

 Matt

 "Vincent Harcq" [EMAIL PROTECTED] on 11/12/2000 10:46:39 PM

 Please respond to [EMAIL PROTECTED]; Please respond to
   [EMAIL PROTECTED]

 To:   [EMAIL PROTECTED]
 cc:(bcc: Matas Veitas/AMS/AMSINC)

 Subject:  Templating Mechanism

 After reading the User Guide, I am not sure if Struts does have a Templating
 Mechanism or not.
 By that I mean one (or 2 or 3) that defines the basic structure of the site
 in 3 (for example) parts : a header, the left panel and a body.  This
 template will always be the jsp:forward and have two jsp:include to include
 the two static (for example) header and left panes pages and one jsp:include
 that would get a parameter from the request to now which page to include.
 Something similar to the PetStore example.

 I like that because it push a lot of DIV or LAYER HTML code in only the
 template page.

 Is it possible ?

 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com




RE: Some thoughts on / problems with Struts (mostly tag related)

2000-11-12 Thread Colin Sampaleanu

Keep in mind that it is perfectly ok (depending on how you want to design
your app) for the user to come in through either the JSP page or through the
action url.

On that basis, you need to be able to specify and create the form bean in
each of those two places, and those two places don't know anything about
each other. The JSP page doesn't know about action mapppings, and the
mapping doesn't know anything about all the particular JSP pages that may
want to use that form. There is not even any stipulation that a form used in
a JSP page has to be used in a mapping, e.g. the submit from the form could
theoretically go to any URL. The inverse also applies.

As to why the bean is automatically created if it doesn't exist, I do agree
that there are cases in which you might want to have some sort of error if
the bean doesn't already exist, but you can easily do that by having a
special member variable in the bean that indicates that it has just been
created. On a manual create you would reset that yourself, but on an auto
create it would remain set, and the validate method would detect it (or you
could check manually).


-Original Message-
From: Matthias Kerkhoff [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 11, 2000 7:29 AM
To: [EMAIL PROTECTED]
Subject: Some thoughts on / problems with Struts (mostly tag related)

Automatic bean creation
---
I've noticed, that both the struts:form tag and the action servlet
create the form bean if it doesn't exist. Also, the bean's name
and scope can be specified in these two different places ways (in
the action mapping and via attributes of the form tag). I am a bit
confused, if this is really necessary and would appreciate an example
where it makes sense to have both ways.





Re: Some thoughts on / problems with Struts (mostly tag related)

2000-11-12 Thread Craig R. McClanahan

Colin Sampaleanu wrote:

 Keep in mind that it is perfectly ok (depending on how you want to design
 your app) for the user to come in through either the JSP page or through the
 action url.

 On that basis, you need to be able to specify and create the form bean in
 each of those two places, and those two places don't know anything about
 each other. The JSP page doesn't know about action mapppings, and the
 mapping doesn't know anything about all the particular JSP pages that may
 want to use that form. There is not even any stipulation that a form used in
 a JSP page has to be used in a mapping, e.g. the submit from the form could
 theoretically go to any URL. The inverse also applies.


Your reasoning on why it needs to be created in either place is correct.

What's still screwed up in the current design is that you have to specify the
bean class and scope in two places (the page itself and the configuration
file).  Ideally the form tag should be smart enough to look up the right action
mapping (based on where it's going to submit to) and therefore infer the right
bean class and scope if not specified.  I just haven't gotten that far yet.


 As to why the bean is automatically created if it doesn't exist, I do agree
 that there are cases in which you might want to have some sort of error if
 the bean doesn't already exist, but you can easily do that by having a
 special member variable in the bean that indicates that it has just been
 created. On a manual create you would reset that yourself, but on an auto
 create it would remain set, and the validate method would detect it (or you
 could check manually).


For testing whether a bean was newly created by the JSP page, a particular
feature of the jsp:useBean tag is useful -- the body of this tag is only
evaluated when the bean is created.  Consider the following:

jsp:useBean id="beanname" scope="session" class="com.mycompany.MyBean"
jsp:setProperty name="pageCreated" value="true"/
/jsp:useBean

In this scenario, setPageCreated(true) will be called if the bean was created by
this page.  If the "pageCreated" property defaults to false, you now have an
easy test.

For general purpose detection of existing beans, the new logic tags make this
easy:

logic:notPresent name="beanname" scope="session"
You are a bad boy ... the "beanname" bean is missing!
/logic:notPresent

Craig McClanahan







Re: Templating Mechanism

2000-11-12 Thread Craig R. McClanahan

David Geary wrote:

 The template mechanism in the article is nearly identical to the one in
 Struts. See org.apache.struts.taglib.template.


I just updated the documentation on the website http://jakarta.apache.org/struts
to be up to date with respect to the changes for 1.0.  You'll now see the template
library documented.


 david


Craig



 [EMAIL PROTECTED] wrote:

  Take a look at this Sept Javaworld article. It explains how to use a JSP
  template mechanism with  three custom tags.
 
  http://www.javaworld.com/javaworld/jw-09-2000/jw-0915-jspweb.html
 
  Matt
 
  "Vincent Harcq" [EMAIL PROTECTED] on 11/12/2000 10:46:39 PM
 
  Please respond to [EMAIL PROTECTED]; Please respond to
[EMAIL PROTECTED]
 
  To:   [EMAIL PROTECTED]
  cc:(bcc: Matas Veitas/AMS/AMSINC)
 
  Subject:  Templating Mechanism
 
  After reading the User Guide, I am not sure if Struts does have a Templating
  Mechanism or not.
  By that I mean one (or 2 or 3) that defines the basic structure of the site
  in 3 (for example) parts : a header, the left panel and a body.  This
  template will always be the jsp:forward and have two jsp:include to include
  the two static (for example) header and left panes pages and one jsp:include
  that would get a parameter from the request to now which page to include.
  Something similar to the PetStore example.
 
  I like that because it push a lot of DIV or LAYER HTML code in only the
  template page.
 
  Is it possible ?
 
  _
  Do You Yahoo!?
  Get your free @yahoo.com address at http://mail.yahoo.com






RE: Some thoughts on / problems with Struts (mostly tag related)

2000-11-12 Thread Colin Sampaleanu

 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, November 12, 2000 11:03 PM
 To: [EMAIL PROTECTED]
 Subject: Re: Some thoughts on / problems with Struts (mostly tag
 related)


 Colin Sampaleanu wrote:

  Keep in mind that it is perfectly ok (depending on how you want
 to design
  your app) for the user to come in through either the JSP page
 or through the
  action url.
 
  On that basis, you need to be able to specify and create the
 form bean in
  each of those two places, and those two places don't know anything about
  each other. The JSP page doesn't know about action mapppings, and the
  mapping doesn't know anything about all the particular JSP
 pages that may
  want to use that form. There is not even any stipulation that a
 form used in
  a JSP page has to be used in a mapping, e.g. the submit from
 the form could
  theoretically go to any URL. The inverse also applies.

As long as it can still handle the case where the action is not going to any
particular mapping at all, and let's you specify the right values...

 Your reasoning on why it needs to be created in either place is correct.

 What's still screwed up in the current design is that you have to
 specify the
 bean class and scope in two places (the page itself and the configuration
 file).  Ideally the form tag should be smart enough to look up
 the right action
 mapping (based on where it's going to submit to) and therefore
 infer the right
 bean class and scope if not specified.  I just haven't gotten
 that far yet.

  As to why the bean is automatically created if it doesn't
 exist, I do agree
  that there are cases in which you might want to have some sort
 of error if
  the bean doesn't already exist, but you can easily do that by having a
  special member variable in the bean that indicates that it has just been
  created. On a manual create you would reset that yourself, but
 on an auto
  create it would remain set, and the validate method would
 detect it (or you
  could check manually).
 

 For testing whether a bean was newly created by the JSP page, a particular
 feature of the jsp:useBean tag is useful -- the body of this tag is only
 evaluated when the bean is created.  Consider the following:

 jsp:useBean id="beanname" scope="session"
 class="com.mycompany.MyBean"
 jsp:setProperty name="pageCreated" value="true"/
 /jsp:useBean

 In this scenario, setPageCreated(true) will be called if the bean
 was created by
 this page.  If the "pageCreated" property defaults to false, you
 now have an
 easy test.

 For general purpose detection of existing beans, the new logic
 tags make this
 easy:

 logic:notPresent name="beanname" scope="session"
 You are a bad boy ... the "beanname" bean is missing!
 /logic:notPresent

I was thinking more on the action handler side, your suggestions are of
course easiest for a JSP page...