RE: JavaScript / struts submit problems

2003-01-28 Thread Mei Zhu
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
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"
  
  .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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
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"
  
  .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:[EMAIL PROTECTED]]
>
> In your jsp page, the hidden field should be:
>  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:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







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


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







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


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




RE: JavaScript / struts submit problems

2003-01-28 Thread tbachta

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"
  
  
  .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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
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"
  
  .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:[EMAIL PROTECTED]]
>
> In your jsp page, the hidden field should be:
>  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:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







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


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







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




RE: JavaScript / struts submit problems

2003-01-28 Thread Mei Zhu
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
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"
  
  .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:[EMAIL PROTECTED]]
>
> In your jsp page, the hidden field should be:
>  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:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







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


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




RE: JavaScript / struts submit problems

2003-01-28 Thread tbachta

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"  
  

  .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:[EMAIL PROTECTED]]
>
> In your jsp page, the hidden field should be:
>  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:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







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




RE: JavaScript / struts submit problems

2003-01-28 Thread tbachta

Ok, so if the name is not the problem then what is?  What do I need to do,
or look at to fix this?
Tim Bachta
Information Technology
MC 48


   
  
  "Nelson, Laird"  
  

  .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:[EMAIL PROTECTED]]
>
> In your jsp page, the hidden field should be:
>  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:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







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




RE: JavaScript / struts submit problems

2003-01-28 Thread Nelson, Laird
> -Original Message-
> From: Mei Zhu [mailto:[EMAIL PROTECTED]]
> 
> In your jsp page, the hidden field should be:
>  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:   
For additional commands, e-mail: 




RE: JavaScript / struts submit problems

2003-01-28 Thread Mei Zhu
Just to add another note, it may not work(you need to verify by looking at
Java Bean spec) if you define your property name like xMLQueryString, but
xmlQueryString will work.

Mei

-Original Message-
From: Mei Zhu [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 28, 2003 11:06 AM
To: Struts Users Mailing List
Subject: RE: JavaScript / struts submit problems


In your jsp page, the hidden field should be:
 The first character of the property
name should be lower case.

Mei

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 28, 2003 10:49 AM
To: [EMAIL PROTECTED]
Subject: JavaScript / struts submit problems



Hello All,

I am having a little problem that hopefully someone can help me with.  I
have a form that has a hidden field in it, I am not populating this hidden
field on the page load but rather I am populating the value in a JavaScript
function and then using the form.submit() in JavaScript to submit the form.
When I try pulling the value for the hidden field out in my Action class I
get either a null pointer exception or a zero length string depending on
how I try to get the data.  I have verified that there is data populating
in the hidden fields value.  Here is the code below, if anyone can help me
in finding out how to get the value I would be very grateful.

/jsp

<%@ page language ="java"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>


Report Generator










  

  

  

  

 
  
 
 


  

  

. and so on.

javascript


  function getHiddenValue(form)  // added for
testing
  {
alert(form.XMLQueryString.value);
  }
  function runClick(form)
  {
var strQueryXML = new String();



if(form.selectedColumns.options.length > 0)
{
  strQueryXML = getQueryXML(form);

  form.XMLQueryString.value = strQueryXML;
  alert(strQueryXML); // added for testing
  alert(form.XMLQueryString.value);   // added for testing
  form.submit();


}
else
{
  alert("Please select at least one column.");
  objSelCols.focus();
}


  }
Action Class/

public class GeneratorAction  extends Action
{
  private ActionErrors errors = new ActionErrors();

  public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
  throws IOException, ServletException
  {
HttpSession session = request.getSession();
String sXML = new String();
String target = new String("failure");

if(form != null)
{
  errors.clear();
  GeneratorForm gForm = (GeneratorForm)form;
  try
  {
//sXML = gForm.getXMLQueryString(); //0 length
string
sXML = request.getAttribute("XMLQueryString").toString();
//null pointer
//sXML = session.getAttribute("XMLQueryString").toString();
//null pointer
System.out.println("XML String ="+sXML.toString());
target = new String("success");
  }
  catch(Exception e)
  {
System.out.println("Error Getting Attributes "+e);
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError
("errors.dbsubmiterror",sXML));
target = new String("failure");
saveErrors(request,errors);
  }
}
return(mapping.findForward(target));
  }
}

Thanks

Tim Bachta
Information Technology
MC 48





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


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


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




RE: JavaScript / struts submit problems

2003-01-28 Thread Mei Zhu
In your jsp page, the hidden field should be:
 The first character of the property
name should be lower case.

