RE: Templates: a design question

2001-08-01 Thread Tim Colson

 The approach I use (and I believe it is a common approach) is to have two
 jsp pages for each page on my site that is going to use templates.
 MainLayout.jsp - the main template layout page.
 ShopCart_content.jsp - the actual content of the shopping card page.
 ShopCart.jsp - the shopping cart page that references MainLayout.jsp and
+1
Heh heh - we even use the same naming convention pagename.jsp +
pagename_content.jsp.

One little issue we've run across is when the Designer wants to display
something dynamically in the MainLayout.jsp based on conditions/stuff
happening in the content.jsp.

Cheers,
Tim





RE: Taglibs decrease the separation between designer and developer?

2001-08-01 Thread Tim Colson

Chris -

 Assenza, Chris wrote :
 I generally would not let [Designers] edit JSP's at all taglibs or not,
 unless they had experience with JSP or ASP.
Yikes. ;-)  I agree partially - I too have a dim view that Designers can
effectively modify JSP files w/ or w/o taglibs. But I think that in an ideal
world the Designer _should_ be able to update the View directly without a
developer intermediary as suggested.

 While it
 may not be ideal or efficient to do so, I find that it is much better for
 the designers to provide me with a mockup and I'll deal with the HTML.

When the mockup changes by a word or two - the Developer can easily make the
update.

However - when the changes are dramatic - the Developer must do a massive
manual-eyeball diff between the new mockup and the JSP. Efficiency is not
the term that usually pops in my head at that point. grin


Maybe I'm the minority - but my ideal world is where the View can be built
100% by a Designer.

(BTW - if your definition of Designer is someone who does mockups in
PhotoShop and can't learn or use simple looping/logic concepts, then ammend
the role to Smart Designer or Junior Developer. ;-)

The Answer: JSP / JSP  StrutsTaglibs / Templates (Velocity, WebMacro,
Disney's Tea, etc.) / Alien Technology / 42???

 I doubt JSP will be the answer. JSP  Struts or standard Taglibs might
work - I'm curious to see the how the JSR-052 and Struts tags evolve,
especially to handle non-HTML output (WML anyone?)

 From what's available now - I'd put my money on a simple to use template
system like Velocity to do the trick.

Cheers,
Timothy






RE: some comparision between JSP/struts and velocity

2001-07-30 Thread Tim Colson

Scriptlets OK for view only?

Another developer in my group and I discussed this at length last week. I
believe scriptlets in the view to be bad practice...or at least a slippery
slope towards badness. grin

I suggest that there are two levels of separation we are trying to achieve.

1) Separation of Business Logic from Display logic
2) Separation of Developer tasks from Designer tasks

I'd bet we all mostly agree and accept the first type as good MVC practice,
and Struts does this quite well. The second type, though, would be violated
by putting scriptlets into the View, something JSP does not prevent.

While not violating MVC - the resulting View needs a Designer who knows
Java.

The counter-argument usually goes like so, Well, there's JavaScript on the
page, and the Designer understands that... and the JSP Scriptlet is Java
which kinda looks like JavaScript...ergo, the Designer should be okay with
that too.

Slippery Slope. The Designer probably copied the JS from a Script archive,
or used a WYSIWIG tool like DreamWeaver to build the script... ;-)

BTW - the scriptlet was written because the existing taglibs either couldn't
do what we needed, or at least it was taking too much time to figure out if
they could. If we had Velocity as an option, I could have written the
necessary bits without the complication of Java in short order. I'm not sure
the Designer would understand it, but I'm betting I'd have an easier time
explaining the minimal Velocity directives versus the Java  grin

Cheers,
Tim Colson











RE: some comparision between JSP/struts and velocity

2001-07-30 Thread Tim Colson

 Niall Pemberton suggested
 ...if the Struts tags dont do what you want then write your
 own. Then you dont have to use scriptlets, you have a re-useable bit of
 functionality, the web designers are happy and you dont have to use
 Velocity.
While a custom tag is an option; this bit of functionality would have
required embedding  javascript code and html inside the custom tag lib. To
me, putting view specific code like inside a tag library is also a slippery
slope in the quest to keep thing separated.

Cheers,
Timothy




RE: Welcome Page Action

2001-07-14 Thread Tim Colson

Ted suggested this solution to solve having a  welcome page redirect to a
struts action.

I tried it but encountered an issue because my default action requires
tomcat-based authentication.

Ex. path=/protected/mainmenu.do

