I really don't know how to explain things any more clearly.  I suggest you
buy a Struts book, and check out the documentation for the tag libraries on
the Struts web site.  Your bean:define tags make absolutely no sense.
Please read the following:

http://jakarta.apache.org/struts/userGuide/struts-bean.html#define

In particular:

The corresponding value to which this new attribute (and scripting variable)
is set are specified via use of exactly *one* of the following approaches
(trying to use more than one will result in a JspException being thrown):

Specify a name attribute (plus optional property and scope attributes) - The
created attribute and scripting variable will be of the type of the
retrieved JavaBean property, unless it is a Java primitive type, in which
case it will be wrapped in the appropriate wrapper class (i.e. int is
wrapped by java.lang.Integer).

Specify a value attribute - The created attribute and scripting variable
will be of type java.lang.String, set to the value of this attribute.

Specify nested body content - The created attribute and scripting variable
will be of type java.lang.String, set to the value of the nested body
content.

--

Your bean:define tags are performing both 1 and 2 and hence, according to
the doc, a JspException should be thrown.  As I also mentioned, they seem to
make no semantic sense for the context you provided in your e-mail.  Why are
you creating scripting variables via bean:define?  What is the purpose of
this step?

-Steve

-----Original Message-----
From: Vance Heredia [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 12:01 AM
To: 'Struts Users Mailing List'
Subject: RE: Bean tag help



Huh ???? Sorry but you've lost me completely ...

Maybe I should have explained that I've never programmed struts before and
that I've been assigned to fix up the work of a person who has left the
project, and while I've understood, overcome and finished most of the
concepts and problems this particular one completely stumps me.

I should also point out that all exmples of <beans:*  usage from the web do
not appear to work on and have the same error.  Even the exmaples from
Apache.

Cheers

Vance

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vance Heredia

Java Wireless Architect
Global Applications
Lonely Planet Publications
Email: [EMAIL PROTECTED]
Phone: +61 3 8379 8000

http://www.lonelyplanet.com/
http://mobile.lonelyplanet.com/
http://wap.lonelyplanet.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> -----Original Message-----
> From: Steve Armstrong [mailto:[EMAIL PROTECTED]
> Sent: Friday, 8 August 2003 1:01 PM
> To: Struts Users Mailing List
> Subject: RE: Bean tag help
>
>
> Howdy,
>
> There are a number of things that are incorrect in your example:
>
> 1. Concerning your definition:
>
> <bean:define id="processName" name="filesForm"
> property="processName" value = "filesForm" type="java.lang.Object" />
>
> You can set the value of your scripting variable
> "processName" from a bean, a property of a bean, or a
> "hard-coded" value.  I believe you are trying to set your
> scripting variable from the "processName" property of a bean
> named "filesForm" (i.e., filesForm.getProcessName()).
> However, you also specify a value attribute which probably
> overrides this (I'd have to look at the source code for the
> tag to see how it is actually resolving this ambiguity) which
> would set your scripting variable "processName" to the String
> "filesForm".  This is probably not what you want.
>
> 2.  I believe that as soon as you use the value attribute,
> the scripting variable will automatically be set to
> java.lang.String and your value for the type attribute is
> promptly ignored.  Once again, I'd have to look at the source
> for the tag to be 100% sure.  Anyway, you have to set the
> type attribute correctly if you're getting the value from a
> bean or the property of a bean, otherwise the type is
> java.lang.Object by default.  So, if your getter for
> processName returns a String, specify that the type of the
> define is java.lang.String.
>
> 3. There is no need to create a scripting variable as above
> to be able to do <html:hidden property="processName"/>.  This
> is saying that you want to create an HTML form input tag of
> type hidden with the value of the named property associated
> with the form bean that is associated with your action. I
> assume that "filesForm" is the bean associated with your
> action, and it has a property named "processName".  If this
> is a request scope form bean, and the value of "processName"
> isn't editable (i.e., it isn't used in a text field on your
> form), and you want its original value to be set in your form
> bean when the form is submitted, then the html:hidden tag is
> all you need. Your bean:define is trying to set a scripting
> variable with the same name (and value) as your form bean
> property and has nothing to do with the task you're trying to
> accomplish (I believe).
>
> Cheers,
> -Steve
>
> -----Original Message-----
> From: Vance Heredia [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 07, 2003 8:33 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Bean tag help
>
>
>
> Hmmmmm
>
> Why do I need a bean name and type in struts-conifg.
>
> The JSP I'm running is a basic page all it does is user the
> bean tag eg:
>
> <snippet>
>
> <%@ page language="java" import="java.net.URLEncoder"
> contentType="text/html;charset=utf-8" %> <%@ taglib
> uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib
> uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib
> uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib
> uri="/WEB-INF/controls.tld" prefix="controls" %>
>
> <html:html locale="true">
>
> body bgcolor="white" background="/images/PaperTexture.gif">
>
> <!--Form -->
>
> <html:errors/>
>
> <html:form method="POST" action="/files">
>   <bean:define id="processName" name="filesForm"
> property="processName" value = "filesForm" type="java.lang.Object" />
>   <bean:define id="folder" name="filesForm" property="folder"
> value = "filesForm" type="java.lang.Object" />
>   <html:hidden property="folder"/>
>   <html:hidden property="processName"/>
>
> </snippet>
>
> It always dies on the first bean saying it had a
> ClassCastEsception when trying to locate the Start tag
>
> I'm not clear asd to why you need to use a bean name and type??
>
> Examples would be good
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Vance Heredia
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> > -----Original Message-----
> > From: Rohit Aeron [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, 7 August 2003 6:36 PM
> > To: Struts Users Mailing List
> > Subject: RE: Bean tag help
> >
> >
> >
> > Just cross check that you are importing
> > 1. taglib
> > 2. bean
> > 3. correctly specified bean name & type in struts-config.
> >
> > Regards
> > Rohit
> >
> >
> >
> > > Hey People
> > >
> > > Ay ideas on how to fix my bean proble?
> > >
> > > Every time I try to uyse the <bean:* tag in struts I get a
> > >
> > > java.lang.ClassCastException
> > >   at
> > org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:766)
> > >   at
> > > org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:481)
> > >   at org.apache.jsp.files_jsp._jspService(files_jsp.java:149)
> > >
> > >
> > > The Java code looks like
> > >
> > >           _jspx_th_html_form_0.setParent(_jspx_th_html_html_0);
> > >           _jspx_th_html_form_0.setMethod("POST");
> > >           _jspx_th_html_form_0.setAction("/files");
> > >   149->  int _jspx_eval_html_form_0 =
> > _jspx_th_html_form_0.doStartTag();
> > >           if (_jspx_eval_html_form_0 !=
> > > javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
> > >             do {
> > >               out.write("\r\n  ");
> > >               /* ----  bean:define ---- */
> > >               java.lang.Object processName = null;
> > >               org.apache.struts.taglib.bean.DefineTag
> > > _jspx_th_bean_define_0 = (org.apache.struts.taglib.bean.DefineTag)
> > >
> >
> _jspx_tagPool_bean_define_property_name_id.get(org.apache.struts.tagli
> > > b.bean
> > > .DefineTag.class);
> > >
> > >
> > > I havent worked a lot on struts and beans so I'm not too
> > sure how to
> > > fix it
> > >
> > > Cheers
> > >
> > > Vance
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > Vance Heredia
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >
> > >
> >
> ______________________________________________________________________
> > > This email, including attachments, is intended only for the
> > addressee
> > > and may be confidential, privileged and subject to
> > copyright.  If you
> > > have received this email in error, please advise the sender
> > and delete
> > > it.  If you are not the intended recipient of this email,
> > you must not
> > > use, copy or disclose its content to anyone.  You must
> not copy or
> > > communicate to others content that is confidential or subject to
> > > copyright, unless you have the consent of the content owner.
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > *----------
> > This message and any attachment(s) is intended only for the
> use of the
> > addressee(s) and may contain information that is PRIVILEGED and
> > CONFIDENTIAL. If you are not the intended addressee(s), you
> are hereby
> > notified that any use, distribution, disclosure or copying of this
> > communication is strictly prohibited. If you have received this
> > communication in error, please erase all copies of the
> message and its
> > attachment(s) and notify the sender or Kanbay postmaster
> immediately.
> >
> > Any views expressed in this message are those of the
> individual sender
> > and not of Kanbay.
> >
> > Although we have taken steps to ensure that this e-mail and any
> > attachment(s) are free from any virus, we advise that in
> keeping with
> > good computing practice the recipient should ensure they
> are actually
> > virus free.
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> ______________________________________________________________________
> This email, including attachments, is intended only for the
> addressee and may be confidential, privileged and subject to
> copyright.  If you have received this email in error, please
> advise the sender and delete it.  If you are not the intended
> recipient of this email, you must not use, copy or disclose
> its content to anyone.  You must not copy or communicate to
> others content that is confidential or subject to copyright,
> unless you have the consent of the content owner.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

______________________________________________________________________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright.  If you
have received this email in error, please advise the sender and delete
it.  If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone.  You must not copy or
communicate to others content that is confidential or subject to
copyright, unless you have the consent of the content owner.


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

Reply via email to