Mei

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 28, 2003 10:49 AM
To: [EMAIL PROTECTED]
Subject: JavaScript / struts submit problems



Hello All,

I am having a little problem that hopefully someone can help me with.  I
have a form that has a hidden field in it, I am not populating this hidden
field on the page load but rather I am populating the value in a JavaScript
function and then using the form.submit() in JavaScript to submit the form.
When I try pulling the value for the hidden field out in my Action class I
get either a null pointer exception or a zero length string depending on
how I try to get the data.  I have verified that there is data populating
in the hidden fields value.  Here is the code below, if anyone can help me
in finding out how to get the value I would be very grateful.

/jsp

<%@ page language ="java"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>


Report Generator










  

  

  

  

 
  
 
 


  

  

. and so on.

javascript


  function getHiddenValue(form)  // added for
testing
  {
alert(form.XMLQueryString.value);
  }
  function runClick(form)
  {
var strQueryXML = new String();



if(form.selectedColumns.options.length > 0)
{
  strQueryXML = getQueryXML(form);

  form.XMLQueryString.value = strQueryXML;
  alert(strQueryXML); // added for testing
  alert(form.XMLQueryString.value);   // added for testing
  form.submit();


}
else
{
  alert("Please select at least one column.");
  objSelCols.focus();
}


  }
Action Class/

public class GeneratorAction  extends Action
{
  private ActionErrors errors = new ActionErrors();

  public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
  throws IOException, ServletException
  {
HttpSession session = request.getSession();
String sXML = new String();
String target = new String("failure");

if(form != null)
{
  errors.clear();
  GeneratorForm gForm = (GeneratorForm)form;
  try
  {
//sXML = gForm.getXMLQueryString(); //0 length
string
sXML = request.getAttribute("XMLQueryString").toString();
//null pointer
//sXML = session.getAttribute("XMLQueryString").toString();
//null pointer
System.out.println("XML String ="+sXML.toString());
target = new String("success");
  }
  catch(Exception e)
  {
System.out.println("Error Getting Attributes "+e);
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError
("errors.dbsubmiterror",sXML));
target = new String("failure");
saveErrors(request,errors);
  }
}
return(mapping.findForward(target));
  }
}

Thanks

Tim Bachta
Information Technology
MC 48





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


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




JavaScript / struts submit problems

2003-01-28 Thread tbachta

Hello All,

I am having a little problem that hopefully someone can help me with.  I
have a form that has a hidden field in it, I am not populating this hidden
field on the page load but rather I am populating the value in a JavaScript
function and then using the form.submit() in JavaScript to submit the form.
When I try pulling the value for the hidden field out in my Action class I
get either a null pointer exception or a zero length string depending on
how I try to get the data.  I have verified that there is data populating
in the hidden fields value.  Here is the code below, if anyone can help me
in finding out how to get the value I would be very grateful.

/jsp

<%@ page language ="java"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>


Report Generator










  

  

  

  

 
  
 
 


  

  

. and so on.

javascript


  function getHiddenValue(form)  // added for
testing
  {
alert(form.XMLQueryString.value);
  }
  function runClick(form)
  {
var strQueryXML = new String();



if(form.selectedColumns.options.length > 0)
{
  strQueryXML = getQueryXML(form);

  form.XMLQueryString.value = strQueryXML;
  alert(strQueryXML); // added for testing
  alert(form.XMLQueryString.value);   // added for testing
  form.submit();


}
else
{
  alert("Please select at least one column.");
  objSelCols.focus();
}


  }
Action Class/

public class GeneratorAction  extends Action
{
  private ActionErrors errors = new ActionErrors();

  public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
  throws IOException, ServletException
  {
HttpSession session = request.getSession();
String sXML = new String();
String target = new String("failure");

if(form != null)
{
  errors.clear();
  GeneratorForm gForm = (GeneratorForm)form;
  try
  {
//sXML = gForm.getXMLQueryString(); //0 length
string
sXML = request.getAttribute("XMLQueryString").toString();
//null pointer
//sXML = session.getAttribute("XMLQueryString").toString();
//null pointer
System.out.println("XML String ="+sXML.toString());
target = new String("success");
  }
  catch(Exception e)
  {
System.out.println("Error Getting Attributes "+e);
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError
("errors.dbsubmiterror",sXML));
target = new String("failure");
saveErrors(request,errors);
  }
}
return(mapping.findForward(target));
  }
}

Thanks

Tim Bachta
Information Technology
MC 48





--
To unsubscribe, e-mail:   
For additional commands, e-mail: