You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Firmin David <da...@capco.com> on 2001/03/14 12:12:43 UTC

Scope and re-display with errors problem...

Hi all,
I make a request from a menu frame for a list of items, and they are then
displayed in the adjacent main frame. Before the page is displayed, the
"list" object is put in *request* scope in the code. If the user enters
invalid data and submits the form (of which the list is a part), the page
cannot be redisplayed with the associated errors as the "list" object is no
longer visible to it. I have no wish (for a multitude of reasons) to put the
"list" object in the session even though it would solve the problem.
Is there another way around this? I have tried <bean:define> with
toScope="request" in the original page but clearly cannot call the new
variable the same thing, meaning that all my references to the bean within
the page become invalid. (I am unsure whether or not this would've worked
anyway)

Any help in finding a way of doing this without using session scope would be
very gratefully received!

Thanks in advance

Rgds
David

************************************************************************
The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, you must not read, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of
The Capital Markets Company.

http://www.capco.com
***********************************************************************


Populating ActionForm

Posted by Frank Ling <st...@hotmail.com>.
Hi, There:

Here is the some question I have for the from populating, This maybe a
stupid question.

In the my simple search functionality Project.

I have the form-action combination as following.

PaymentSearchAction    PaymentSearchForm

DisplayStmAction          DisplayStmForm

in the PaymentSearchForm I take in all the search conditions, like
consultant name, stating date, ending date etc, then PaymentSearchAction
will perform the search and get all the result set in the session, then I
need populate all the result to DisplayStmForm, based on the setting in
struts-config.xml,  DisplayStmAction is the guy can access DisplayStmForm,
then the question is How DisplayStmAction can take control from this point
automaticlly, then I can populate the DisplayStmForm.

By another word, how can I jump from paymentSearchAction to DisplayStmAction
automatically, then I can use PaymentSearchAction populate PaymentSearchForm
to do the search then automatically switch to DisplayStmAction to populate
DisplayStmForm for the display.

Thanks

Frank Ling

Re: Missing Property

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 16 Mar 2001, Marty Fisher wrote:

> I cleared up the 500 error below by enclosing the bean:write with a logic:present tag.
> As a newbie I'm happy to get it working and am interested in why it does.
> 
>       <logic:iterate id="list" name="jobQueueForm" property="JqRow">
>             <logic:present name="list" >
>                  <bean:write name="list" />
>             </logic:present>
>       </logic:iterate>
> 

Does your String array have any null values in it?  There is an
outstanding bug report about that right now.

Also, at one point the <logic:iterate> tag had a bug where it did not
actually expose the loop control variable ("list" in your example) to the
rest of the page.  This was fixed several weeks ago, but if your copy of
Struts is quite old it may still have this problem.

> Thanks
> 

Craig


Re: Missing Property

Posted by Marty Fisher <mf...@systemslink.com>.
I cleared up the 500 error below by enclosing the bean:write with a logic:present tag.
As a newbie I'm happy to get it working and am interested in why it does.

      <logic:iterate id="list" name="jobQueueForm" property="JqRow">
            <logic:present name="list" >
                 <bean:write name="list" />
            </logic:present>
      </logic:iterate>

Thanks

Marty Fisher wrote:

> Thanks, that did the trick - sort of.  There is the correct amount of data being
> displayed and then an usuall error.
>
>      1 U COMMAND1 2000-01-01 00:00:00.0 2000-01-01 00:00:00.0 P mfisher 2000-01-01
> 00:00:00.0 N 0 0 0 LOG 2
>
>      500 Internal Server Error
>
>      /struts/jobQueue.do:
>
>      javax.servlet.ServletException: Exception thrown processing JSP page.
>      javax.servlet.jsp.JspException: No bean found for attribute key list
>
> If no bean can be found, where did the '1 U COMMAND1 ...' come from ?.  That line is
> the correct contents of the String [] jqRow property.  It looks like the iterate
> choked when it ran out of data.  Is that possible ?
>
> Thanks again,
> Marty Fisher
>
> Jean-Noel Ribette wrote:
>
> > > The jsp code:
> > >
> > >           <jsp:useBean id="jobQueueForm" type="JobQueueForm" />
> > >
> > >           <logic:iterate id="list" name="jobQueueForm" property="JqRow">
> > >                  <bean:write name="list" />
> > >           </logic:iterate>
> > >
> > > The form code:
> > >
> > >           public String [] getJqRow ()
> > >          {
> > >                    .
> > >                    .
> > >                    .
> > >          }
> > >
> > > The error:
> > >
> > >          javax.servlet.jsp.JspException: No getter method for bean jobQueueForm
> > > and property JqRow
> > >
> > >
> > > Other jsps use different properties of the form with no problem.  Any
> > > suggestions ?
> > >
> > I think it is a problem with Javabean naming convention.
> > Try to replace property="JqRow" by property="jqRow".
> >
> > Jean-Noël
>
> --
> Marty Fisher
> Cranbury
> 609-409-0909
> HNC Software, Inc. (formerly Systems/Link Corporation)
>
> The information contained in this transmission is privileged and/or confidential
> information intended for the use of the individual(s) or entity named above. If
> the reader of this message is not the intended recipient, you are hereby notified
> that any dissemination, distribution, or copying of this communication is strictly
> prohibited.

