db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keeney, Thomas" <Keen...@SEC.GOV>
Subject RE: Configure Torque for Struts
Date Tue, 05 Aug 2003 14:06:45 GMT
Hello All,

If you want to retrieve Torque.properties to pass into Torque.init(), just
load it from the classpath.

i.e. put Torque.properties into WEB-INF/classes

then use the following code:
      URL propsFile =
this.getClass().getClassLoader().getResource("Torque.properties");
Torque.init(propsFile.getPath());

I use an initialization servlet to load Torque.  However, you can also
implement a Struts Plugin to load Torque via the struts-config.xml.  See the
Struts javadocs for org.apache.struts.action.PlugIn.

Best of luck!
Tom

-----Original Message-----
From: Jian Dai [mailto:jack2110@comcast.net]
Sent: Tuesday, August 05, 2003 2:15 AM
To: Apache Torque Users List
Subject: RE: Configure Torque for Struts


Hi, Brian

I have tried Amit's method. It works. Here is a 
link of how to create such a servlet in case that
you may be interested. 

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg72669.html

Jack

-----Original Message-----
From: Brian Adams [mailto:bigb@satx.rr.com]
Sent: Monday, August 04, 2003 9:33 PM
To: Apache Torque Users List
Subject: RE: Configure Torque for Struts


I start tomcat with ./bin/catalina run and this is why it works. if I cd
into the bin and start catalina then it will not see the Torque.props file.
This is one reason why I knew I needed a fix.

-----Original Message-----
From: Jian Dai [mailto:jack2110@comcast.net]
Sent: Monday, August 04, 2003 11:34 PM
To: Apache Torque Users List
Subject: RE: Configure Torque for Struts


I tried to put that file in TOMCAT_HOME. It did not work for me.
I am going to try Amit's method later.

Thank you guys very much for the nice help.

Jack

-----Original Message-----
From: Amit Rana [mailto:rana@solis.jp]
Sent: Monday, August 04, 2003 9:25 PM
To: 'Apache Torque Users List'
Subject: RE: Configure Torque for Struts


We initially put it in WEB-INF/conf and recently moved it to a package.
Where ever we put it I think main problem is in passing the file name to
Torque.init method.

We are doing that with an initialization servlet which is loaded on
server startup and initializes Torque (alternatively, you can initialize
Torque when needed).

Simple code to initialize is:
Torque.init(getServletContext_or_request.
getRealPath("WEB-INF/conf/Torque.properties"));

Comments are welcome.

Regards,
Amit.

> -----Original Message-----
> From: Brian Adams [mailto:bigb@satx.rr.com]
> Sent: Tuesday, August 05, 2003 1:11 PM
> To: Apache Torque Users List
> Subject: RE: Configure Torque for Struts
>
> ah I see.  I had trouble with it and I finally got it running by
dropping
> the file in TOMCAT_HOME.
> I know this is not good but I just left it for now.  Thanks for
reminding me
> about that I will put this on my TODO for fixing. I do not know how to
put
> it in the webapp and get it to work.
> Does anyone on the LIST know?
> B
>
> -----Original Message-----
> From: Jian Dai [mailto:jack2110@comcast.net]
> Sent: Monday, August 04, 2003 11:09 PM
> To: Apache Torque Users List
> Subject: RE: Configure Torque for Struts
>
>
> Hi, Brian:
>
> Basically, I need to figure out where I can put the Torque.properties
> file in Struts.  In your case, after you generate the OM classes and
put
> them into your project, I guess you still need to configure this
property
> file so that your OM classes can realize it during runtime. My
question is
> how you did it
>
> Thanks a lot for nice help.
>
> Jack
>
> -----Original Message-----
> From: Brian Adams [mailto:bigb@satx.rr.com]
> Sent: Monday, August 04, 2003 8:48 PM
> To: Apache Torque Users List
> Subject: RE: Configure Torque for Struts
>
>
> Hey Jack, I am not sure what you mean.  I am using Torque with Struts
and I
> use a bean class that contains my Business Logic it makes calls to the
> Object Model classes.  I keep the entire Torque package in another
area and
> when I gen the OM Classes for my project it creates them in my project
area.
> Does that make sense?
> Brian
>
> -----Original Message-----
> From: Jian Dai [mailto:jack2110@comcast.net]
> Sent: Monday, August 04, 2003 7:54 PM
> To: Apache Torque Users List
> Subject: Configure Torque for Struts
>
>
> Hi, all:
>
> I am planning to use Torque as data module in
> Struts architecture. Is there anybody who knows
> how to configure torque for struts?
>
> Many thanks for the nice help.
>
> Jack
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message