Yes! What stupid question :-)))

btw. here is the code that work for me:

import org.apache.struts.config.ModuleConfig;
import org.apache.struts.config.DataSourceConfig;
import org.apache.struts.Globals;

                ModuleConfig config = 
(ModuleConfig)request.getAttribute(Globals.MODULE_KEY);
                DataSourceConfig dscs[] = config.findDataSourceConfigs();
                for(int i = 0; i < dscs.length; i++)
                {
                        Map mapT = dscs[i].getProperties();
                        Iterator it = mapT.entrySet().iterator();
                        while (it.hasNext()) {
                          Map.Entry pairs = (Map.Entry)it.next();
                          System.out.println("mapT " + i + ":" + pairs.getKey() 
+ " = " + pairs.getValue());
                    }           
                }

Tnx again :-)


From: "Nuwan Chandrasoma" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>, <[EMAIL PROTECTED]>
Subject: Re: reading data from struts-config.xml
Date: Fri, 12 Jan 2007 16:02:06 -0000

----- Original Message Follows -----
> Iterate the map you get and from there you can find the properties in that 
> map.
> 
> Thanks,
> 
> Nuwan
> ----- Original Message ----- 
> From: "Stanislav" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Sent: Friday, January 12, 2007 10:20 AM
> Subject: Re: reading data from struts-config.xml
> 
> 
> > Yes, you helped me, but where can i find list of all posible properties 
> > that i can get from
> > DataSourceConfig?
> >
> > Tnx!
> >
> > From: "Nuwan Chandrasoma" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>, <user@struts.apache.org>
> > Subject: Re: reading data from struts-config.xml
> > Date: Fri, 12 Jan 2007 15:21:06 -0000
> >
> > ----- Original Message Follows -----
> >> Hi,
> >>
> >> Get the module confing and from there you can get the data source
> >> configarations., in this object there is a Map which contains the
> >> properties, you can get it from there..,
> >>
> >> eg:-
> >> ModuleConfig config =
> >> (ModuleConfig)aRequest.getAttribute(Globals.MODULE_KEY);
> >>
> >>
> >> DataSourceConfig dscs[] = config.findDataSourceConfigs();
> >>
> >>
> >> dscs[0].getProperties().get("");
> >>
> >> I hope this would work, i havent tested the code in the above.., but i am
> >> sure it would work.. please teset.
> >>
> >> Thanks,
> >>
> >> Nuwan
> >>
> >>
> >>
> >> ----- Original Message ----- 
> >> From: "Stanislav" <[EMAIL PROTECTED]>
> >> To: <user@struts.apache.org>; "Nuwan Chandrasoma" <[EMAIL PROTECTED]>
> >> Sent: Friday, January 12, 2007 9:32 AM
> >> Subject: Re: reading data from struts-config.xml
> >>
> >>
> >> > Yes!
> >> >
> >> > inside <data-sources> and then inside <data-source
> >> > type="org.apache.commons.dbcp.BasicDataSource">
> >> >
> >> >
> >> >
> >> > From: "Nuwan Chandrasoma" <[EMAIL PROTECTED]>
> >> > To: <[EMAIL PROTECTED]>
> >> > Subject: Re: reading data from struts-config.xml
> >> > Date: Fri, 12 Jan 2007 15:04:36 -0000
> >> >
> >> > ----- Original Message Follows -----
> >> >> Hi,
> >> >>
> >> >> Where have you specified this property?.. inside <data-source> in
> >> >> struts-config.xml or some where else?
> >> >>
> >> >> Thanks,
> >> >>
> >> >> Nuwan
> >> >>
> >> >> ----- Original Message ----- 
> >> >> From: "Stanislav" <[EMAIL PROTECTED]>
> >> >> To: <user@struts.apache.org>
> >> >> Sent: Friday, January 12, 2007 9:11 AM
> >> >> Subject: reading data from struts-config.xml
> >> >>
> >> >>
> >> >> > Hi!
> >> >> >
> >> >> > In struts-config.xml i defined database connection settings.
> >> >> > Partuculary
> >> >> > database name.
> >> >> >
> >> >> > code:
> >> >> > <set-property property="url"
> >> >> > value="jdbc:microsoft:sqlserver://xxx.xxx.xxx.xxx:1433;DatabaseName=SomeName_test
> >> >> > ;SelectMethod=Cursor" />
> >> >> >
> >> >> > Is there any to detect database name in Action class? I want to 
> >> >> > check
> >> >> > db
> >> >> > name, and if it's test db
> >> >> > to put some information in .jsp.
> >> >> >
> >> >> > Tnx in advance,
> >> >> > Stanislav
> >> >> >
> >> >> > ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >> > For additional commands, e-mail: [EMAIL PROTECTED]
> >> >> >
> >> >>
> >> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

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

Reply via email to