--
Marty Fisher
Cranbury
609-409-0909
HNC Software, Inc. (formerly Systems/Link Corporation)

The information contained in this transmission is privileged and/or confidential
information intended for the use of the individual(s) or entity named above. If
the reader of this message is not the intended recipient, you are hereby notified
that any dissemination, distribution, or copying of this communication is strictly
prohibited.



Re: Missing Property

Posted by Marty Fisher <mf...@systemslink.com>.
Thanks, that did the trick - sort of.  There is the correct amount of data being
displayed and then an usuall error.

     1 U COMMAND1 2000-01-01 00:00:00.0 2000-01-01 00:00:00.0 P mfisher 2000-01-01
00:00:00.0 N 0 0 0 LOG 2

     500 Internal Server Error

     /struts/jobQueue.do:

     javax.servlet.ServletException: Exception thrown processing JSP page.
     javax.servlet.jsp.JspException: No bean found for attribute key list

If no bean can be found, where did the '1 U COMMAND1 ...' come from ?.  That line is
the correct contents of the String [] jqRow property.  It looks like the iterate
choked when it ran out of data.  Is that possible ?

Thanks again,
Marty Fisher

Jean-Noel Ribette wrote:

> > The jsp code:
> >
> >           <jsp:useBean id="jobQueueForm" type="JobQueueForm" />
> >
> >           <logic:iterate id="list" name="jobQueueForm" property="JqRow">
> >                  <bean:write name="list" />
> >           </logic:iterate>
> >
> > The form code:
> >
> >           public String [] getJqRow ()
> >          {
> >                    .
> >                    .
> >                    .
> >          }
> >
> > The error:
> >
> >          javax.servlet.jsp.JspException: No getter method for bean jobQueueForm
> > and property JqRow
> >
> >
> > Other jsps use different properties of the form with no problem.  Any
> > suggestions ?
> >
> I think it is a problem with Javabean naming convention.
> Try to replace property="JqRow" by property="jqRow".
>
> Jean-Noël

--
Marty Fisher
Cranbury
609-409-0909
HNC Software, Inc. (formerly Systems/Link Corporation)

The information contained in this transmission is privileged and/or confidential
information intended for the use of the individual(s) or entity named above. If
the reader of this message is not the intended recipient, you are hereby notified
that any dissemination, distribution, or copying of this communication is strictly
prohibited.



Re: Missing Property

Posted by Maya Muchnik <mm...@pumatech.com>.
Good eye!

Jean-Noel Ribette wrote:

> > The jsp code:
> >
> >           <jsp:useBean id="jobQueueForm" type="JobQueueForm" />
> >
> >           <logic:iterate id="list" name="jobQueueForm" property="JqRow">
> >                  <bean:write name="list" />
> >           </logic:iterate>
> >
> > The form code:
> >
> >           public String [] getJqRow ()
> >          {
> >                    .
> >                    .
> >                    .
> >          }
> >
> > The error:
> >
> >          javax.servlet.jsp.JspException: No getter method for bean jobQueueForm
> > and property JqRow
> >
> >
> > Other jsps use different properties of the form with no problem.  Any
> > suggestions ?
> >
> I think it is a problem with Javabean naming convention.
> Try to replace property="JqRow" by property="jqRow".
>
> Jean-Noël


Populate ActionForm

Posted by Frank Ling <st...@hotmail.com>.
Hi, There:

Here is the some question I have for the from populating, This maybe a
stupid question.

In the my simple search functionality Project.

I have the form-action combination as following.

PaymentSearchAction    PaymentSearchForm

DisplayStmAction          DisplayStmForm

in the PaymentSearchForm I take in all the search conditions, like
consultant name, stating date, ending date etc, then PaymentSearchAction
will perform the search and get all the result set in the session, then I
need populate all the result to DisplayStmForm, based on the setting in
struts-config.xml,  DisplayStmAction is the guy can access DisplayStmForm,
then the question is How DisplayStmAction can take control from this point
automaticlly, then I can populate the DisplayStmForm.

By another word, how can I jump from paymentSearchAction to DisplayStmAction
automatically, then I can use PaymentSearchAction populate PaymentSearchForm
to do the search then automatically switch to DisplayStmAction to populate
DisplayStmForm for the display.

