aspose file tools*
The moose likes Struts and the fly likes How to get a new instance of a form bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to get a new instance of a form bean?" Watch "How to get a new instance of a form bean?" New topic
Author

How to get a new instance of a form bean?

Bruno Frascino
Ranch Hand

Joined: Jul 22, 2003
Posts: 55
Hi,
Can I get a new instance of a form bean in my action, i mean, another one, or various?
I don't know... something like this:
DynaActionForm anotherForm = (ActionForm)FormBean.getInstance();

How to get it?
Thanks, sorry about my english...


--BJCK--
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
"BJack",
Welcome to JavaRanch. We don't have too many rules here, but one thing we do have is a naming policy. Please edit your display name to comply with this policy. Thanks in advance, and we look forward to seeing you around the Ranch.
Bruno Frascino
Ranch Hand

Joined: Jul 22, 2003
Posts: 55
Anyone to help me?!
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
Let's assume you've defined the following form and action in your struts-config.xml:

The following code in your Action class should give you an idea how to do what you want.

HTH
[ January 05, 2004: Message edited by: Jason Menard ]
Bruno Frascino
Ranch Hand

Joined: Jul 22, 2003
Posts: 55
Thanks Jason!
Bruno Frascino
Ranch Hand

Joined: Jul 22, 2003
Posts: 55

ModuleConfig moduleConfig = RequestUtils.getModuleConfig(request, getServlet().getServletContext());

That ModuleConfig class is from which package?
Is it an interface?!

I can't import that... what I'm forgetting to do?
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
http://jakarta.apache.org/struts/api/index.html
org.apache.struts.config.ModuleConfig is an interface. It was introduced in Struts 1.1.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get a new instance of a form bean?