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:

For additional commands, e-mail:



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







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




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:   
For additional commands, e-mail: 




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:   
For additional commands, e-mail: 




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: 




Re: Multiple DataSource Problem

2002-12-06 Thread tbachta



  
  
  
  


  
  
  
  

  

Tim Bachta
Information Technology
MC 48


   

  "David Graham"   

   cc: 

   Subject:  Re: Multiple DataSource 
Problem   
  12/06/2002 02:21 

  PM   

  Please respond to

  "Struts Users

  Mailing List"

   

   





Ok, post your entire  section.

David






>From: [EMAIL PROTECTED]
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Subject: Re: Multiple DataSource Problem
>Date: Fri, 6 Dec 2002 13:57:36 -0600
>
>
>That gives me a xml parse error:
>
>-INF/struts-config.xml: XML-0138: (Error) REQUIRED
>attribute 'property' is not
>pecified. file:/C:/oracle/j2ee/home/applications/MRA/WEB-INF/struts
>config.xml: XML-0138: (Error) REQUIRED attribute
>'property' is not specified.>
>org.xml.sax.SAXParseException:
>file:/C:/oracle/j2ee/home/applications/MRA/WEB-INF/struts-config.xml
>Line 17, Column 34>: XML-0138: (Error) REQUIRED attribute 'value' is not
>specified.
> at
>oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:231)
> at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:156)
> at
>oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)

> at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:145)
> at org.apache.commons.digester.Digester.parse(Digester.java:1495)
> at
>org.apache.struts.action.ActionServlet.initApplicationConfig(ActionServlet.java:860)

> at
>org.apache.struts.action.ActionServlet.init(ActionServlet.java:455)
> at javax.servlet.GenericServlet.init(GenericServlet.java:44)
> at
>com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:1673)

> at
>com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4006)

> at
>com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4105)

> at
>com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:579)

> at
>com.evermind.server.http.HttpApplication.(HttpApplication.java:376)
> at
>com.evermind.server.Application.getHttpApplication(Application.java:657)
> at
>com.evermind.server.http.HttpServer.getHttpApplication(HttpServer.java:663)

> at
>com.evermind.server.http.HttpSite.getApplication(HttpSite.java:387)
> at
>com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:378)

> at
>com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:243)

> at
>com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)
>[ERROR] Digester - -Parse Error at line 17 column 34:
>file:/C:/oracle/j2ee/home/applications/MRA/WE
>-INF/struts-config.xml: XML-0138: (Error) REQUIRED
>attribute 'value' is not spe
>ified. file:/C:/oracle/j2ee/home/applications/MRA/WEB-INF/struts-co
>fig.xml: XML-0138: (Error) REQUIRED attribute 'value'
>is not specified.>
>oracle.xml.parser.v2.XMLParseException: Attribute 'key' used but not
>declared.
> at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:208)
> at
>oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)

> at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:145)
> at org.apache.commons.digester.Digester.parse(Digester.java:1495)
> at
>org.apache.struts.action.ActionServlet.initApplicationConfig(ActionServlet.java:860)

> at
>org.apache.struts.

Re: Multiple DataSource Problem

2002-12-06 Thread tbachta

That gives me a xml parse error:

-INF/struts-config.xml: XML-0138: (Error) REQUIRED
attribute 'property' is not
pecified. : XML-0138: (Error) REQUIRED attribute
'property' is not specified.>
org.xml.sax.SAXParseException:
file:/C:/oracle/j2ee/home/applications/MRA/WEB-INF/struts-config.xml
Line 17, Column 34>: XML-0138: (Error) REQUIRED attribute 'value' is not
specified.
at
oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:231)
at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:156)
at
oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:145)
at org.apache.commons.digester.Digester.parse(Digester.java:1495)
at
org.apache.struts.action.ActionServlet.initApplicationConfig(ActionServlet.java:860)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:455)
at javax.servlet.GenericServlet.init(GenericServlet.java:44)
at
com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:1673)
at
com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4006)
at
com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4105)
at
com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:579)
at
com.evermind.server.http.HttpApplication.(HttpApplication.java:376)
at
com.evermind.server.Application.getHttpApplication(Application.java:657)
at
com.evermind.server.http.HttpServer.getHttpApplication(HttpServer.java:663)
at
com.evermind.server.http.HttpSite.getApplication(HttpSite.java:387)
at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:378)
at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:243)
at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)
[ERROR] Digester - -Parse Error at line 17 column 34:
file:/C:/oracle/j2ee/home/applications/MRA/WE
-INF/struts-config.xml: XML-0138: (Error) REQUIRED
attribute 'value' is not spe
ified. : XML-0138: (Error) REQUIRED attribute 'value'
is not specified.>
oracle.xml.parser.v2.XMLParseException: Attribute 'key' used but not
declared.
at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:208)
at
oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:145)
at org.apache.commons.digester.Digester.parse(Digester.java:1495)
at
org.apache.struts.action.ActionServlet.initApplicationConfig(ActionServlet.java:860)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:455)
at javax.servlet.GenericServlet.init(GenericServlet.java:44)
at
com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:1673)
at
com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4006)
at
com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4105)
at
com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:579)
at
com.evermind.server.http.HttpApplication.(HttpApplication.java:376)
at
com.evermind.server.Application.getHttpApplication(Application.java:657)
at
com.evermind.server.http.HttpServer.getHttpApplication(HttpServer.java:663)
at
com.evermind.server.http.HttpSite.getApplication(HttpSite.java:387)
at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:378)
at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:243)
at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)
[ERROR] ActionServlet - -Parsing error processing resource path
/WEB-INF/struts-config.xml 

Any other ideas? I am willing to try anything.

Tim Bachta
Information Technology
MC 48


   

  "David Graham"   

   cc: 

   Subject:  Re: Multiple DataSource 
Problem   
  12/06/2002 01:39 

  PM   

  Please respond to

  "Struts Users   

Re: Multiple DataSource Problem

2002-12-06 Thread tbachta

Ok I have tried that and I am getting a null pointer exception caused by
the DataSource, here is my code

ServletContext context = servlet.getServletContext();
  DataSource dataSource = (DataSource) context.getAttribute("MRA");
  conn = dataSource.getConnection();
  stmt = conn.createStatement();
  rs = stmt.executeQuery(sql);


My struts.xml is this;



  
  
  
  
  


  
  
  
  
  

  

I dont see what I am doing wrong please help.  Thank you

Tim Bachta
Information Technology
MC 48



   

  "David Graham"   

   cc: 

   Subject:  Re: Multiple DataSource 
Problem   
  12/06/2002 12:45 

  PM   

  Please respond to

  "Struts Users

  Mailing List"

   

   





>From action.execute()

DataSource ds1 =
(DataSource)this.getServlet().getServletContext().getAttribute
("YOUR_DS_KEY"));

David






>From: [EMAIL PROTECTED]
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Subject: Re: Multiple DataSource Problem
>Date: Fri, 6 Dec 2002 12:30:36 -0600
>
>
>Ok , I thought I have already changed the key value's to "MRA" and
>"PHONE_DB" in both of my data-sources, what I am having trouble with is
how
>do I refrence these values in the form and action classes?
>
>
>Tim Bachta
>Information Technology
>MC 48
>
>
>
>   "David Graham"
>   [EMAIL PROTECTED]
>   ail.com> cc:
>Subject:  Re: Multiple
>DataSource Problem
>   12/05/2002 04:09
>   PM
>   Please respond to
>   "Struts Users
>   Mailing List"
>
>
>
>
>
>
>
>
>That would store the DataSource under the Struts default value, which
>obviously only allows for one DataSource.  Just change the key value to
>something else to store multiple DataSources.
>
>David
>
>
>
>
>
>
> >From: [EMAIL PROTECTED]
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Subject: Re: Multiple DataSource Problem
> >Date: Thu, 5 Dec 2002 15:01:21 -0600
> >
> >
> >Can you show me a code snip of how to use this?
> >
> >
> >Tim Bachta
> >Information Technology
> >MC 48
> >
> >
> >
> >
> >   "David Graham"
> >>[EMAIL PROTECTED]
> >   ail.com> cc:
> >Subject:  Re: Multiple
> >DataSource Problem
> >   12/05/2002 02:45
> >   PM
> >   Please respond to
> >   "Struts Users
> >   Mailing List"
> >
> >
> >
> >
> >
> >
> >Use the key attribute of the data-source element.
> >
> >David
> >
> >
> >
> >
> >
> >
> > >From: [EMAIL PROTECTED]
> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > >Subject: Re: Multiple DataSource Problem
> > >Date: Thu, 5 Dec 2002 14:02:31 -0600
> > >
> > >
> > >Did I not give each data-source element its own key?
> > >
> > >Tim Bachta
> > >Information Technology
> > >MC 48
> > >
> > >
> > >
> > >
> > >   "David Graham"
> > >> >[EMAIL PROTECTED]
> > >   ail.com> cc:
> > >Subject:  Re: Mu

