You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Hunt <te...@yahoo.com> on 2001/01/27 04:02:35 UTC

tag exception in template

Does any one know why we get this exception when we
use templates.. The message makes sense.. I mean how
did u fix ??? I am using only templates.. No custom
tags.

javax.servlet.jsp.JspTagException: Since tag handler
class org.apache.struts.taglib.template.PutTag does
not implement BodyTag, it can't return
BodyTag.EVAL_BODY_TAG


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices. 
http://auctions.yahoo.com/

Re: strut html tags

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Elod Horvath wrote:

> "Craig R. McClanahan" wrote:
> >
> > Daniel Ostermeier wrote:
> >
> > > What is the point of the strut html tags when all they
> > > appear to do is print out there corresponding raw html?
> > > Why not just use the raw html?
> > >
> > > Daniel
> >
> > Consider the case where the user made some errors, and you wish to
> > redisplay the input form -- but already filled out with the values that
> > the user entered last time, along with one or more error messages (i.e.
> > the way that GUI programs behave).
> >
> > The Struts tags do this automatically for you.  Otherwise, you will have
> > to do it yourself somehow.  They also do other convenient things:
> > * Automatically filter for characters like "<" that are significant in
> > HTML
> > * Automatically call response.encodeURL() to maintain session state
> >   when you are not using cookies.
> > * Automatically recognize what Locale is in use, and select message
> >   strings in the corresponding language.
> > * Automatically include a transactional control token to guard against
> >   duplicate submits of the same form.
> >
> > All of this can obviously be done with raw HTML, or HTML plus some
> > scriptlets in a JSP page - but it is substantially more convenient to
> > take advantage of the intelligence in the custom tags that generate
> > different HTML depending upon the precise circumstances.
> >
>
> my only issue with this is that it's hard to prototype the form layout
> without running the whole environment.

This is not really accurate, if you are talking about prototyping the look and
feel of the pages.  If the <html:form> tag finds that you have not created a
request or session attribute containing this bean (i.e. you call the page
directly), it will happily create one for you - with whatever default values
you've defined in your bean.  This is normally good enough for prototyping.

>  generally, i'm not to big on
> custom tags generating markup (unless it's really really complicated
> boiler plating) -- it's difficult and tedious to correct the HTML in
> the java code.  and i'm not too thrilled about the idea of adding
> another layer into the development process for recognizing
> the custom tags in order to render them (i'm not sure how far this can
> go and be successful).

Try it with Macromedia UltraDev, or another IDE that has support for running
"live" JSP pages inside the development environment.  You can go a *long*
ways.  (Plus, when an editor understands what a custom tag is, it can give you
pop-ups to populate the attributes just like it does wizards for a <table> tag
and such.)

>  i guess i'm just an "old-timer" happy with
> my vi text editor eschewing all  these fancy schmancy gui IDEs
> that end up getting in my way more often than not.
>

Emacs rules ... vi drools ... :-)  I don't typically use IDEs myself, either.

But actually, it all comes down to what functionality you want in your pages.
Duplicating the functionality of what a Struts-based page actually does can
certainly be created manually (or with the help of another template language)
-- but at the cost of *lots* more keystrokes.  Consider a typical input field
with a prompt:

    <bean:message key="username.prompt"/>
    <html:text property="username"/>

in Struts, versus the equivalent:

    <% Locale locale = (Locale) session.getAttribute("locale"); %>
    <% String language = locale.getLanguage(); %>
    <% LoginBean loginBean = (LoginBean) session.getAttribute("login"); %>

    <% if ("en".equals(language)) { %>
      Username:
    <% } else if ("fr.equals(language)) { %>
        ...
    <% } %>
    <input type="text" name="username"
     value="<%= BeanUtils.filter(loginBean.getUsername()) %>">

in straight JSP.  If you were seriously internationalizing, you'd probably do
a page per language instead, which is also a maintenance nightmare when you
change look and feel.

>
> IMHO
> e
>

If you want to type straight HTML code, go for it ... you can use the rest of
the framework independent of the custom tags   But you'll quickly find
yourself getting tired of the tedious and repeititive coding needed to
reproduce the functionality.  (Of course, if you don't need or care for i18n,
or redisplaying a form with the previously filled out values, it may not
matter to you.)

>
> --
> _______________________________________________________________________
> Elod Horvath ('e')       /      ITFAIS Records (http://www.itfais.com/)

Craig



Re: strut html tags

Posted by Elod Horvath <el...@itfais.com>.
"Craig R. McClanahan" wrote:
> 
> Daniel Ostermeier wrote:
> 
> > What is the point of the strut html tags when all they
> > appear to do is print out there corresponding raw html?
> > Why not just use the raw html?
> >
> > Daniel
> 
> Consider the case where the user made some errors, and you wish to
> redisplay the input form -- but already filled out with the values that
> the user entered last time, along with one or more error messages (i.e.
> the way that GUI programs behave).
> 
> The Struts tags do this automatically for you.  Otherwise, you will have
> to do it yourself somehow.  They also do other convenient things:
> * Automatically filter for characters like "<" that are significant in
> HTML
> * Automatically call response.encodeURL() to maintain session state
>   when you are not using cookies.
> * Automatically recognize what Locale is in use, and select message
>   strings in the corresponding language.
> * Automatically include a transactional control token to guard against
>   duplicate submits of the same form.
> 
> All of this can obviously be done with raw HTML, or HTML plus some
> scriptlets in a JSP page - but it is substantially more convenient to
> take advantage of the intelligence in the custom tags that generate
> different HTML depending upon the precise circumstances.
> 


my only issue with this is that it's hard to prototype the form layout
without running the whole environment.  generally, i'm not to big on
custom tags generating markup (unless it's really really complicated
boiler plating) -- it's difficult and tedious to correct the HTML in 
the java code.  and i'm not too thrilled about the idea of adding
another layer into the development process for recognizing
the custom tags in order to render them (i'm not sure how far this can
go and be successful).  i guess i'm just an "old-timer" happy with
my vi text editor eschewing all  these fancy schmancy gui IDEs 
that end up getting in my way more often than not.

IMHO
e

-- 
_______________________________________________________________________
Elod Horvath ('e')       /      ITFAIS Records (http://www.itfais.com/)

Re: strut html tags

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Daniel Ostermeier wrote:

> What is the point of the strut html tags when all they
> appear to do is print out there corresponding raw html?
> Why not just use the raw html?
>
> Daniel

Consider the case where the user made some errors, and you wish to
redisplay the input form -- but already filled out with the values that
the user entered last time, along with one or more error messages (i.e.
the way that GUI programs behave).

The Struts tags do this automatically for you.  Otherwise, you will have
to do it yourself somehow.  They also do other convenient things:
* Automatically filter for characters like "<" that are significant in
HTML
* Automatically call response.encodeURL() to maintain session state
  when you are not using cookies.
* Automatically recognize what Locale is in use, and select message
  strings in the corresponding language.
* Automatically include a transactional control token to guard against
  duplicate submits of the same form.

All of this can obviously be done with raw HTML, or HTML plus some
scriptlets in a JSP page - but it is substantially more convenient to
take advantage of the intelligence in the custom tags that generate
different HTML depending upon the precise circumstances.

Craig McClanahan



strut html tags

Posted by Daniel Ostermeier <da...@cortexebusiness.com.au>.
What is the point of the strut html tags when all they 
appear to do is print out there corresponding raw html?
Why not just use the raw html?

Daniel