Thanks

Frank Ling

Re: Missing Property

Posted by Maya Muchnik <mm...@pumatech.com>.
I think we have email archive for JavaBean convention. Here is a short answer:

when a property getter method has two or more upper case letters, then the property is
interpreted without change getter method. So if you have getAAA(), the property is
AAA. If you have getAaA(), then the property is aaA.


Ken Beyer wrote:

> On the same thread... can someone tell me why I can't put ....
>     property="aBCDefg" with a bean getter of "getABCDefg()"
>
> Note the 2nd char being an uppercase "B".  I were to make the "B" a
> lowercase "b",  it works.  The problem stems from the 2nd char in the
> property name being a capital.  I'm on Tomcat 3.3m1 + Struts 1.0b1
>
> Any advice?   is this a bug?
> Thx-
> Ken
>
> Jean-Noel Ribette wrote:
>
> > > The jsp code:
> > >
> > >           <jsp:useBean id="jobQueueForm" type="JobQueueForm" />
> > >
> > >           <logic:iterate id="list" name="jobQueueForm" property="JqRow">
> > >                  <bean:write name="list" />
> > >           </logic:iterate>
> > >
> > > The form code:
> > >
> > >           public String [] getJqRow ()
> > >          {
> > >                    .
> > >                    .
> > >                    .
> > >          }
> > >
> > > The error:
> > >
> > >          javax.servlet.jsp.JspException: No getter method for bean jobQueueForm
> > > and property JqRow
> > >
> > >
> > > Other jsps use different properties of the form with no problem.  Any
> > > suggestions ?
> > >
> > I think it is a problem with Javabean naming convention.
> > Try to replace property="JqRow" by property="jqRow".
> >
> > Jean-Noël
>
> --
> Ken Beyer
> Metatec Internet Products Group
> kab@metatec.com  |  http://www.metatec.com/
> "The box said 'Requires Windows 95 or better.' - so I installed Linux."


Re: remembering selected option question

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 16 Mar 2001, John Wright wrote:

> Maybe a newbie question here:
> 
> If a request is sent to a JSP page that has a <html:select>  tag but the
> request does not include a parameter with the same name as the property
> attribute of the <html:select> tag it is my understanding that an exception
> will be thrown saying that the request must contain the parameter.  If this
> is the case how do you handle cases in which you want to remember the
> selected option when there might be other screens accessed in between the
> times when the screen with the <html:select> tag is accessed?
> 

I'm not quite sure I understand your question completely, but the general
philosophy in Struts works like this:

* Requests are submitted to an Action (via the Controller servlet)
  rather than being submitted directly to a page.

* The controller servlet can associate a form bean (an instance of
  ActionForm) with the request, in order to capture the input fields
  from that request.  You would have a property to capture the current
  state of the property you are using <html:select> on, for example.

* If you need to keep the information about what was selected for more
  than one request, the typical approach would be to store the
  corresponding form bean in the user's session.


> Thanks,
> 
> John
> 

Craig McClanahan


remembering selected option question

Posted by John Wright <jw...@fyidocs.com>.
Maybe a newbie question here:

If a request is sent to a JSP page that has a <html:select>  tag but the
request does not include a parameter with the same name as the property
attribute of the <html:select> tag it is my understanding that an exception
will be thrown saying that the request must contain the parameter.  If this
is the case how do you handle cases in which you want to remember the
selected option when there might be other screens accessed in between the
times when the screen with the <html:select> tag is accessed?

Thanks,

John




Re: Missing Property

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 16 Mar 2001, Ken Beyer wrote:

> 
> On the same thread... can someone tell me why I can't put ....
>     property="aBCDefg" with a bean getter of "getABCDefg()"
> 
> Note the 2nd char being an uppercase "B".  I were to make the "B" a
> lowercase "b",  it works.  The problem stems from the 2nd char in the
> property name being a capital.  I'm on Tomcat 3.3m1 + Struts 1.0b1
> 

