You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Ramesh R <ra...@gmail.com> on 2007/12/16 20:07:49 UTC
Configure torque for struts
Hi,
I am using torque for struts application. I am currently finding difficult
configuring torque. Please guide me in how to do this.
Thanks
Ramesh r
Re: Configure torque for struts
Posted by Alvaro Coronel <al...@yahoo.com>.
Sorry Ram, I thought you were having trouble making it work. So you are well on your way to use Torque - contratulations!
I think you should move the init() call somewhere else, to an application wide initialization.
I am not that acquainted with struts.. I think you must move all the data manipulation (the setxxx() and save() ) to another class that inherits from some Struts class (used to be an "Action") and not use servlets.
But I digress - don't pay attention to me. You can get proper Struts help in a Struts mailing list.
Best regards,
Álvaro.
Ram <ra...@gmail.com> wrote: Well to be specific, I have configured the torque, generated the sql schema
files and made it to run perfectly. I even tested using it inside a main
class like this.
public static void main(String[] args) throws Exception
{
String path = "../crm/Torque.properties";
Torque.init(path);
Contacts contacts = new Contacts();
contacts.setFirstname("Ramesh");
contacts.setLastname("R");
contacts.setMiddlename("n");
contacts.save();
}
But my purpose is to use it in struts. I am using it like this.
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
String path = "../crm/Torque.properties";
Torque.init(path);
Contacts contacts = new Contacts();
contacts.setFirstname("xyz");
contacts.setLastname("s");
contacts.setMiddlename("n");
contacts.save();
request.setAttribute("Id", contacts.getPrimaryKey());
return mapping.findForward("success");
}
Please guide whether am on a right track.
On Dec 17, 2007 7:54 AM, Alvaro Coronel wrote:
> Hi Ramesh. If you can be more specific, it will be a lot easier to help
> you. Tell us what you are trying to do, how you are trying and how it fails.
>
> Best regards,
> Álvaro.
>
>
>
> Ramesh R wrote: Hi,
>
>
>
> I am using torque for struts application. I am currently finding difficult
> configuring torque. Please guide me in how to do this.
>
>
>
>
>
> Thanks
>
>
>
> Ramesh r
>
>
>
>
>
>
> ---------------------------------
> Looking for last minute shopping deals? Find them fast with Yahoo!
> Search.
>
--
cheers !!
ramesh r
---------------------------------
Never miss a thing. Make Yahoo your homepage.
Re: Configure torque for struts
Posted by Alvaro Coronel <al...@yahoo.com>.
Sorry, I just read Guy's answer.
Below is the URL of a nice article you can make good use of. Try a javax.Servlet.ServletContextListener better than init() in one of your servlets.
http://www.onjava.com/pub/a/onjava/2001/04/12/listeners.html
Way off Torque now!,
Álvaro.
Ram <ra...@gmail.com> wrote: yes, i created a servlet and am loading it at start up. now its working
fine..
On Dec 17, 2007 12:09 PM, Guy Galil wrote:
> You need to initialize Torque only once at the beginning of your
> application, We do it in the init() method of the first servlet we load
> On Mon, 2007-12-17 at 08:17 +0530, Ram wrote:
> > Well to be specific, I have configured the torque, generated the sql
> schema
> > files and made it to run perfectly. I even tested using it inside a
> main
> > class like this.
> >
> > public static void main(String[] args) throws Exception
> > {
> > String path = "../crm/Torque.properties";
> >
> > Torque.init(path);
> > Contacts contacts = new Contacts();
> > contacts.setFirstname("Ramesh");
> > contacts.setLastname("R");
> > contacts.setMiddlename("n");
> > contacts.save();
> > }
> >
> > But my purpose is to use it in struts. I am using it like this.
> >
> > public ActionForward execute(ActionMapping mapping, ActionForm form,
> > HttpServletRequest request, HttpServletResponse response)
> > throws Exception
> > {
> > String path = "../crm/Torque.properties";
> >
> > Torque.init(path);
> > Contacts contacts = new Contacts();
> > contacts.setFirstname("xyz");
> > contacts.setLastname("s");
> > contacts.setMiddlename("n");
> > contacts.save();
> > request.setAttribute("Id", contacts.getPrimaryKey());
> > return mapping.findForward("success");
> > }
> > Please guide whether am on a right track.
> >
> > On Dec 17, 2007 7:54 AM, Alvaro Coronel
> wrote:
> >
> > > Hi Ramesh. If you can be more specific, it will be a lot easier to
> help
> > > you. Tell us what you are trying to do, how you are trying and how it
> fails.
> > >
> > > Best regards,
> > > Álvaro.
> > >
> > >
> > >
> > > Ramesh R wrote: Hi,
> > >
> > >
> > >
> > > I am using torque for struts application. I am currently finding
> difficult
> > > configuring torque. Please guide me in how to do this.
> > >
> > >
> > >
> > >
> > >
> > > Thanks
> > >
> > >
> > >
> > > Ramesh r
> > >
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------
> > > Looking for last minute shopping deals? Find them fast with Yahoo!
> > > Search.
> > >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
--
cheers !!
ramesh r
---------------------------------
Never miss a thing. Make Yahoo your homepage.
Re: Configure torque for struts
Posted by Ram <ra...@gmail.com>.
yes, i created a servlet and am loading it at start up. now its working
fine..
On Dec 17, 2007 12:09 PM, Guy Galil <gu...@guardium.com> wrote:
> You need to initialize Torque only once at the beginning of your
> application, We do it in the init() method of the first servlet we load
> On Mon, 2007-12-17 at 08:17 +0530, Ram wrote:
> > Well to be specific, I have configured the torque, generated the sql
> schema
> > files and made it to run perfectly. I even tested using it inside a
> main
> > class like this.
> >
> > public static void main(String[] args) throws Exception
> > {
> > String path = "../crm/Torque.properties";
> >
> > Torque.init(path);
> > Contacts contacts = new Contacts();
> > contacts.setFirstname("Ramesh");
> > contacts.setLastname("R");
> > contacts.setMiddlename("n");
> > contacts.save();
> > }
> >
> > But my purpose is to use it in struts. I am using it like this.
> >
> > public ActionForward execute(ActionMapping mapping, ActionForm form,
> > HttpServletRequest request, HttpServletResponse response)
> > throws Exception
> > {
> > String path = "../crm/Torque.properties";
> >
> > Torque.init(path);
> > Contacts contacts = new Contacts();
> > contacts.setFirstname("xyz");
> > contacts.setLastname("s");
> > contacts.setMiddlename("n");
> > contacts.save();
> > request.setAttribute("Id", contacts.getPrimaryKey());
> > return mapping.findForward("success");
> > }
> > Please guide whether am on a right track.
> >
> > On Dec 17, 2007 7:54 AM, Alvaro Coronel <al...@yahoo.com>
> wrote:
> >
> > > Hi Ramesh. If you can be more specific, it will be a lot easier to
> help
> > > you. Tell us what you are trying to do, how you are trying and how it
> fails.
> > >
> > > Best regards,
> > > Álvaro.
> > >
> > >
> > >
> > > Ramesh R <ra...@gmail.com> wrote: Hi,
> > >
> > >
> > >
> > > I am using torque for struts application. I am currently finding
> difficult
> > > configuring torque. Please guide me in how to do this.
> > >
> > >
> > >
> > >
> > >
> > > Thanks
> > >
> > >
> > >
> > > Ramesh r
> > >
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------
> > > Looking for last minute shopping deals? Find them fast with Yahoo!
> > > Search.
> > >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
--
cheers !!
ramesh r
Re: Configure torque for struts
Posted by Guy Galil <gu...@guardium.com>.
You need to initialize Torque only once at the beginning of your
application, We do it in the init() method of the first servlet we load
On Mon, 2007-12-17 at 08:17 +0530, Ram wrote:
> Well to be specific, I have configured the torque, generated the sql schema
> files and made it to run perfectly. I even tested using it inside a main
> class like this.
>
> public static void main(String[] args) throws Exception
> {
> String path = "../crm/Torque.properties";
>
> Torque.init(path);
> Contacts contacts = new Contacts();
> contacts.setFirstname("Ramesh");
> contacts.setLastname("R");
> contacts.setMiddlename("n");
> contacts.save();
> }
>
> But my purpose is to use it in struts. I am using it like this.
>
> public ActionForward execute(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response)
> throws Exception
> {
> String path = "../crm/Torque.properties";
>
> Torque.init(path);
> Contacts contacts = new Contacts();
> contacts.setFirstname("xyz");
> contacts.setLastname("s");
> contacts.setMiddlename("n");
> contacts.save();
> request.setAttribute("Id", contacts.getPrimaryKey());
> return mapping.findForward("success");
> }
> Please guide whether am on a right track.
>
> On Dec 17, 2007 7:54 AM, Alvaro Coronel <al...@yahoo.com> wrote:
>
> > Hi Ramesh. If you can be more specific, it will be a lot easier to help
> > you. Tell us what you are trying to do, how you are trying and how it fails.
> >
> > Best regards,
> > Álvaro.
> >
> >
> >
> > Ramesh R <ra...@gmail.com> wrote: Hi,
> >
> >
> >
> > I am using torque for struts application. I am currently finding difficult
> > configuring torque. Please guide me in how to do this.
> >
> >
> >
> >
> >
> > Thanks
> >
> >
> >
> > Ramesh r
> >
> >
> >
> >
> >
> >
> > ---------------------------------
> > Looking for last minute shopping deals? Find them fast with Yahoo!
> > Search.
> >
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
Re: Configure torque for struts
Posted by Ram <ra...@gmail.com>.
Well to be specific, I have configured the torque, generated the sql schema
files and made it to run perfectly. I even tested using it inside a main
class like this.
public static void main(String[] args) throws Exception
{
String path = "../crm/Torque.properties";
Torque.init(path);
Contacts contacts = new Contacts();
contacts.setFirstname("Ramesh");
contacts.setLastname("R");
contacts.setMiddlename("n");
contacts.save();
}
But my purpose is to use it in struts. I am using it like this.
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
String path = "../crm/Torque.properties";
Torque.init(path);
Contacts contacts = new Contacts();
contacts.setFirstname("xyz");
contacts.setLastname("s");
contacts.setMiddlename("n");
contacts.save();
request.setAttribute("Id", contacts.getPrimaryKey());
return mapping.findForward("success");
}
Please guide whether am on a right track.
On Dec 17, 2007 7:54 AM, Alvaro Coronel <al...@yahoo.com> wrote:
> Hi Ramesh. If you can be more specific, it will be a lot easier to help
> you. Tell us what you are trying to do, how you are trying and how it fails.
>
> Best regards,
> Álvaro.
>
>
>
> Ramesh R <ra...@gmail.com> wrote: Hi,
>
>
>
> I am using torque for struts application. I am currently finding difficult
> configuring torque. Please guide me in how to do this.
>
>
>
>
>
> Thanks
>
>
>
> Ramesh r
>
>
>
>
>
>
> ---------------------------------
> Looking for last minute shopping deals? Find them fast with Yahoo!
> Search.
>
--
cheers !!
ramesh r
Re: Configure torque for struts
Posted by Alvaro Coronel <al...@yahoo.com>.
Hi Ramesh. If you can be more specific, it will be a lot easier to help you. Tell us what you are trying to do, how you are trying and how it fails.
Best regards,
Álvaro.
Ramesh R <ra...@gmail.com> wrote: Hi,
I am using torque for struts application. I am currently finding difficult
configuring torque. Please guide me in how to do this.
Thanks
Ramesh r
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.