Re: Multiple DataSource Problem

2002-12-06 Thread tbachta

Ok , I thought I have already changed the key value's to "MRA" and
"PHONE_DB" in both of my data-sources, what I am having trouble with is how
do I refrence these values in the form and action classes?


Tim Bachta
Information Technology
MC 48


   

  "David Graham"   

   cc: 

   Subject:  Re: Multiple DataSource 
Problem   
  12/05/2002 04:09 

  PM   

  Please respond to

  "Struts Users

  Mailing List"

   

   







That would store the DataSource under the Struts default value, which
obviously only allows for one DataSource.  Just change the key value to
something else to store multiple DataSources.

David






>From: [EMAIL PROTECTED]
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Subject: Re: Multiple DataSource Problem
>Date: Thu, 5 Dec 2002 15:01:21 -0600
>
>
>Can you show me a code snip of how to use this?
>
>
>Tim Bachta
>Information Technology
>MC 48
>
>
>
>
>   "David Graham"
>   [EMAIL PROTECTED]
>   ail.com> cc:
>Subject:  Re: Multiple
>DataSource Problem
>   12/05/2002 02:45
>   PM
>   Please respond to
>   "Struts Users
>   Mailing List"
>
>
>
>
>
>
>Use the key attribute of the data-source element.
>
>David
>
>
>
>
>
>
> >From: [EMAIL PROTECTED]
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Subject: Re: Multiple DataSource Problem
> >Date: Thu, 5 Dec 2002 14:02:31 -0600
> >
> >
> >Did I not give each data-source element its own key?
> >
> >Tim Bachta
> >Information Technology
> >MC 48
> >
> >
> >
> >
> >   "David Graham"
> >>[EMAIL PROTECTED]
> >   ail.com> cc:
> >Subject:  Re: Multiple
> >DataSource Problem
> >   12/05/2002 01:41
> >   PM
> >   Please respond to
> >   "Struts Users
> >   Mailing List"
> >
> >
> >
> >
> >
> >
> >You need to give each data-source element its own key.  Struts stores
the
> >DataSource under that key in the ServletContext.
> >
> >David
> >
> >
> >
> >
> >
> >
> > >From: [EMAIL PROTECTED]
> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > >To: [EMAIL PROTECTED]
> > >Subject: Multiple DataSource Problem
> > >Date: Thu, 5 Dec 2002 13:20:01 -0600
> > >
> > >I am having trouble getting multiple datasources to work in my
> >application.
> > >I have searched the archives and found inofrmation on how to do it but
> >the
> > >solutions given are depricated.  Can anyone help me?
> > >
> > >
> > >
> > > 
> > >   
> > >> >="oracle.jdbc.driver.OracleDriver"/>
> > >   value="jdbc:oracle:thin:
> > >@147.101.104.63:1524:common"/>
> > >   
> > >   
> > > 
> > > 
> > >   
> > >> >="oracle.jdbc.driver.OracleDriver"/>
> > >   value="jdbc:oracle:thin:
> > >@oid:1521:infoprd"/>
> > >   
> > >   value="info_user"/>
> > > 
> > >   
> > >
> > >
> > >
> > >try
> > > {
> > >   ServletContext context = servlet.getServletContext();
> > >   DataSource dataSource = (DataSource)
> > >context.getAttribute(Action.DATA_SOURCE_KEY);
> > >   conn = dataSource.getCon

Re: Multiple DataSource Problem

2002-12-05 Thread tbachta

Can you show me a code snip of how to use this?


Tim Bachta
Information Technology
MC 48



   

  "David Graham"   

   cc: 

   Subject:  Re: Multiple DataSource 
Problem   
  12/05/2002 02:45 

  PM   

  Please respond to

  "Struts Users

  Mailing List"

   

   





Use the key attribute of the data-source element.

David






>From: [EMAIL PROTECTED]
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Subject: Re: Multiple DataSource Problem
>Date: Thu, 5 Dec 2002 14:02:31 -0600
>
>
>Did I not give each data-source element its own key?
>
>Tim Bachta
>Information Technology
>MC 48
>
>
>
>
>   "David Graham"
>   [EMAIL PROTECTED]
>   ail.com> cc:
>Subject:  Re: Multiple
>DataSource Problem
>   12/05/2002 01:41
>   PM
>   Please respond to
>   "Struts Users
>   Mailing List"
>
>
>
>
>
>
>You need to give each data-source element its own key.  Struts stores the
>DataSource under that key in the ServletContext.
>
>David
>
>
>
>
>
>
> >From: [EMAIL PROTECTED]
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Multiple DataSource Problem
> >Date: Thu, 5 Dec 2002 13:20:01 -0600
> >
> >I am having trouble getting multiple datasources to work in my
>application.
> >I have searched the archives and found inofrmation on how to do it but
>the
> >solutions given are depricated.  Can anyone help me?
> >
> >
> >
> > 
> >   
> >>="oracle.jdbc.driver.OracleDriver"/>
> >   
> >   
> >   
> > 
> > 
> >   
> >>="oracle.jdbc.driver.OracleDriver"/>
> >   
> >   
> >   
> > 
> >   
> >
> >
> >
> >try
> > {
> >   ServletContext context = servlet.getServletContext();
> >   DataSource dataSource = (DataSource)
> >context.getAttribute(Action.DATA_SOURCE_KEY);
> >   conn = dataSource.getConnection();
> >   stmt = conn.createStatement();
> >   rs = stmt.executeQuery(sql);
> >
> >  Thank you for your help
> >
> >Tim Bachta
> >Information Technology
> >MC 48
> >
> >
> >
> >
> >--
> >To unsubscribe, e-mail:
> >
> >For additional commands, e-mail:
> >
>
>
>_
>MSN 8 with e-mail virus protection service: 2 months FREE*
>http://join.msn.com/?page=features/virus
>
>
>--
>To unsubscribe, e-mail:   <
>mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <
>mailto:[EMAIL PROTECTED]>
>
>
>
>
>
>
>
>--
>To unsubscribe, e-mail:
>
>For additional commands, e-mail:
>


_
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail


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







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




Multiple Data-Source Problem

2002-12-05 Thread tbachta

How do access multiple data-sources' in an application.  Here are may
data-source's




  
  
  
  
  


  
  
  
  
  

  

Thank you


Tim Bachta
Information Technology
MC 48
816-997-7137



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




Re: Multiple DataSource Problem

2002-12-05 Thread tbachta

Did I not give each data-source element its own key?

Tim Bachta
Information Technology
MC 48



   

  "David Graham"   

   cc: 

   Subject:  Re: Multiple DataSource 
Problem   
  12/05/2002 01:41 

  PM   

  Please respond to

  "Struts Users

  Mailing List"

   

   





You need to give each data-source element its own key.  Struts stores the
DataSource under that key in the ServletContext.

David






>From: [EMAIL PROTECTED]
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Multiple DataSource Problem
>Date: Thu, 5 Dec 2002 13:20:01 -0600
>
>I am having trouble getting multiple datasources to work in my
application.
>I have searched the archives and found inofrmation on how to do it but the
>solutions given are depricated.  Can anyone help me?
>
>
>
> 
>   
>   ="oracle.jdbc.driver.OracleDriver"/>
>   
>   
>   
> 
> 
>   
>   ="oracle.jdbc.driver.OracleDriver"/>
>   
>   
>   
> 
>   
>
>
>
>try
> {
>   ServletContext context = servlet.getServletContext();
>   DataSource dataSource = (DataSource)
>context.getAttribute(Action.DATA_SOURCE_KEY);
>   conn = dataSource.getConnection();
>   stmt = conn.createStatement();
>   rs = stmt.executeQuery(sql);
>
>  Thank you for your help
>
>Tim Bachta
>Information Technology
>MC 48
>
>
>
>
>--
>To unsubscribe, e-mail:
>
>For additional commands, e-mail:
>


_
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


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







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




Multiple DataSource Problem

2002-12-05 Thread tbachta
I am having trouble getting multiple datasources to work in my application.
I have searched the archives and found inofrmation on how to do it but the
solutions given are depricated.  Can anyone help me?




  
  
  
  
  


  
  
  
  
  

  



try
{
  ServletContext context = servlet.getServletContext();
  DataSource dataSource = (DataSource)
context.getAttribute(Action.DATA_SOURCE_KEY);
  conn = dataSource.getConnection();
  stmt = conn.createStatement();
  rs = stmt.executeQuery(sql);

 Thank you for your help

Tim Bachta
Information Technology
MC 48




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




RE: select and option tag issues

2002-11-08 Thread tbachta

Ok I am still getting an error, the error is:

javax.servlet.jsp.JspException: No getter method available for property
getLocationValues for bean under name null


here is the code form the class that extends ActionForm

  private ArrayList getDataValues(String sql, String varaible)
  {

ArrayList list = new ArrayList();


Connection conn = null;
Statement stmt = null;
ResultSet rs = null;

ServletContext context = servlet.getServletContext();
DataSource dataSource = (DataSource)
context.getAttribute(Action.DATA_SOURCE_KEY);

try
{

  conn = dataSource.getConnection();
  stmt = conn.createStatement();
  rs = stmt.executeQuery(sql);

  while(rs.next())
  {
System.out.println("here");
String value = rs.getString(varaible);
list.add(value);
  }

}
catch(Exception e)
{
  System.out.println("ERROR GETTING NUMBER  "+e);
}
finally
{
  if(rs != null)
  {
try
{
  rs.close();
}
catch(SQLException e)
{
  System.out.println(e.getMessage());
}
rs = null;
  }
  if(stmt != null)
  {
try
{
  stmt.close();
}
catch(SQLException e)
{
  System.out.println(e.getMessage());
}
stmt = null;
  }
  if(conn != null)
  {
try
{
  conn.close();
}
catch(SQLException e)
{
  System.out.println(e.getMessage());
}
conn = null;
  }
}

return(list);
  }

  public ArrayList getLocationValues()
  {
ArrayList values = new ArrayList();
String sql = "select id from locations";
values = getDataValues(sql, "id");

return(values);
  }

  public ArrayList getLocationLables()
  {
ArrayList lables = new ArrayList();
String sql = "select location from locations";
lables = getDataValues(sql, "location");

return(lables);
  }

here is the code from the jsp


  
  


What am I doing wrong?  I am very confused. Please help

Tim Bachta
Information Technology
MC 48
816-997-7137


   
  
  "edgar"  
  

  .net>cc: 
  
   Subject:  RE: select and option tag 
issues
  11/08/2002 08:08 
  
  AM   
  
  Please respond to
  
  "Struts Users
  
  Mailing List"
  
   
  
   
  




In your form create two ArrayLists one for the values, one for the
labels.  If the data doesn't change much you can make them static.
Create getter methods for them which populate the arraylists from you
database (make sure you populate them in the same order so the labels
correspond to the values.  Then in your jsp do

 
 
 

If you have really static stuff you can stick the above arraylists in
the session or the context and use

 
 
 

Hope this helps.

Edgar
-Original Message-
From: [EMAIL PROTECTED] [mailto:tbachta@;kcp.com]
Sent: Friday, November 08, 2002 8:50 AM
To: 'Struts Users Mailing List'
Subject: Re: select and option tag issues



I posted this question a couple of days ago and received an answer.
Unfortunately the answer does not work for me.  The problem I am having
is on the initial page of my web application I have drop-down boxes that
I want to be populated with information from a database.  I have no
problem getting the recordset but do not know how to transfer that
recordset data into the drop-downs.  I was able to populate the
drop-downs similar to the example used in the documentation but that
does not have  an example of how to populate them with live data.  Can
anyone give me a

Re: select and option tag issues

2002-11-08 Thread tbachta

I posted this question a couple of days ago and received an answer.
Unfortunately the answer does not work for me.  The problem I am having is
on the initial page of my web application I have drop-down boxes that I
want to be populated with information from a database.  I have no problem
getting the recordset but do not know how to transfer that recordset data
into the drop-downs.  I was able to populate the drop-downs similar to the
example used in the documentation but that does not have  an example of how
to populate them with live data.  Can anyone give me a quick lesson on how
to do this.
Tim Bachta
Information Technology
MC 48
816-997-7137


   
  
  Eddie Bush   
  
  <[EMAIL PROTECTED]To:   Struts Users Mailing List 
<[EMAIL PROTECTED]>  
  t>   cc: 
  
   Subject:  Re: select and option tag 
issues
  11/06/2002 11:52 
  
  AM   
  
  Please respond to
  
  "Struts Users
  
  Mailing List"
  
   
  
   
  




Have you discovered the collection attribute of the options tag?  Your
action can build any collection you desire (ie from a database -- see
org.apache.struts.util.LabelValueBean for holding the name/value pairs).
 It then places that collection into some scope (whichever you like) and
forwards to the page.  Now, by specifying the key you used when placing
the collection into scope as the value to the collection attribute of
the options tag, you've got a dynamic drop-down populated from the
database.

- in your Action subclass

Collection c = ...;

while (...)
{
String label = ...;
String value = ...;
c.add(new LabelValueBean(label, value));
}

request.setAttribute("myCollection", c);

- in your JSP





(This isn't in the FAQ, is it?  )

[EMAIL PROTECTED] wrote:

>Hi all,
>
>I am very new to struts and I am trying to create combo boxes using the
> tags.  I have been able to create and populate
>them with string arrays placed on the JSP page similar to the examples in
>the documentation.  What I really need to do is populate them based on
>information in a database.  I can create the recordset but after that I am
>lost.  Can anyone please help.  Thank you.
>Tim Bachta
>
>Tim Bachta
>

--
Eddie Bush





--
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:   
For additional commands, e-mail: 




Re: html tags

2002-11-06 Thread tbachta

I did something similar with hiding and showing  using JavaScript and a
style sheet


function checkUnique(lookupForm)
{
  var x= document.getElementById("unique_select");

  x.style.visibility = "visible";

}



 
 
  

 Is Base Part Number a MRA Unique Part Number?
  
  
 Yes
No 

  



hope this helps

Tim Bachta
Information Technology
MC 48
816-997-7137


   
  
  "Bhamani, Nizar A
  
  TL56E"   To:   
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> 
 Subject:  html tags 
  
   
  
  11/06/2002 10:40 
  
  AM   
  
  Please respond to
  
  "Struts Users
  
  Mailing List"
  
   
  
   
  




I have a typical problem where, I am using the  tags,
in which the contents/fields within the  tag needs to be
dynamic.
i.e. the form consists of multiple sections and each of these section has a
few
fields which can change based on certain conditions.  I want to use the










Each of these section is put in a tile. However, this is not allowed as the
html tag
used needs to be within the html:form tag. Has anybody faced similar
situation ?
If yes, how did you cope with this problem.

Thanks,



Nizar Bhamani
Senior Software Engineer
YouDecide.com Inc, a subsidiary of Ace INA Holdings Corp
[EMAIL PROTECTED]
(770) 291 7180
http://www.youdecide.com


CONFIDENTIALITY
This e-mail and any attachments are confidential and also may be
privileged.
If you are not the named recipient, or have otherwise received this
communication in error, please delete it from your inbox, notify the sender
immediately, and do not disclose its contents to any other person,
use them for any purpose, or store or copy them in any medium.
Thank you for your cooperation.




--
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:   
For additional commands, e-mail: 




select and option tag issues

2002-11-06 Thread tbachta
Hi all,

I am very new to struts and I am trying to create combo boxes using the
 tags.  I have been able to create and populate
them with string arrays placed on the JSP page similar to the examples in
the documentation.  What I really need to do is populate them based on
information in a database.  I can create the recordset but after that I am
lost.  Can anyone please help.  Thank you.
Tim Bachta

Tim Bachta




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