actionframework-users Mailing List for ActionFramework (Page 9)
Status: Inactive
Brought to you by:
ptoman
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(11) |
Aug
(26) |
Sep
(38) |
Oct
(33) |
Nov
(18) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(26) |
Feb
(7) |
Mar
(3) |
Apr
(14) |
May
(12) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(2) |
Oct
|
Nov
(5) |
Dec
|
2004 |
Jan
(4) |
Feb
(5) |
Mar
(2) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Petr T. <Pet...@pi...> - 2002-08-09 18:52:38
|
> <template name="/displayObject.vm"> > <invoke component="session" > method="storeSession(Context context, Object $typeID)"/> > <output-variable name="objectList" component="objectManager" > value="getDefaultList($typeID)"/> > </template> > > i have yet to figure out how to pass the actual name of the parameter > to the storeSession() method, but i get an error indicating that the > dtd defines template contents as "(output-variable*,invoke*)", the > "," forcing the order, instead of a "|". > > is there a technical reason for this, or just a preferred way of > doing it. i don't see any reason to FORCE the invoke elements after > the output-variable elements, if you put it before, then one just > has to assume that variables defined in the output-variable elements > won't be available yet. if its after, then they will. or am i > missing something? The reason why <template>'s <output-variable>s are placed before <invoke> is that you can nest another set of <output-variables>s inside <invoke> (and override values or whatever): <template name="/displayObject.vm"> <invoke component="session" method="storeSession(Context context, Object $typeID)"> <output-variable name="objectList" component="objectManager" value="getDefaultList($typeID)"/> <invoke> </template> In addition, <invoke> behaves almost exactly as <action> and may also retrieve values from request (or set them by <input-variable>). Does this satisfy your requirements? Of course, if there is a demand, <output-variable>s could be allowed also after <invoke>s... your opinions, gentlemen? :) Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Craig L. <cr...@be...> - 2002-08-09 15:03:12
|
well, i just finally figured what i would do was create an application component that had some methods that could be called to do any url->context/session management before using the output-variable elements inside the template element. only to discover that the invoke elements MUST be declared (and presumably called) AFTER the output-variable elements. i was going to try this: <template name=3D"/displayObject.vm"> <invoke component=3D"session" method=3D"storeSession(Context context, Object $typeID)"/> <output-variable name=3D"objectList" component=3D"objectManager" value=3D"getDefaultList($typeID)"/> </template> i have yet to figure out how to pass the actual name of the parameter to the storeSession() method, but i get an error indicating that the dtd defines template contents as "(output-variable*,invoke*)", the "," forcing the order, instead of a "|". is there a technical reason for this, or just a preferred way of doing it. i don't see any reason to FORCE the invoke elements after the output-variable elements, if you put it before, then one just has to assume that variables defined in the output-variable elements won't be available yet. if its after, then they will. or am i missing something? cheers, --=20 CraigL->Thx(); Be Developer ID: 5852 |
From: Craig L. <cr...@be...> - 2002-08-09 14:09:42
|
On Fri, 2002-08-09 at 05:07, Mandip S. Sangha wrote: > Hi Craig >=20 > Just a quick suggestion, I have found that when I need to load many=20 > objects for a particular template it is useful to build a super object=20 > to encapsulate all the objects needed for the template. In your case I=20 > would initially build my super object from the given URL store it in a=20 > component that exists session-wide and then redirect to your=20 > show-template url. > [...snip...] this sounds good and would work for most cases in my case also.=20 however, what i was really trying to effect was to have the <template.../> define everything the template needed 'at rest'. this way, ANYTHING could finally decide that something it needed was not available and simply be able to return the default template, which would then have all of its required data loaded for itself. handling things specially in another object (or inside a form/action) would mean that every time i wanted to default to that template, i would have to set things up myself, or have them setup for every call and normally just not use them. i'm starting to play around with the code to see what it would take to add a method attribute to the output-variable element, most of the code is fairly well encapsulated in helper classes, with the exception of the code that preps and converts the parameter values. before i get too involved in it though, i want to see what petr thinks. cheers, --=20 CraigL->Thx(); Be Developer ID: 5852 |
From: Mandip S. S. <ma...@su...> - 2002-08-09 09:05:48
|
Hi Craig Just a quick suggestion, I have found that when I need to load many objects for a particular template it is useful to build a super object to encapsulate all the objects needed for the template. In your case I would initially build my super object from the given URL store it in a component that exists session-wide and then redirect to your show-template url. The xml might look like this: <action name="/getItem/$objectType" method="newItem(String objectType)"> <on-return value="*" assign-to="sessionObjectId" show-url="URL"> <output-variable name="URL" component="Item" value="getURL($sessionObjectId)"/> </on-return> </action> <action name="/editItem/$sessionObjectId" method="getItem(String sessionObjectId)"> <on-return value="*" assign-to="item" show-template="../../../EditItem.html.vm"/> </action> This way newItem is our super object and the method newItem will place a new one of these in a session-wide component and return the id with which it was stored, also you can do all your stuff concerning what objects you want to be loaded in here. The getURL method then simply returns a string in the form /editItem/$sessionObjectId and will redirect to your particular show-template action where the getItem method returns the object you just stored in your component/field. This approach forms a nice seperation where anything that depends on values submitted on a form/URL is dealt with in one action (getItem) and any objects that don't depand on values submitted on a form/URL can be loaded as output-variables in your actual show-template action (editItem). Regards Mandip Craig Longman wrote: >On Wed, 2002-08-07 at 15:39, Petr Toman wrote: > >> > is there any way to pass parameters to the methods that >> > output-variable defined values call? for eg: >> > >> > <output-variable name="objectList" component="objectHandler" >> > value="getObjectList(Context context)"/> >> >>Sure! You can use $variables in method calls in <in/output-variable>s: >> >><output-variable name="objectList" component="objectHandler" >> value="getObjectList($context)"/> >> >>....supposing that $context is already in the context. >> > >hmm, the fact that this requires the data to be in the context, and >won't even try to extract it from the URL is causing me a bit of a >problem. > >what i'm trying to do is have one template that shows a list of >objects. if that template is called with nothing, it simply pulls up >the 10 most recent objects and shows them. however, if that page is >called with an 'objectTypeID' in the URL, i want only the objects that >match that type to be displayed. this should all happen on this >template, regardless of what the action/form stuff is, preferably this >page will be linked directly from outside sources. what i had tried to >do is this: > >i considered using an invoke element (which is allowed inside a template >block), but then you seem to have no control over the return value. and >besides, the invoke element is clearly aimed at achieving a different >end than i'm trying. > >i think what work best for me in my specific case, is an enhancement to >the output-variable element. having the ability to use it very similar >to the action.method would be most desirable, and i think the easiest >way to do this would be to have a 'method' attribute allowed in it. >then, either the value="" or the method="" would be required, the >value="" being processed as it does currently (using the template >evaluator from the looks of it), and the method="" gets processed >exactly the same way that action.method is processed. > >i suppose this might mean that it might make sense to allow >input-variable elements inside the output-variable block, which seems a >bit strange. > >what does everyone think? is this a very specific case, or would >action.method like functionality in output-variable be useful >anywhere/to anyone else? > >cheers, > |
From: Craig L. <cr...@be...> - 2002-08-08 19:18:18
|
On Wed, 2002-08-07 at 15:39, Petr Toman wrote: > > is there any way to pass parameters to the methods that > > output-variable defined values call? for eg: > > > > <output-variable name=3D"objectList" component=3D"objectHandler" > > value=3D"getObjectList(Context context)"/> >=20 > Sure! You can use $variables in method calls in <in/output-variable>s: >=20 > <output-variable name=3D"objectList" component=3D"objectHandler" > value=3D"getObjectList($context)"/> >=20 > ....supposing that $context is already in the context. hmm, the fact that this requires the data to be in the context, and won't even try to extract it from the URL is causing me a bit of a problem. what i'm trying to do is have one template that shows a list of objects. if that template is called with nothing, it simply pulls up the 10 most recent objects and shows them. however, if that page is called with an 'objectTypeID' in the URL, i want only the objects that match that type to be displayed. this should all happen on this template, regardless of what the action/form stuff is, preferably this page will be linked directly from outside sources. what i had tried to do is this: i considered using an invoke element (which is allowed inside a template block), but then you seem to have no control over the return value. and besides, the invoke element is clearly aimed at achieving a different end than i'm trying. i think what work best for me in my specific case, is an enhancement to the output-variable element. having the ability to use it very similar to the action.method would be most desirable, and i think the easiest way to do this would be to have a 'method' attribute allowed in it.=20 then, either the value=3D"" or the method=3D"" would be required, the value=3D"" being processed as it does currently (using the template evaluator from the looks of it), and the method=3D"" gets processed exactly the same way that action.method is processed. i suppose this might mean that it might make sense to allow input-variable elements inside the output-variable block, which seems a bit strange. what does everyone think? is this a very specific case, or would action.method like functionality in output-variable be useful anywhere/to anyone else? cheers, --=20 CraigL->Thx(); Be Developer ID: 5852 |
From: Petr T. <Pet...@pi...> - 2002-08-08 18:03:58
|
> ah, ok. that wasn't clear from the tutorial. i guess the tutorial > showed that you could put $xxx as the value, i didn't make the leap > to assume i could use them as parms in a method call though. i was > expecting the calls there to work like the 'method' attribute of the > 'action' element. I will add an example to Sections 1.5.5.2.1 and 1.5.6 in the spec. > just as an aside, does putting a reference to the context IN the > context open one up for a memory leak? or is the vm smart enough to > know if a reference to something is from something that is ready to > be destroyed anyway? I guess the Context is garbage collected after the template is rendered, but that's up to Velocity/WebMacro. > i suppose putting a reference to the context in the context isn't a > real security concern, you couldn't use that reference in the > template to do anything that a template wouldn't be able to do > otherwise, would it? the context to a template is almost like the > 'this' pointer in a method i guess, you always use it whenever you > use a '$' operator anyway. The context hold only values from request and those set by the application, so I cannot think of anything that might be a security issue. Unless you process someone else's templates (example: custom skins downloaded from an arbitrary URL), you shouldn't worry. Btw, in my app I run all HTTP requests through JAAS - servlet overrides handle() method: public Template handle(final HttpServletRequest request, final HttpServletResponse response, final Context context) { // run this request on behalf of the current user try { return (Template) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws InvocationTargetException { return MyServlet.super.handle(request, response, context); } }, ((Auth) getComponent("authenticator", true)).getContext(policy)); } catch (/* exceptions */) { /* ... */ } } Auth is a subclass of Authenticator from JAASModule (http://dione.zcu.cz/~toman40/JAASModule). This ensures that the user must have a permission for anything s/he is doing. > thanks for taking the time to answer these, i'm slowly getting my > head everything! You're welcome! :) Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Craig L. <cr...@be...> - 2002-08-08 14:15:59
|
On Wed, 2002-08-07 at 15:39, Petr Toman wrote: > > is there any way to pass parameters to the methods that > > output-variable defined values call? for eg: > > > > <output-variable name=3D"objectList" component=3D"objectHandler" > > value=3D"getObjectList(Context context)"/> >=20 > Sure! You can use $variables in method calls in <in/output-variable>s: >=20 > <output-variable name=3D"objectList" component=3D"objectHandler" > value=3D"getObjectList($context)"/> >=20 > ....supposing that $context is already in the context. ah, ok. that wasn't clear from the tutorial. i guess the tutorial showed that you could put $xxx as the value, i didn't make the leap to assume i could use them as parms in a method call though. i was expecting the calls there to work like the 'method' attribute of the 'action' element. just as an aside, does putting a reference to the context IN the context open one up for a memory leak? or is the vm smart enough to know if a reference to something is from something that is ready to be destroyed anyway? i suppose putting a reference to the context in the context isn't a real security concern, you couldn't use that reference in the template to do anything that a template wouldn't be able to do otherwise, would it?=20 the context to a template is almost like the 'this' pointer in a method i guess, you always use it whenever you use a '$' operator anyway. > Components created by DefaultInstantiator can have constructor with > a parameter ActionServlet (or its subclass), so you can pass the servlet > reference to the component. ok, i see that now to. i was just getting to point in the thinking process that i might need to create my own instantiator, which would have made this obvious once i looked at the javadoc. thanks for taking the time to answer these, i'm slowly getting my head everything! sincerely, --=20 CraigL->Thx(); Be Developer ID: 5852 |
From: Craig L. <cr...@be...> - 2002-08-08 13:28:58
|
On Wed, 2002-08-07 at 15:31, Petr Toman wrote: >=20 > I see. AS prints "Setting HTTP response content-type: 'null'", which > later causes NullPointerException. Thanks for bugreport! :) k. sorry for not getting it sooner, i am still in 'getting a handle' mode, i'm glad you could find it. > I have no experience with Tomcat and vhosts, but I think this is more a > question of Tomcat than AS, which behaves just as a usual servlet =3D if > you get working Tomcat + vhost + any servlet, you should be able to use > AS in a similar manner. absolutely. the only reason i mentioned tomcat being confusing, was just to explain why i wanted to know about jserv compatibility. > Btw, some people prefer Jetty over Tomcat esp. because of speed. hmm, a new one to me. i'll have to check it out, thanks again. --=20 CraigL->Thx(); Be Developer ID: 5852 |
From: Petr T. <Pet...@pi...> - 2002-08-07 19:43:26
|
> i have managed to figure out what i need to do by over-riding > ActionServlet and implementing a couple methods, most of the work is > being done in handle() and newSession(). Good. > i can try and repro the exception, but the problem is really related > to what the documentation makes clear; i had no is-new-session and > the isNewSession() method was not over-ridden. it was happening in > the reqeust.setContentType() method, because the default > ActionReturnData didn't specify a contenttype to use. I see. AS prints "Setting HTTP response content-type: 'null'", which later causes NullPointerException. Thanks for bugreport! :) > tomcat is just such a configuration nightmare compared to jserv. i > still haven't had the courage to figure out how to make tomcat run > for a separate virtual server. i just get frustrated when 'latest > and greatest' so frequently seems to translate into 'insanely > complicated configuration you now HAVE to deal with'. i still get > tomcat errors with the url alias doesn't match the webapps directory > name. it just seems like someone decided how they liked to organize > their web stuff and its just been forced into the structure for > tomcat. anyway, i'm making headway; i can develop at least and if i > decided to move back to jserv when it comes time to 'release' what > i'm working on, so be it. I have no experience with Tomcat and vhosts, but I think this is more a question of Tomcat than AS, which behaves just as a usual servlet = if you get working Tomcat + vhost + any servlet, you should be able to use AS in a similar manner. Btw, some people prefer Jetty over Tomcat esp. because of speed. Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Petr T. <Pet...@pi...> - 2002-08-07 19:43:25
|
> is there any way to pass parameters to the methods that > output-variable defined values call? for eg: > > <output-variable name="objectList" component="objectHandler" > value="getObjectList(Context context)"/> Sure! You can use $variables in method calls in <in/output-variable>s: <output-variable name="objectList" component="objectHandler" value="getObjectList($context)"/> ....supposing that $context is already in the context. > if not, then i really think there should be. seems to me that the > Context is (almost) indispensable for most of these calls. now, i > suppose one could work around this a bit by making sure the component > is marked as 'session', then use the component itself that to hold > all of the other data pieces one might need for a request. but by > not having any defined interfaces between the main servlet > (ActionServlet) and the component, there is no way to easily setup > any 'session' data by passing it to the constructor or some other > init() method. so, this means that any shared data would need to > come from some static or singleton mechanism, which limits its > flexibility. make sense? Components created by DefaultInstantiator can have constructor with a parameter ActionServlet (or its subclass), so you can pass the servlet reference to the component. Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Craig L. <cr...@be...> - 2002-08-07 17:18:07
|
is there any way to pass parameters to the methods that output-variable defined values call? for eg: <output-variable name=3D"objectList" component=3D"objectHandler" value=3D"getObjectList(Context context)"/> if not, then i really think there should be. seems to me that the Context is (almost) indispensable for most of these calls. now, i suppose one could work around this a bit by making sure the component is marked as 'session', then use the component itself that to hold all of the other data pieces one might need for a request. but by not having any defined interfaces between the main servlet (ActionServlet) and the component, there is no way to easily setup any 'session' data by passing it to the constructor or some other init() method. so, this means that any shared data would need to come from some static or singleton mechanism, which limits its flexibility. make sense? --=20 CraigL->Thx(); Be Developer ID: 5852 |
From: Craig L. <cr...@be...> - 2002-08-07 16:23:25
|
On Fri, 2002-08-02 at 13:02, Petr Toman wrote: > Grrr, it seems my previous mails have disappeared... :( Sorry for delay. np. thanks for answering, sorry for the delay in getting back myself, i had almost given up on the list. > > I want to use ActionServlet to handle ALL the webpages on a specific > > vhost, much like one would do with php or jsp. One problem I'm > > having is with the 'is-new-session' attribute of the template tag. > > When I put that attribute in, it seems like the marked template is > > ALWAYS displayed, regardless of what the actual template name I typed > > in was. However, excluding that attribute results in a > > NullPointerException being thrown. I'm going through the code now to > > try and figure out why this might be happening, but I thought I'd > > also ask. >=20 > is-new-session attr is flag for the template to be shown upon a new > session. I don't understand which template is always displayed for you - > the one with 'is-new-session'? As for the exception, could you post a > full stacktrace please? the correct template is being shown, but what i was looking for was more of a general purpose template library. i had hoped to be able to simply request a template (from the browser), have actionservlet apply its rules, find nothing special, then display the template i had requested.=20 but it seems that the only template offered (when no form.action rules are satisfied at least) is the is-new-session one, regardless of what the URL requests. i have managed to figure out what i need to do by over-riding ActionServlet and implementing a couple methods, most of the work is being done in handle() and newSession(). i can try and repro the exception, but the problem is really related to what the documentation makes clear; i had no is-new-session and the isNewSession() method was not over-ridden. it was happening in the reqeust.setContentType() method, because the default ActionReturnData didn't specify a contenttype to use. > Btw, what's the problem with Tomcat? You should be able to create > examples/as_examples.war (by running 'ant war') and deploy it into > Tomcat's webapps directory. tomcat is just such a configuration nightmare compared to jserv. i still haven't had the courage to figure out how to make tomcat run for a separate virtual server. i just get frustrated when 'latest and greatest' so frequently seems to translate into 'insanely complicated configuration you now HAVE to deal with'. i still get tomcat errors with the url alias doesn't match the webapps directory name. it just seems like someone decided how they liked to organize their web stuff and its just been forced into the structure for tomcat. anyway, i'm making headway; i can develop at least and if i decided to move back to jserv when it comes time to 'release' what i'm working on, so be it. > I run my AS-based app in Apache/JServ 1.1.2 with no problems good news, thanks. --=20 CraigL->Thx(); Be Developer ID: 5852 |
From: Petr T. <Pet...@pi...> - 2002-08-06 19:29:08
|
> in ActionRuntime.java there is this line: actionConfigFile = new > File(servlet.getClass().getResource("/" + configFilename).getFile()); > > > which will give NullPointerException if getResource fails (remember > getResource just returns null on failure; it does not throw an > exception). Yep, I know about this - will be fixed in the next release, but thanks for bugreport anyway. Here's what I have fixed already: - bugfix: misleading unexpected initialization error was reported when ActionConfig was not found - bugfix: <in/output-variable> evaluated to null on false "if" condition even if some value had been retreived from the request or URL - bugfix: <in/output-variable name="v1" value="$v2"/>s copied always $v2 as String - bugfix: parameter retreiving didn't work for <invoke> in some cases - bugfix: composite type definition was not checked against null - bugfix: SendReceive demo functionality was broken > btw, in order to get the velocity conversion to work, this will work > in build.xml as an alternative to mucking with the ant installation: > > <taskdef name="templateConvertor" > classname="org.actionframework.engines.velocity.convert.TemplateConve- > rtorAntTask"> <classpath> <pathelement > location="lib/TemplateConvertor.jar"/> <pathelement > location="${Velocity.home}/velocity-1.3.1-rc2.jar"/> <pathelement > location="lib/jakarta-oro-2.0.5.jar"/> </classpath> </taskdef> Good idea. Will be there. > Speaking of Velocity.home, I think it'd be easier in build.xml and > build.properties to just ask for Velocity.jar or Velocity.classpath, > rather than hardcoding assumptions about the jar file name. I had to > edit build.xml to make ugly things like this: <available > file="${Velocity.home}/velocity-1.3.1-rc2.jar" > property="Velocity.All"/> <available > file="${Velocity.home}/velocity-1.2.jar" property="Velocity.All"/> > <available file="${Velocity.home}/velocity-1.1.jar" > property="Velocity.All"/> just to get it to run with my recent > version of velocity. Agreed. Thanks for suggestions! -Petr PS: http://www.actionframework.org is working finally! :) -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Mark D. A. <md...@di...> - 2002-08-06 03:38:43
|
in ActionRuntime.java there is this line: actionConfigFile = new File(servlet.getClass().getResource("/" + configFilename).getFile()); which will give NullPointerException if getResource fails (remember getResource just returns null on failure; it does not throw an exception). btw, in order to get the velocity conversion to work, this will work in build.xml as an alternative to mucking with the ant installation: <taskdef name="templateConvertor" classname="org.actionframework.engines.velocity.convert.TemplateConvertorAntTask"> <classpath> <pathelement location="lib/TemplateConvertor.jar"/> <pathelement location="${Velocity.home}/velocity-1.3.1-rc2.jar"/> <pathelement location="lib/jakarta-oro-2.0.5.jar"/> </classpath> </taskdef> Speaking of Velocity.home, I think it'd be easier in build.xml and build.properties to just ask for Velocity.jar or Velocity.classpath, rather than hardcoding assumptions about the jar file name. I had to edit build.xml to make ugly things like this: <available file="${Velocity.home}/velocity-1.3.1-rc2.jar" property="Velocity.All"/> <available file="${Velocity.home}/velocity-1.2.jar" property="Velocity.All"/> <available file="${Velocity.home}/velocity-1.1.jar" property="Velocity.All"/> just to get it to run with my recent version of velocity. -mda |
From: Petr T. <Pet...@pi...> - 2002-08-05 16:50:26
|
> In summation I think the framework is pretty much where we would like > it to be apart from the "different type handlers for different > methods with the same input class" and the "loading values upon a new > session" that David talked about. It would be excellent if you could > find the time to complete these requests. In the mean time thanks > for developing such a great tool!!!! :-) I'm really looking forward to implement the new features, but I've got to finish my AS-based project and (it seems that) I will have time no sooner then in the last week of August. Only bugfix versions (AS 0.93.1b+0.93.2b) will be released in two weeks - so if you find any bugs, please report them so they can be fixed too! I searched mail archive and couldn't find David's "loading values upon a new session" - can you remind me what was that? Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Petr T. <Pet...@pi...> - 2002-08-05 16:50:25
|
Grrr, it seems my previous mails have disappeared... :( Sorry for delay. > I want to use ActionServlet to handle ALL the webpages on a specific > vhost, much like one would do with php or jsp. One problem I'm > having is with the 'is-new-session' attribute of the template tag. > When I put that attribute in, it seems like the marked template is > ALWAYS displayed, regardless of what the actual template name I typed > in was. However, excluding that attribute results in a > NullPointerException being thrown. I'm going through the code now to > try and figure out why this might be happening, but I thought I'd > also ask. is-new-session attr is flag for the template to be shown upon a new session. I don't understand which template is always displayed for you - the one with 'is-new-session'? As for the exception, could you post a full stacktrace please? Btw, what's the problem with Tomcat? You should be able to create examples/as_examples.war (by running 'ant war') and deploy it into Tomcat's webapps directory. > Also, I'm wondering about if ActionServlet can be configured to work > with the older Apache JServ. ActionServlet says it is compatible > with JSDK 2.0, which means the Java Servlet API 2.0, right? So, in > theory I think it should work, but I have been unable to find > anything to indicate either way. Any advice would be appreciated. I run my AS-based app in Apache/JServ 1.1.2 with no problems, but I would recommend you to try Tomcat first. Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Craig L. <cr...@be...> - 2002-07-29 17:24:55
|
I want to use ActionServlet to handle ALL the webpages on a specific vhost, much like one would do with php or jsp. One problem I'm having is with the 'is-new-session' attribute of the template tag. When I put that attribute in, it seems like the marked template is ALWAYS displayed, regardless of what the actual template name I typed in was.=20 However, excluding that attribute results in a NullPointerException being thrown. I'm going through the code now to try and figure out why this might be happening, but I thought I'd also ask. I'm sure I'm missing something, but I'm not sure what. I've poured over the documentation, and everything seems to be configured correctly. Also, I'm wondering about if ActionServlet can be configured to work with the older Apache JServ. ActionServlet says it is compatible with JSDK 2.0, which means the Java Servlet API 2.0, right? So, in theory I think it should work, but I have been unable to find anything to indicate either way. Any advice would be appreciated. Sincerely, --=20 CraigL->Thx(); Be Developer ID: 5852 |
From: Mandip S. S. <ma...@su...> - 2002-07-23 16:10:05
|
Hi Petr Thanks for the quick response. -------------------------------------------------------------------------- Summary: 1) you need to transfer an object across calls - this can be achieved by: a) storing it in a session component (like your ObjectStore) b) putting it into the session directly (by 'scope' attribute) c) serializing it in the request/response (clumsy or even impossible) d) ? AS can implement 1b) easily (by ParameterRetriever), the question is: 2) how to remove our object from the session: a) let it expire with the session (default behaviour) b) remove it from the session when the <in/output-variable> scope changes c) programatically: ctx.get("REQUEST").getSession().removeValue("id") d) ? I think that "id management" should not be done by AS. If you need to pass both object and its id, you can simply put them as two $variables into the context/session (or include the id with its object). -------------------------------------------------------------------------- If this is the case (with "id management") then I think perhaps it may not be worth introducing a scope attribute for <in/output-variable>'s. We already have the functionality for transfering objects across calls, using 1a (which is simple and works very well) and perhaps introducing 1b would be overkill/unnecessary. "You can use <invoke> element to avoid URL redirecting" Oops I think I gave you the wrong impression here, we love URL redirecting because it means that a user cannot perform a Ctrl+Shift+Reload and possibly resubmit invalid values on a template! :-) In summation I think the framework is pretty much where we would like it to be apart from the "different type handlers for different methods with the same input class" and the "loading values upon a new session" that David talked about. It would be excellent if you could find the time to complete these requests. In the mean time thanks for developing such a great tool!!!! :-) Regards Mandip |
From: Petr T. <cz5...@ti...> - 2002-07-23 12:53:39
|
Hello again! ><action name=3D"/addObject" method=3D"newObject()"> > <on-return value=3D"*" assign-to=3D"objectStoreId" show-url=3D"objectU= RL"> > <output-variable name=3D"objectURL" > value=3D"/ActionServlet/editObject/$objectStoreId"/= > > </on-return> ></action> > ><action name=3D"/getObject/$objectId" method=3D"newobject(String objectI= d)"> > <on-return value=3D"*" assign-to=3D"objectStoreId" show-url=3D"objectU= RL"> > <output-variable name=3D"objectURL" > value=3D"/ActionServlet/editObject/$objectSoreId"/>= > </on-return> ></action> > ><action name=3D"/editObject/$objectStoreId" method=3D"getObjectStore(Str= ing >objectStoreId)"> > <on-return value=3D"*" assign-to=3D"object" > show-template=3D"org/visres/ivr/security/view/EditObject.ht= ml.vm"/> ></action> >I have also created a seperate ObjectStore class that holds objects in a >HashMap and allows entry of objects into the HashMap, returning a unique= >id for the object just stored, and also a object remove method. Another= >point is that I'm only interested in having an object stored while I'm >on its corresponding add/edit page otherwise there is no need to have it= >around. > >If in our system we choose to add an Object and execute the /addObject >action, the newObject() method will create a new Object and place it in >the ObjectStore returning a unique store id. Now that we have stored a >new Object the url is redirected to the editObject action which will >pull this object out of the ObjectStore. Much the same happens when >editing an object already in the database. If we execute the >/editObject action passing the selected objects database id to the >newObject(String objectId) method, the objects values are retrieved from= >the database and the object is stored returning its unique store id >(remember that we will now have two id's for an object one being its >actual id in the database and the other its id for the ObjectStore). >Again the url will redirect to the /editObject action. You can use <invoke> element to avoid URL redirecting - example: <action name=3D"/addObject" method=3D"newObject()"> <on-return value=3D"*" assign-to=3D"objectStoreId" show-template=3D"org/visres/.../EditObject.html.vm= "> <invoke method=3D"getObjectStore(String objectStoreId)"> <input-variable name=3D"objectStoreId" value=3D"$objectStoreId"/> </invoke> </on-return> </action> >So if, for example, I wanted to change the /addObject action to use your= >"optional attribute for <in/output-variable>" idea, then I'd like to >totally replace the ObjectStore class, meaning that when I save an >object to the session I'd like to get a unique store/session id in >return and I'd also like to be able to remove objects from the session. >I don't think simply adding a scope attribute to the <output-variable> >tag will provide this functionality. You could decide that you do not >want to provide all this functionality apart from adding objects to the >session and leave the unique id functionality to the developer. What do= >you think? Summary: 1) you need to transfer an object across calls - this can be achieved by:= a) storing it in a session component (like your ObjectStore) b) putting it into the session directly (by 'scope' attribute) c) serializing it in the request/response (clumsy or even impossible) d) ? AS can implement 1b) easily (by ParameterRetriever), the question is: 2) how to remove our object from the session: a) let it expire with the session (default behaviour) b) remove it from the session when the <in/output-variable> scope chan= ges c) programatically: ctx.get("REQUEST").getSession().removeValue("id") d) ? I think that "id management" should not be done by AS. If you need to pas= s both object and its id, you can simply put them as two $variables into th= e context/session (or include the id with its object). >Also, a quick update on other aspects of the framework. First the issue= >of show-template/show-url attribute, since being able to pass objects >from one request to another things are working really well. Our >implementation is such that the show-template attribute is only ever >used once on each template, if another action wants to reach this >template then you are forced to call the show-url attribute that >redirects to the action that contains the show-template for the template= >you wish to see. This ensures that any <output-variable>'s that are >required for this template are loaded. Secondly, I also think we were Nesting <output-variable>s inside <template> allows all necessary $variab= les to be set up for the template. >possibly trying to do too much with the framework, where when a user >updates a particular object and the updates throw errors, we were using >actually using the <on-exception> tag to catch these errors and take the= >appropriate action. I think as far as redirecting to different url's is= >concerned the framework works really well but when you want to stay on >the same url and produce some error messages then it's best not to throw= >this up to ActionServlet but to deal with it in your components. Can you explain what are you missing or give me a comparing example pleas= e? >Sorry for the length of the mail, but if you've understood it that would= >be good, if you could make some comments/suggestions that would be >REALLY good and if you could actually implement some of the ideas that >would be absolutely AMAZING!!!! :-) I'm going to set up Tasks for AS this week. I still don't have much time,= but I believe I can do some of "the most expected" RFEs :) -Petr [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=3D22957959 ] _________________________________________________ Tipy na va=B9i dovolenou na http://leto.tiscali.cz |
From: Mandip S. S. <ma...@su...> - 2002-07-23 09:31:31
|
Hi Petr I realy like the "optional attribute for <in/output-variable>" idea mentioned in your email. I want to discuss how we could take this forward. As I mentioned in my previous email I had problems passing Objects from one request to another using the framework and suggested a solution which I thought could be messy. However, I have since implemented this idea and it actually works quite well. The solution was: "I could think about creating a component existing session-wide and place objects in it and possibly check this component for objects in the /editObject action for example." My xml looks like: <action name="/addObject" method="newObject()"> <on-return value="*" assign-to="objectStoreId" show-url="objectURL"> <output-variable name="objectURL" value="/ActionServlet/editObject/$objectStoreId"/> </on-return> </action> <action name="/getObject/$objectId" method="newobject(String objectId)"> <on-return value="*" assign-to="objectStoreId" show-url="objectURL"> <output-variable name="objectURL" value="/ActionServlet/editObject/$objectSoreId"/> </on-return> </action> <action name="/editObject/$objectStoreId" method="getObjectStore(String objectStoreId)"> <on-return value="*" assign-to="object" show-template="org/visres/ivr/security/view/EditObject.html.vm"/> </action> I have also created a seperate ObjectStore class that holds objects in a HashMap and allows entry of objects into the HashMap, returning a unique id for the object just stored, and also a object remove method. Another point is that I'm only interested in having an object stored while I'm on its corresponding add/edit page otherwise there is no need to have it around. If in our system we choose to add an Object and execute the /addObject action, the newObject() method will create a new Object and place it in the ObjectStore returning a unique store id. Now that we have stored a new Object the url is redirected to the editObject action which will pull this object out of the ObjectStore. Much the same happens when editing an object already in the database. If we execute the /editObject action passing the selected objects database id to the newObject(String objectId) method, the objects values are retrieved from the database and the object is stored returning its unique store id (remember that we will now have two id's for an object one being its actual id in the database and the other its id for the ObjectStore). Again the url will redirect to the /editObject action. So if, for example, I wanted to change the /addObject action to use your "optional attribute for <in/output-variable>" idea, then I'd like to totally replace the ObjectStore class, meaning that when I save an object to the session I'd like to get a unique store/session id in return and I'd also like to be able to remove objects from the session. I don't think simply adding a scope attribute to the <output-variable> tag will provide this functionality. You could decide that you do not want to provide all this functionality apart from adding objects to the session and leave the unique id functionality to the developer. What do you think? Also, a quick update on other aspects of the framework. First the issue of show-template/show-url attribute, since being able to pass objects from one request to another things are working really well. Our implementation is such that the show-template attribute is only ever used once on each template, if another action wants to reach this template then you are forced to call the show-url attribute that redirects to the action that contains the show-template for the template you wish to see. This ensures that any <output-variable>'s that are required for this template are loaded. Secondly, I also think we were possibly trying to do too much with the framework, where when a user updates a particular object and the updates throw errors, we were using actually using the <on-exception> tag to catch these errors and take the appropriate action. I think as far as redirecting to different url's is concerned the framework works really well but when you want to stay on the same url and produce some error messages then it's best not to throw this up to ActionServlet but to deal with it in your components. Sorry for the length of the mail, but if you've understood it that would be good, if you could make some comments/suggestions that would be REALLY good and if you could actually implement some of the ideas that would be absolutely AMAZING!!!! :-) Regards Mandip Petr Toman wrote: > > However this seems a bit messy. Do you think we need to add more > > funtionality to the framework? Perhaps we could have > > <session-output-variables> that place things into the session and > > then when looking for parameters for a method the framework would not > > only look for parameters in the request but the session aswell? > > Great! I believe this has much to do with David's suggestion ( > http://dione.zcu.cz/pipermail/as-list/2002-March/000014.html ). I've > been looking for a way to implement this consistently, but I think YOU > have made it! :) > > I would only introduce a new optional attribute for > <in/output-variable> rather than a new element: > > <output-variable name="number1" value="1" scope="session"/> > <output-variable name="number2" value="2" scope="request"/> > <input-variable name="number3" value="3" scope="session"/> > <input-variable name="number4" value="4"/> > > This would put number1 and number3 into Context AND session, while > number2 and number 4 into Context only. When retrieving values, AS > would look first into session and then into Context. > > -Petr |
From: Petr T. <Pet...@pi...> - 2002-07-14 10:39:01
|
> However this seems a bit messy. Do you think we need to add more > funtionality to the framework? Perhaps we could have > <session-output-variables> that place things into the session and > then when looking for parameters for a method the framework would not > only look for parameters in the request but the session aswell? Great! I believe this has much to do with David's suggestion (http://dione.zcu.cz/pipermail/as-list/2002-March/000014.html). I've been looking for a way to implement this consistently, but I think YOU have made it! :) I would only introduce a new optional attribute for <in/output-variable> rather than a new element: <output-variable name="number1" value="1" scope="session"/> <output-variable name="number2" value="2" scope="request"/> <input-variable name="number3" value="3" scope="session"/> <input-variable name="number4" value="4"/> This would put number1 and number3 into Context AND session, while number2 and number 4 into Context only. When retrieving values, AS would look first into session and then into Context. -Petr -- >>> http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 <<< |
From: Mandip S. S. <ma...@su...> - 2002-07-10 18:15:25
|
Hi Petr I need to be able to pass objects from one request to another and so far have not found an easy way of doing this using the framework. The problem is as follows:- I have objects which correspond to row entries in a table called, lets say, RowObjects. I have an action defined for RowObjects so that a user is able to go an edit page for an individual RowObject and I also have an action for any changes that a user makes to a RowObject in the RowObject edit page. The code is as follows: <action name="/editRowObject" method="getRowObject(String rowObjectId)"> <on-return value="*" assign-to="rowObject" show-template="org/visres/ivr/security/EditRowObject.html.vm"/> <on-exception class="Exception" assign-to="error" show-template="error.vm"/> </action> <action name="/rowObjectAction" method="rowObjectAction(String actionType, String rowObjectId, String field1, String field2, String field3)"> <on-return value="*" assign-to="rowObjectId" show-url="rowObjectURL"> <output-variable name="rowObjectURL" component="Security" value="getRowObjectURL($rowObjectId)"/> </on-return> <on-exception class="Exception" assign-to="exception" show-template="org/visres/ivr/security/EditRowObject.html.vm"> <output-variable name="error" value="$exception.getMessage()"/> <output-variable name="rowObject" value="$exception.getChangedObject()"/> </on-exception> </action> If we imagine we're in the system and arrive at a page that lists all RowObjects, we click an individual RowObject which triggers the /editRowObject action and we arrive at the EditRowObject.html.vm page. We see all the fields for this RowObject and need to be able to update these fields. Two things are important here first after we update the fields we should stay on this edit page and secondly if when doing field updates any of the values we enter are wrong, we need to be bought back to this edit page with a helpful error message. So if we imagine when we update a RowObject we trigger the /rowObjectAction and we find some field values are wrong and an exception is thrown. I now have a RowObject with erreneous values and an error message, which need to be displayed. Currently when this is happening I'm essentially repeating the code in the /editRowObject action within the <on-exception> block of the /rowObjectAction action, this is not nice!!!! Instead of doing show-template in the <on-exception> block I want to be able do show-url which redirects to the /editRowObject action. However, once I do this I loose everything in the context and I'm left with no error meassage and no RowObject :-( Is there a simple way of getting round this problem? I could think about creating a component existing session-wide and place objects in it and possibly check this component for objects in the /editRowObject action for example. However this seems a bit messy. Do you think we need to add more funtionality to the framework? Perhaps we could have <session-output-variables> that place things into the session and then when looking for parameters for a method the framework would not only look for parameters in the request but the session aswell? Any comments/suggestions would be much appreciated. Regards Mandip P.S. due to mail server problems please could you Cc: any replys to man...@ya... |
From: Petr T. <Pet...@pi...> - 2002-07-07 15:26:38
|
> > We may want to add extra standard items to the context in future > > releases, but this risks namespace problems. So instead why don't we > > put an ActionFrameworkStandardContext object into the context. At the > > moment this would give us to use in our templates > > > > $ActionFramework.Servlet $ActionFramework.Url $ActionFramework.Action > > $ActionFramework.Version I've got a question regarding $ActionFramework.Action: I want to ask everybody's opinion on changing ActionServlet method signatures for 0.94 or 0.95, that have arguments 'form' and 'action', to 'action' only. Example: Object afterInvoke(Object retValue, Context context, String form, String action, Object[] convertedParams) throws Exception would change to: Object afterInvoke(Object retValue, Context context, String action, Object[] convertedParams) throws Exception The original methods would become deprecated, but remained functional - they would only call the new ones - contactenating 'form' and 'action' with dot ('.'). Example: Object afterInvoke(Object retValue, Context context, String form, String action, Object[] convertedParams) throws Exception { return afterInvoke(retValue, context, form + "." + action, convertedParams); } -Petr -- >>> http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 <<< |
From: Petr T. <Pet...@pi...> - 2002-07-07 15:26:34
|
ActionServlet 0.93.2a (http://sourceforge.net/projects/actionframework) Changes from 0.93.2 to 0.93.2a 6-Jul-2002 ------------------------------ - session based initialization code is now run before ActionServlet.handle() is called - this allows calling getComponent() method from handle() - links to www.actionframework.org removed because of VHOST issue on SF - bugfix: build.xml creates 'classes' directories - need when building from CVS - bugfix: templates names caching removed (caused 'template was not loaded by getTemplate() method' error when template name cache expired - bugfix: JavaBeansInstantiator didn't initialize props of re-created component - bugfix: URLParameterRetriever didn't retrieve last single-character parameter Note: versions 0.93.1a and 0.93.2a use exactly the same code except for ActionConfigEntityResolver-0.93.2a accepts www.actionframework.org DTD. |
From: Petr T. <Pet...@pi...> - 2002-07-07 15:26:32
|
> Just checking, will I be able to use pre-condition to handle GET and > POST separately. My preferred option is a separate action but if > pre-condition will allow me to choose the action depending on > GET/POST and HTTP/HTTP then that is OK. Action selection based on GET/POST really requires what you have suggested: <action name="Login" type="GET" method="login(String userName, String password)"> because with <pre-condition> it would look like: <action name="Login" method="login(String userName, String password)"> <pre-condition if="$REQUEST.getMethod() == "GET""> <invoke component="Authenticator" method="login(String userName, String password)"/> <on-return value="void" show-template="LoginOK.wm"> </invoke> </pre-condition> <action> which is not too much straightforward :) Ok, two more todo-s for 0.94: [ ] type="GET/POST" attribute for <action> [ ] <type-handler> element nested in <input-variable> of <action> (to allow explicit selection of type handler) -Petr -- >>> http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 <<< |