The redirect to this action works for http://host:8080/myapp/ -
mainmenu.do, however, the user is not prompted for authentication.
Presumably because authentication (handled in web.xml for all /protected/*
URI's) happens prior to the struts logic:forward activity.

mainmenu.do freaks out a bit, because it expects to only be seen by an
authenticated user.

Suggestions on how one might fix that?

Thanks,
Timothy



 index.jsp:

 %
 /**
  * Redirect default requests to Welcome action.
 */
 %
 %@ page language=java %
 %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
 logic:forward name=welcome/

 Struts-config:

 global-forwards
  forward
 name=welcome
 path=/announcements.do/
 /global-forwards

 You could also use announcements instead of welcome, but I tend to
 standardize on forwarding to Welcome and put the specifics in the
 config.


 -- Ted Husted, Husted dot Com, Fairport NY USA.
 -- Custom Software ~ Technical Services.
 -- Tel 716 737-3463.
 -- http://www.husted.com/about/struts/


 Calvin Lau wrote:
 
  I'm trying to figure out the best way of making my
  welcome page (index.jsp) run an action that will show
  my annoucements.  I have an AnnouncementsForm that I
  use with announcements.do elsewhere, but I'm not sure
  how I should make the index.jsp page run this same
  action.  Is there any way to map an action to this
  page without making all other .jsp pages go through
  the Action servlet?
 
  The makeshift solution I have now is to change the
  name of my jsp file to index.do and to make that my
  welcome page.  This hardly seems like a good solution
  though and I would think this problem has come up
  often enough where there's something better.  I
  imagine many welcome pages have dynamic content that
  requires an action to be run.





RE: multiple checkboxes (was: Radio Button Example using boolean?)

2001-07-12 Thread Tim Colson

Suhas -

 I already posted a answer to Q like this [using radio buttons]
Yes indeed - many thanks for that!!!  :-)

It was quite helpful - a lot of folks answer with partial snippets, but
don't cover all that is necessary to make the thing work. Even the example
apps (which are the model I've been following for much help) sometimes make
it difficult to apply when for example, the multi-select is populated by a
page-context scriptlet instead of the Action...or should it come from the
formand then how does the syntax of the tag change... etc. etc.

Unfortunately, these details which may be obvious to those experienced with
the framework - cause headaches for those of us who are just starting out.

Struts has been a bit complicated to get started with. Code has to be
written in 4 or more places (struts-config, action class, form class, view
JSP, model bean, view bean).

It's all starting to make sense - but it's a _tremendous_ help to see
complete examples with all the details included.

Thanks again!
Timothy




RE: Bean Introspection and bean:write tag

2001-07-08 Thread Tim Colson

Martin - et. al. -

 What you are seeing is the correct behaviour.
 Hope this helps.

Thanks for the info - it certainly makes sense, but ultimately you didn't
answer my question, just re-phrased it. ;-)

What is the getter name for this property?.

So what IS the getter name for this property - LastName ?

BTW - Bean introspection feature or not - it could be a hard sell to get
designer folk to write correct cased properties... especially if they are
accustomed to using LastName and I can't seem to handle that. Makes the
developer guy (me) appear not so smart. grin

So what IS the getter name for this property - LASTNAME = get???
So what IS the getter name for this property - lastname = get???

Thanks! :-)
Timothy

 - Original Message -
 From: Tim Colson [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, July 06, 2001 12:12 PM
 Subject: Bean Introspection and bean:write tag


  As per the bean: struts API docs, I've included an Employee
 type object
  into the request scope called emp.
 
  emp can get/set the mLastName property using getLastName() and
  setLastName()
 
  However - when I try the following
 
  bean:write name=emp property=LastName/
 
  I'm told that there is no getter method
  javax.servlet.ServletException: No getter method for property
 LastName of
  bean
 
  If I make the property initial lower case, it works fine:
  bean:write name=emp property=lastName/
 
 
  The Bean Spec Section 8.8 says this about capitalization:
  So for example, FooBah becomes fooBah
  ---
  So for example, LastName becomes lastName
  I tried adding the accessor getlastName() to my Employee class - still
  fails.
 
  Property   - get method: result
  -
  lastName - getLastName() : OK
  LastName - getLastName() : Fails
  LastName - getlastName() : Fails
  LastName - get?()
 
  I searched the archives and read more of the bean spec - but didn't pull
 up
  anything useful on this. :-(
 
  Thanks,
  Tim
 
 







Bean Introspection and bean:write tag

2001-07-06 Thread Tim Colson

As per the bean: struts API docs, I've included an Employee type object
into the request scope called emp.

emp can get/set the mLastName property using getLastName() and
setLastName()

However - when I try the following

bean:write name=emp property=LastName/

I'm told that there is no getter method
javax.servlet.ServletException: No getter method for property LastName of
bean

If I make the property initial lower case, it works fine:
bean:write name=emp property=lastName/


The Bean Spec Section 8.8 says this about capitalization:
So for example, “FooBah” becomes “fooBah”
---
So for example, “LastName” becomes “lastName”
I tried adding the accessor getlastName() to my Employee class - still
fails.

Property   - get method: result
-
lastName - getLastName() : OK
LastName - getLastName() : Fails
LastName - getlastName() : Fails
LastName - get?()

I searched the archives and read more of the bean spec - but didn't pull up
anything useful on this. :-(

Thanks,
Tim




Templates located in WEB-INF?

2001-07-02 Thread Tim Colson

Is it possible to hide all JSP files under the /WEB-INF/ directory and
still use templates??

I had some difficulties with the following code finding the
main_content.jsp page. Should this work or am I trying to do something
that is known to not work?

(BTW - The code seems to run fine if I put the /jsp directory inside the
context root.)

Thanks!
Tim Colson

%@ page language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %

template:insert template='/WEB-INF/jsp/layout1.jsp'
  template:put name='title'
   bean:message key=main.menu.title/
  /template:put
  template:put name='header' content='/header' direct='true' /
  template:put name='sidebar' content='sidenav'  direct='true'/
  template:put name='content' content='/WEB-INF/jsp/main_content.jsp' /
  template:put name='footer' content='/footer' direct='true' /
/template:insert