There are some somewhat arcane rules in the JavaBeans spec about what
happens when you've got property names with embedded capital letters -- I
would suggest going there (it can be found through
<http://java.sun.com/products>).

Struts is relying on the JDK's standard introspection classes, so it's
totally at the mercy of the JDK rules to define what valid property names
are.

> Any advice?   is this a bug?
> Thx-
> Ken
> 

Craig



Re: Missing Property

Posted by Ken Beyer <ka...@metatec.com>.
On the same thread... can someone tell me why I can't put ....
    property="aBCDefg" with a bean getter of "getABCDefg()"

Note the 2nd char being an uppercase "B".  I were to make the "B" a
lowercase "b",  it works.  The problem stems from the 2nd char in the
property name being a capital.  I'm on Tomcat 3.3m1 + Struts 1.0b1

Any advice?   is this a bug?
Thx-
Ken

Jean-Noel Ribette wrote:

> > The jsp code:
> >
> >           <jsp:useBean id="jobQueueForm" type="JobQueueForm" />
> >
> >           <logic:iterate id="list" name="jobQueueForm" property="JqRow">
> >                  <bean:write name="list" />
> >           </logic:iterate>
> >
> > The form code:
> >
> >           public String [] getJqRow ()
> >          {
> >                    .
> >                    .
> >                    .
> >          }
> >
> > The error:
> >
> >          javax.servlet.jsp.JspException: No getter method for bean jobQueueForm
> > and property JqRow
> >
> >
> > Other jsps use different properties of the form with no problem.  Any
> > suggestions ?
> >
> I think it is a problem with Javabean naming convention.
> Try to replace property="JqRow" by property="jqRow".
>
> Jean-Noël

--
Ken Beyer
Metatec Internet Products Group
kab@metatec.com  |  http://www.metatec.com/
"The box said 'Requires Windows 95 or better.' - so I installed Linux."




Re: Missing Property

Posted by Jean-Noel Ribette <je...@improve.fr>.
> The jsp code:
>
>           <jsp:useBean id="jobQueueForm" type="JobQueueForm" />
>
>           <logic:iterate id="list" name="jobQueueForm" property="JqRow">
>                  <bean:write name="list" />
>           </logic:iterate>
>
> The form code:
>
>           public String [] getJqRow ()
>          {
>                    .
>                    .
>                    .
>          }
>
> The error:
>
>          javax.servlet.jsp.JspException: No getter method for bean jobQueueForm
> and property JqRow
>
>
> Other jsps use different properties of the form with no problem.  Any
> suggestions ?
>
I think it is a problem with Javabean naming convention.
Try to replace property="JqRow" by property="jqRow".

Jean-Noël


Missing Property

Posted by Marty Fisher <mf...@systemslink.com>.
Hi,

Can a second pair of eyes point out the problem with the iterate and form code
below:

The jsp code:

          <jsp:useBean id="jobQueueForm" type="JobQueueForm" />

          <logic:iterate id="list" name="jobQueueForm" property="JqRow">
                 <bean:write name="list" />
          </logic:iterate>

The form code:

          public String [] getJqRow ()
         {
                   .
                   .
                   .
         }

The error:

         javax.servlet.jsp.JspException: No getter method for bean jobQueueForm
and property JqRow


Other jsps use different properties of the form with no problem.  Any
suggestions ?

Marty Fisher


RE: Scope and re-display with errors problem...

Posted by Abraham Kang <ab...@infogain.com>.
Firmin,

   Due to the inherient problems with frames here is a solution for your
case.

   Abstract out the logic to generate the list of items in a different
Action object.

   When you are outputting the the <FRAME> HTML tag,
   map that to the action object that will generate the list items.

   Ex:

    <FRAME
src="buildMenu.do?paramThatYouNeedToBuildList=value&OtherParam=2">

   If you are submitting your form from a frame and not building a <FRAMESET

   try this:
      I am guessing that you have to sibling frames and the frame with the
list items is called "menuFrame".

      <Body onLoad="callAFunctionToReloadMenuFrame()">

      this function would reload the menuFrame with the URL above:

         buildMenu.do?paramThatYouNeedToBuildList=value&OtherParam=2

Hope This Helps,
Abraham


> -----Original Message-----
> From: Firmin David [mailto:david.firmin@capco.com]
> Sent: Wednesday, March 14, 2001 3:13 AM
> To: 'struts-user@jakarta.apache.org'
> Subject: Scope and re-display with errors problem...
>
>
> Hi all,
> I make a request from a menu frame for a list of items, and they are then
> displayed in the adjacent main frame. Before the page is displayed, the
> "list" object is put in *request* scope in the code. If the user enters
> invalid data and submits the form (of which the list is a part), the page
> cannot be redisplayed with the associated errors as the "list"
> object is no
> longer visible to it. I have no wish (for a multitude of reasons)
> to put the
> "list" object in the session even though it would solve the problem.
> Is there another way around this? I have tried <bean:define> with
> toScope="request" in the original page but clearly cannot call the new
> variable the same thing, meaning that all my references to the bean within
> the page become invalid. (I am unsure whether or not this would've worked
> anyway)
>
> Any help in finding a way of doing this without using session
> scope would be
> very gratefully received!
>
> Thanks in advance
>
> Rgds
> David
>
> ************************************************************************
> The information in this email is confidential and is intended solely
> for the addressee(s).
> Access to this email by anyone else is unauthorised. If you are not
> an intended recipient, you must not read, use or disseminate the
> information contained in the email.
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the views of
> The Capital Markets Company.
>
http://www.capco.com
***********************************************************************