You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ted Husted <hu...@apache.org> on 2001/04/22 14:25:26 UTC

Re: always wants form bean

For a simple form with a single field that doesn't need validation you
can specify a name and type, e.g. 

<html:form action="lot.do" name="id" type="java.lang.String">

otherwise, yes, you do have to give Struts a bean where it can save the
fields in your form.

Vimal Kansal wrote:
> 
> Hi,
> 
> I am having a strange problem.
> 
> I have an action nmapping defined as
> 
>   <action path="/viewadminconfig" type="...">
>      <forward name="success"
> path="/XDIViewAdminConfigForm.jsp" />
>   </action>
> 
> And then in my XDIViewAdminConfigForm.jsp, I have the
> following :
> 
>   <html:form onsubmit="..."
> action="/viewadminconfig.do">
> 
> ....
> 
> </html:form>
> 
> When I request this,  I get the following exception :
> 
> "javax.servlet.jsp.jSpException : Cannot retrieve
> definition for form bean null
> at
> org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:708)
> ....
> 
> Do I always have to associate a form bean with a form.
> 
> Vimal

Re: always wants form bean

Posted by Ted Husted <hu...@apache.org>.
Actually, I just realized I mixed-and-matched regular HTML and Struts
tags, like this:

<html:form action="lotFind.do" name="text" type="java.lang.String">
Word Search: <input name="text" size="12"><input type="submit"
value="GO" name="submit">
</html:form>

Which manages to resolve the mappings and retain the session information
with or without cookies.

The action expects text={word}

Jim Crossley wrote:
> 
> So what would the value of your 'property' attribute be???
> 
> <html:form action="lot.do" name="id" type="java.lang.String">
>   <html:text property="??????"/>
> </html:form>
> 
> Ted Husted wrote:
> >
> > > I'm curious...
> > > For that to work, what property of java.lang.String should the
> > > <html:text> tag reference?  I'm assuming the single field would use an
> > > <html:text> tag, right?
> >
> > Mine do, but I don't think it would matter, since all the HTML form
> > fields resolve to strings so they can be transmitted by HTTP.
> >
> > > Ted Husted wrote:
> > > >
> > > > For a simple form with a single field that doesn't need validation you
> > > > can specify a name and type, e.g.
> > > >
> > > > <html:form action="lot.do" name="id" type="java.lang.String">
> > >

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

Re: always wants form bean

Posted by Jim Crossley <ji...@lads.com>.
So what would the value of your 'property' attribute be???

<html:form action="lot.do" name="id" type="java.lang.String">
  <html:text property="??????"/>
</html:form>


Ted Husted wrote:
> 
> > I'm curious...
> > For that to work, what property of java.lang.String should the
> > <html:text> tag reference?  I'm assuming the single field would use an
> > <html:text> tag, right?
> 
> Mine do, but I don't think it would matter, since all the HTML form
> fields resolve to strings so they can be transmitted by HTTP.
> 
> > Ted Husted wrote:
> > >
> > > For a simple form with a single field that doesn't need validation you
> > > can specify a name and type, e.g.
> > >
> > > <html:form action="lot.do" name="id" type="java.lang.String">
> >

Re: always wants form bean

Posted by Ted Husted <hu...@apache.org>.
> I'm curious...
> For that to work, what property of java.lang.String should the
> <html:text> tag reference?  I'm assuming the single field would use an
> <html:text> tag, right?

Mine do, but I don't think it would matter, since all the HTML form
fields resolve to strings so they can be transmitted by HTTP.

> Ted Husted wrote:
> >
> > For a simple form with a single field that doesn't need validation you
> > can specify a name and type, e.g.
> >
> > <html:form action="lot.do" name="id" type="java.lang.String">
>

Re: always wants form bean

Posted by Jim Crossley <ji...@lads.com>.
I'm curious...

Ted Husted wrote:
> 
> For a simple form with a single field that doesn't need validation you
> can specify a name and type, e.g.
> 
> <html:form action="lot.do" name="id" type="java.lang.String">

For that to work, what property of java.lang.String should the
<html:text> tag reference?  I'm assuming the single field would use an
<html:text> tag, right?

Re: always wants form bean

Posted by Jim Crossley <ji...@lads.com>.
Nested properties already provide for "objects as members of the form".

See
http://jakarta.apache.org/struts/api/org/apache/struts/taglib/bean/package-summary.html#doc.Properties

Chris Butler wrote:
> 
> Has there been any interest in allowing ActionForms
> to have objects as members of the form?
> 
> ie. dividing registration into user/address/contact/subscriptions
> sorts of sub-beans...
> 
> chris
> 
> At 08:25 AM 4/22/2001 -0400, Ted Husted wrote:
> >For a simple form with a single field that doesn't need validation you
> >can specify a name and type, e.g.
> >
> >otherwise, yes, you do have to give Struts a bean where it can save the
> >fields in your form. Vimal Kansal wrote: > > Hi, > > I am having a strange
> >problem. > > I have an action nmapping defined as > > >
> >path="/XDIViewAdminConfigForm.jsp" /> > > > And then in my
> >XDIViewAdminConfigForm.jsp, I have the > following : > >
> >action="/viewadminconfig.do"> > > .... > > > > When I request this, I get
> >the following exception : > > "javax.servlet.jsp.jSpException : Cannot
> >retrieve > definition for form bean null > at >
> >org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:708) > .... > >
> >Do I always have to associate a form bean with a form. > > Vimal

Re: always wants form bean

Posted by Chris Butler <pa...@orpheusdesign.com>.
Has there been any interest in allowing ActionForms
to have objects as members of the form?

ie. dividing registration into user/address/contact/subscriptions
sorts of sub-beans...

chris

At 08:25 AM 4/22/2001 -0400, Ted Husted wrote:
>For a simple form with a single field that doesn't need validation you
>can specify a name and type, e.g.
>
>otherwise, yes, you do have to give Struts a bean where it can save the 
>fields in your form. Vimal Kansal wrote: > > Hi, > > I am having a strange 
>problem. > > I have an action nmapping defined as > > > 
>path="/XDIViewAdminConfigForm.jsp" /> > > > And then in my 
>XDIViewAdminConfigForm.jsp, I have the > following : > > 
>action="/viewadminconfig.do"> > > .... > > > > When I request this, I get 
>the following exception : > > "javax.servlet.jsp.jSpException : Cannot 
>retrieve > definition for form bean null > at > 
>org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:708) > .... > > 
>Do I always have to associate a form bean with a form. > > Vimal