struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mei Zhu" <m...@goperiscope.com>
Subject RE: JavaScript / struts submit problems
Date Tue, 28 Jan 2003 20:07:43 GMT
In your Action class you have:
 sXML = request.getAttribute("XMLQueryString").toString();
this will throw a NullPointerException, because XMLQueryString is not a
request attribute but a request parameter. I have tested using
XMLQueryString, I did notice that the value cannot be populated to the form
bean from request. If you don't mind, you can send me your new files with
xmlQueryString as property name. I will be glad to look at for you.

Mei



-----Original Message-----
From: tbachta@kcp.com [mailto:tbachta@kcp.com]
Sent: Tuesday, January 28, 2003 1:47 PM
To: Struts Users Mailing List
Subject: RE: JavaScript / struts submit problems



I dont think that the capitalization is the problem, I have tried to do it
with the get and sets like XmlQueryString() and the property
="xmlQueryString", and I still get a zero length string when I try to
getXmlQueryString() in my action class.
Tim Bachta
Information Technology
MC 48



                      "Mei Zhu"
                      <mzhu@goperiscope        To:       "Struts Users
Mailing List" <struts-user@jakarta.apache.org>
                      .com>                    cc:
                                               Subject:  RE: JavaScript /
struts submit problems
                      01/28/2003 01:34
                      PM
                      Please respond to
                      "Struts Users
                      Mailing List"






It is obvious that struts does not populate the form bean value from
request
if you name your property like "XMLQueryString" (but it can be populated to
your input field from form bean). I do not understand exactly why. If you
just want to make it work I would not use a property name with the first
and
second charaters being uppercase, e.g. in your jsp page, use
property="xmlQueryString" while in your form define methods
getXmlQueryString(), setXmlQueryString().

Mei

-----Original Message-----
From: tbachta@kcp.com [mailto:tbachta@kcp.com]
Sent: Tuesday, January 28, 2003 12:50 PM
To: Struts Users Mailing List
Subject: RE: JavaScript / struts submit problems



Sorry forgot to add this code to the fray, here is the ActionForm class
where I have the get and set methods

  private void setXMLQueryString(String sXML)
  {
    this.XMLQueryString = sXML;
  }

  public String getXMLQueryString()
  {
    return XMLQueryString;
  }


Tim Bachta
Information Technology
MC 48
816-997-7137



                      "Nelson, Laird"
                      <Laird.Nelson@FMR        To:       "'Struts Users
Mailing List'" <struts-user@jakarta.apache.org>
                      .COM>                    cc:
                                               Subject:  RE: JavaScript /
struts submit problems
                      01/28/2003 11:36
                      AM
                      Please respond to
                      "Struts Users
                      Mailing List"






> -----Original Message-----
> From: Mei Zhu [mailto:mzhu@goperiscope.com]
>
> In your jsp page, the hidden field should be:
> <html:hidden property="xMLQueryString"/> The first character
> of the property
> name should be lower case.

No; see
http://java.sun.com/j2se/1.4.1/docs/api/java/beans/Introspector.html#decapit


alize(java.lang.String) for the exception cases, of which this is one.
"XMLQueryString" will result in a getXMLQueryString() and a
setXMLQueryString(String) method being sought.  If either is not present,
then the BeanUtils code will skip it.

Cheers,
Laird

--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>







--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>







--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message