Re: [OS-webwork] Action Properties HttpSession
On Fri, Feb 07, 2003 at 09:19:07AM +0100, Rickard Öberg wrote: I have an idea: how about adding an interface Model that has one method Object getModel(). It would be implemented in ActionSupport as: public Object getModel() { return this; } It is a good idea. Maverick does something similar, I think. Might I suggest that the method be: Object model() getModel makes it a property, which then becomes part of the model itself. -Chris --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
Re: [OS-webwork] Action Properties HttpSession
Chris Nokleberg wrote: I have an idea: how about adding an interface Model that has one method Object getModel(). It would be implemented in ActionSupport as: public Object getModel() { return this; } It is a good idea. Maverick does something similar, I think. Might I suggest that the method be: Object model() getModel makes it a property, which then becomes part of the model itself. hm.. IIRC model() is also a property (both getModel and model is tested if the model property is accessed. *If* I recall correctly we might as well use getModel(), since it looks cleaner. /Rickard -- Rickard Öberg [EMAIL PROTECTED] Senselogic Got blog? I do. http://dreambean.com --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
Re: [OS-webwork] Action Properties HttpSession
On Friday, Feb 7, 2003, at 08:49 Europe/London, Rickard Öberg wrote: hm.. IIRC model() is also a property (both getModel and model is tested if the model property is accessed. *If* I recall correctly we might as well use getModel(), since it looks cleaner. exposeModel() perhaps? Or fetchModel()? Regards, Simon --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
RE: [OS-webwork] Action Properties HttpSession
-Original Message- From: Rickard Öberg [mailto:[EMAIL PROTECTED]] I have an idea: how about adding an interface Model that has one method Object getModel(). It would be implemented in ActionSupport as: public Object getModel() { return this; } However, for those cases where a separate bean is used (e.g. a value object from EJB) it would be overriden by the action as: public Object getModel() { return someModelBean; } When the dispatcher has executed an action and needs to decide what to put on the ValueStack it simply checks for the Model interface and uses it if available. If not available, then the action itself is used. This would be largely transparent, but would allow for easy use of the form bean concept in Struts. If you need it it's there, but the default is that action=model. By using this one could avoid doing form names such as myBean/oneProperty and simply use oneProperty instead, if the getModel() method returns the model to be used both as input and as result. What say ye? /Rickard +1. Sounds good to me. I've added a Jira task to add this to WW2.0. Speaking of which, +can someone make it so people can comment on Jira Issues? And maybe make it so I can +assign things to myself? I'm thinking for WW2.0 this can be put directly into the Action Interface, and have the default behavior described by Rickard in ActionSupport. Jason --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
Re: [OS-webwork] Action Properties HttpSession
- Original Message - From: Rickard Öberg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 07, 2003 9:19 AM Subject: Re: [OS-webwork] Action Properties HttpSession By using this one could avoid doing form names such as myBean/oneProperty and simply use oneProperty instead, if the getModel() method returns the model to be used both as input and as result. But if your bean contains other beans then you still have to use names like otherBean/newProperty, and if you today use several beans in your action you would have to create a wrapper class for them to use as the model (instead of just adding a get method for each bean in the action). So I do not see a very big practical advantage with the proposed addition. However, I am not against it if you find it useful, as long as the old way of doing it still works. Cheers, Dick [EMAIL PROTECTED] --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
Re: [OS-webwork] Action Properties HttpSession
Dick Zetterberg wrote: By using this one could avoid doing form names such as myBean/oneProperty and simply use oneProperty instead, if the getModel() method returns the model to be used both as input and as result. But if your bean contains other beans then you still have to use names like otherBean/newProperty, and if you today use several beans in your action you would have to create a wrapper class for them to use as the model (instead of just adding a get method for each bean in the action). In that case you could continue to use the action as the wrapper. So I do not see a very big practical advantage with the proposed addition. For the cases you mention, sure. But there's quite a number of cases where only one bean is being used as input/output and for that case it becomes much cleaner. However, I am not against it if you find it useful, as long as the old way of doing it still works. As I noted the default would be that it works exactly like today. /Rickard -- Rickard Öberg [EMAIL PROTECTED] Senselogic Got blog? I do. http://dreambean.com --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
Re: [OS-webwork] Action Properties HttpSession
-1 on adding it in the base Action interface. The minimum level the core XWork framework should do is execute(), that's it. -Pat - Original Message - From: Jason Carreira [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 07, 2003 6:07 AM Subject: RE: [OS-webwork] Action Properties HttpSession -Original Message- From: Rickard Öberg [mailto:[EMAIL PROTECTED]] I have an idea: how about adding an interface Model that has one method Object getModel(). It would be implemented in ActionSupport as: public Object getModel() { return this; } However, for those cases where a separate bean is used (e.g. a value object from EJB) it would be overriden by the action as: public Object getModel() { return someModelBean; } When the dispatcher has executed an action and needs to decide what to put on the ValueStack it simply checks for the Model interface and uses it if available. If not available, then the action itself is used. This would be largely transparent, but would allow for easy use of the form bean concept in Struts. If you need it it's there, but the default is that action=model. By using this one could avoid doing form names such as myBean/oneProperty and simply use oneProperty instead, if the getModel() method returns the model to be used both as input and as result. What say ye? /Rickard +1. Sounds good to me. I've added a Jira task to add this to WW2.0. Speaking of which, can someone make it so people can comment on Jira Issues? And maybe make it so I can assign things to myself? I'm thinking for WW2.0 this can be put directly into the Action Interface, and have the default behavior described by Rickard in ActionSupport. Jason --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
Re: [OS-webwork] Action Properties HttpSession
On Fri, Feb 07, 2003 at 09:49:20AM +0100, Rickard Öberg wrote: hm.. IIRC model() is also a property (both getModel and model is tested if the model property is accessed. *If* I recall correctly we might as well use getModel(), since it looks cleaner. According to the javabeans spec (1.0.1, section 8.3), you need the get for it to be considered a property by the Introspector under normal circumstances. is is allowed for boolean properties. You can customize things through BeanInfo, of course. -Chris --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
RE: [OS-webwork] Action Properties HttpSession
That would be excellent. Regards, -Andre Mermegas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Rickard Öberg Sent: Friday, February 07, 2003 3:49 AM To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] Action Properties HttpSession Chris Nokleberg wrote: I have an idea: how about adding an interface Model that has one method Object getModel(). It would be implemented in ActionSupport as: public Object getModel() { return this; } It is a good idea. Maverick does something similar, I think. Might I suggest that the method be: Object model() getModel makes it a property, which then becomes part of the model itself. hm.. IIRC model() is also a property (both getModel and model is tested if the model property is accessed. *If* I recall correctly we might as well use getModel(), since it looks cleaner. /Rickard -- Rickard Öberg [EMAIL PROTECTED] Senselogic Got blog? I do. http://dreambean.com --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld =omething 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork --- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
[OS-webwork] Action Properties HttpSession
Hi all, Ok, go along with me for a minute heh, Im wondering if there is some really cool WebWork way to accomplish what Im thinking. 1.) An action has 10 properties on it; I want these properties to be available for the life of the HttpSession for other views to use, and I want them accessible in a beanlike manner, In order to accomplish this I have to do the following as far as I can tell. Write a bean that has the same property code basically as inside the action; populate it with the info from the actions properties. Place that bean into the HttpSession inside my action, and proceed This feels very kludgey to me, so I must be thinking incorrectly. My question is there a better way to do this? The only thing I can think of is to not have the properties on the Action, but in its own bean to begin with via Beanutils, and then add that to the session. Regards, -Andre Mermegas