actionframework-users Mailing List for ActionFramework (Page 6)
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: Mark D. A. <md...@di...> - 2002-10-22 07:45:03
|
petr, where do you stand in getting a new release out? -mda |
From: Petr T. <cz5...@ti...> - 2002-10-18 14:27:35
|
>sorry but the error is still there but the files are uploaded correctly.= >the input files are also still necessary to be filled if you don't want to >get an error. Just to be sure: did you rebuild the .jar - by running: ant clean ant I suppose you did -> please send me a .zip with runnable code so I can re= produce the bug. Thank you. >i think i have found another bug(well, may be it was already discovered)= >its that if you change the file.resource.loader.path to an existing path= , >the final path is concatenated to the project location, that is: >if you have everything in /usr/local/resin/doc/myproject/ and set the pa= th >of the templates to /usr/cvs/templates >the velocity templates will be searched at >/usr/local/resin/doc/myproject/usr/cvs/templates file.resource.loader.path are always relative to servletpath (as noted in= comments in examples/*/Velocity.properties) and there's no way to change it in configuration. Do you need to specify absolute paths? There's no pr= oblem to implement it. Petr [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=3D22957959 ] ___________________________________________________________ http://sms.tiscali.cz ...LOGA a MELODIE na mobil! Nyn=ED NOV=CC i pro mobiln=ED telefony SIEMENS! |
From: Petr T. <cz5...@ti...> - 2002-10-18 14:20:16
|
>What about the rest of the page and template? >What is the best approach to getting the velocity variables $title and $author >rebound from the values previous submitted to the action on the same pag= e? Ah, sorry for my half-answer :) I posted here my current solution previou= sly, which is to put all incoming HTTP parameters into $context - in overriden= handle() method. David had some objections regarding security, but we hav= en't made a final conclusion yet... however, passing parameters around is stil= l scheduled for AS 0.94. Petr [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=3D22957959 ] ___________________________________________________________ http://sms.tiscali.cz ...LOGA a MELODIE na mobil! Nyn=ED NOV=CC i pro mobiln=ED telefony SIEMENS! |
From: Mark D. A. <md...@di...> - 2002-10-17 17:19:41
|
What about the rest of the page and template? What is the best approach to getting the velocity variables $title and $author rebound from the values previous submitted to the action on the same page? -mda |
From: <bm...@ho...> - 2002-10-17 14:31:51
|
sorry but the error is still there but the files are uploaded correctly. the input files are also still necessary to be filled if you don't want to get an error. i think i have found another bug(well, may be it was already discovered) and its that if you change the file.resource.loader.path to an existing path, the final path is concatenated to the project location, that is: if you have everything in /usr/local/resin/doc/myproject/ and set the path of the templates to /usr/cvs/templates the velocity templates will be searched at /usr/local/resin/doc/myproject/usr/cvs/templates byez. ----- Original Message ----- From: "Petr Toman" <Pet...@pi...> To: <act...@li...> Sent: Monday, October 14, 2002 9:36 PM Subject: Re: [Actionframework-users] problem with the arrays > Hi, > I fixed the array-related problem and commited changes to CVS > (http://sourceforge.net/cvs/?group_id=54732). Could you please check it > out and test? > > Before releasing AS 0.93.2c, I would also like to fix another bug you > discovered: stack trace is not present in a logfile with Velocity. I > have spent 3 hours trying to reimplement logger (VelocityNativeLog), but > I still don't have a funtional result (I'm going to ask someone at > velocity-users list if I don't succeed tomorrow). > > Petr > -- > [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Actionframework-users mailing list > Act...@li... > https://lists.sourceforge.net/lists/listinfo/actionframework-users > > |
From: Petr T. <cz5...@ti...> - 2002-10-17 08:27:56
|
>Suppose I have for example a page which allows the user to enter search >criteria on the top of the page, and then displays matching rows to the >(previous) criteria on the rest of the page. You can define a default action for the template, which would by invoked only "if" no parameters are supplied, for example: <template name=3D"results.vm"> <invoke component=3D"Searcher" method=3D"findBooks(String author, String title)" if=3D"!$title"> <input-variable name=3D"author" value=3D"someDefaultValue"/> <input-variable name=3D"title" value=3D"someDefaultValue"/> </invoke> </template> The search form submit would be handled by the <action>, as usually. -Petr [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=3D22957959 ] _________________________________________________________________ Chcete v=ECd=ECt jak=E9 to je m=EDt =B9est jazyk=F9? Zkuste to na http://= slovnik.tiscali.cz |
From: Mark D. A. <md...@di...> - 2002-10-17 06:11:32
|
Suppose I have for example a page which allows the user to enter search criteria on the top of the page, and then displays matching rows to the (previous) criteria on the rest of the page. The AS allows several ways to do this, including: - putting calls inside the template - using output-variable on template - using action on component I'm wondering what some suggestions would be? For example, consider this velocity template: <html><body> <form action="$SERVLET> <input type="hidden" name="action" value="findBooksAction"/> Title: <input type="text" name="title" value="$title"/> Author: <input type="text" name="author" value="$author"/> </form> #set ($matching_books = $Library.findBooks($title, $author)) Matching books with title "$title" and author "$author": <table border="1"> <tr><th>Title</th><th>Author</th><th>Date</th></tr> #foreach ($book in $matching_books) <tr><td>$book.Title</td><td>$book.Author</td><td>$book.Date</td></tr> #end </table> </body></html> The above template isn't really a good idea nor is it complete: - it has both the form action "findBooksAction" and the inline call to the java method "findBooks" (but note that we do want this template to work without having to invoke an action first). - it doesn't deal with defaulting empty string values for title and author - it doesn't deal with arranging for the action parameters to be bound to velocity variables on the next refresh. There aren't any cases matching this in the current AS examples directory. Any suggestions? -mda |
From: Petr T. <Pet...@pi...> - 2002-10-14 19:34:30
|
Hi, I fixed the array-related problem and commited changes to CVS (http://sourceforge.net/cvs/?group_id=54732). Could you please check it out and test? Before releasing AS 0.93.2c, I would also like to fix another bug you discovered: stack trace is not present in a logfile with Velocity. I have spent 3 hours trying to reimplement logger (VelocityNativeLog), but I still don't have a funtional result (I'm going to ask someone at velocity-users list if I don't succeed tomorrow). Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Petr T. <cz5...@ti...> - 2002-10-10 14:07:05
|
>hi again. I have the following templates tags: >but when I call the the url http://127.0.0.1:8080/weather/servlet/Weathe= r >the method getCommunities is called two times... >I'm missing anything? >(there are no actions at the moment for this component) Please post here your log output. I cannot tell you what happened without= more information. Petr [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=3D22957959 ] _________________________________________________________________ Chcete v=ECd=ECt jak=E9 to je m=EDt =B9est jazyk=F9? Zkuste to na http://= slovnik.tiscali.cz |
From: <bm...@ho...> - 2002-10-09 17:57:48
|
hi again. I have the following templates tags: <templates> <template name=3D"comun.vm" is-new-session=3D"true"> <output-variable name=3D"listCommunities" component =3D"Weather" = value=3D"getCommunities()" /> --> </template> </templates> but when I call the the url = http://127.0.0.1:8080/weather/servlet/Weather the method getCommunities = is called two times... I'm missing anything? (there are no actions at the moment for this component) Thx in advance. |
From: Mark D. A. <md...@di...> - 2002-10-08 18:48:28
|
> Btw, why do you need to create chained context? For efficiency reasons. A fixed chained context can be created at the session or application level, and then stuck behind the per-request context. > I've been thinking of a > configurable Context class - this would allow defining common methods for > a webapp. Not sure what examples of this might be? Right now, I'm more concerned with AS making velocity-specific functionality inaccessible, than with AS adding higher-level services. -mda |
From: Petr T. <cz5...@ti...> - 2002-10-08 14:24:00
|
>I've rewritten ActionServlet.processRequest with the attached code. >[...] Good. I will take a look when I get back (next week). Thank you! Petr [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=3D22957959 ] _________________________________________________________________ Chcete v=ECd=ECt jak=E9 to je m=EDt =B9est jazyk=F9? Zkuste to na http://= slovnik.tiscali.cz |
From: Petr T. <cz5...@ti...> - 2002-10-08 14:21:34
|
>how could I have file inputs and array of strings in a form at the same time? >the problem is that if I have the enctype "text/html" I cant upload file= s, >and if I have multipart/form-data I become the java.lang.ArrayIndexOutOf= BoundsException: >-1 < 0 error. >I also tried having the enctype "text/html, multipart/form-data" because= >that it was I used to write while trying to upload files with a servlet.= This seems to be a bug in any case. Could you please include a full stack= trace of the exception? I will deal with this problem at the weekend (or next week). Petr [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=3D22957959 ] _________________________________________________________________ Chcete v=ECd=ECt jak=E9 to je m=EDt =B9est jazyk=F9? Zkuste to na http://= slovnik.tiscali.cz |
From: Petr T. <cz5...@ti...> - 2002-10-08 14:12:54
|
>The VelocityContext object has no setChainedContext method; the only way= >to provide a chained context is in the constructor. >Right now AS hides the call to the constructor of the context, so there is >no way have a chained context. >Maybe a hook method such as createContext() or getChainedContext()? No, currently there's no such a method. If I can remember 1) you can only= access the wrapped context 2) there's a getContext() or createContext() in EngineServlet, but you don't have access to the engine from AS [this will be changed once engine API becomes public]. Btw, why do you need to create chained context? I've been thinking of a configurable Context class - this would allow defining common methods for= a webapp. Petr [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=3D22957959 ] _________________________________________________________________ Chcete v=ECd=ECt jak=E9 to je m=EDt =B9est jazyk=F9? Zkuste to na http://= slovnik.tiscali.cz |
From: Mark D. A. <md...@di...> - 2002-10-08 00:40:07
|
I've rewritten ActionServlet.processRequest with the attached code. This was for a number of reasons: 1. The existing code was incomprehensible :). I think a criteria for version 1.0 is that there are no more labeled breaks in the source code except for "for" loops.... 2. There was no provision for a subclass hook method which is called in between the point of determining what the action is, and actually executing that action. This is the problem that started me down this road: the function handle() is called early, but at that point the action is not known. The invokeMethod() is called later with the action, but at that point it is too late to change the action. 3. The decision of using regex matching was coupled with whether the action name comes from a parameter or from pathinfo. In my new version, I have not capitalized on 2 or 3 yet; I instead attempted to preserve existing semantics. I'm not sure I have done so (see issue 1). -mda -------------------- // possible results of calling analyzeRequest() protected static final int REQ_NO_ACTION = 1; protected static final int REQ_UNASSIGNED_ACTION = 2; protected static final int REQ_REAL_ACTION = 3; protected static final int REQ_ANALYZE_EXCEPTION = 99; protected static class ActionRequestData { int request_type_ = 0; MultipartRequest multipartRequest_ = null; String actionName_ = null; String formName_ = null; HashMap actions_ = null; ParameterRetriever retriever_ = null; boolean isRegexAction_ = false; ActionException exception_ = null; Template template_ = null; Action action_ = null; public ActionRequestData() {} public ActionRequestData(HttpServletRequest request, Context context) { } } protected void handleUpload(HttpServletRequest request, ActionRequestData ard) throws FileUploadException { if (!allowUploads) throw new FileUploadException("File uploads are not allowed"); try { if (uploadDirectory == null) ard.multipartRequest_ = new ServletMultipartRequest(request, maxUploadFileSize); else ard.multipartRequest_ = new ServletMultipartRequest(request, uploadDirectory); // override HttpParameterRetriever ard.retriever_ = new MultipartParameterRetriever(runtime.log, ard.multipartRequest_, UPLOAD_DIR_PROPERTY, uploadDirectory); } catch (IllegalArgumentException e) { throw new FileUploadException("Boundary not found in file upload request", e); } catch (IOException e) { throw new FileUploadException("I/O error ocurred while reading file upload request or file too big", e); } } /** * determine what the action is, or produce a template or exception. */ protected ActionRequestData analyzeRequest(HttpServletRequest request, Context context) { ActionRequestData ard = new ActionRequestData(request, context); // basic setup of parameter retriever ard.retriever_ = new HttpParameterRetriever(runtime.log, request); // maybe handle file upload // TODO: for now the upload is handled here, which is not ideal because // semantically this function just analyzes what it proposes to do later. String contentType = request.getContentType(); if (contentType != null && contentType.startsWith("multipart/form-data")) { try {handleUpload(request, ard);} catch(FileUploadException e) {ard.exception_ = e; ard.request_type_ = REQ_ANALYZE_EXCEPTION; return ard;} Enumeration e = ard.multipartRequest_.getURLParameters("form"); if (e.hasMoreElements()) ard.formName_ = (String) e.nextElement(); ard.actions_ = (HashMap) runtime.forms.get(ard.formName_ == null? "": ard.formName_.trim()); e = ard.multipartRequest_.getURLParameters("action"); if (e.hasMoreElements()) ard.actionName_ = (String) e.nextElement(); } // not a file upload. else { ard.formName_ = request.getParameter("form"); ard.actions_ = (HashMap) runtime.forms.get(ard.formName_ == null? "": ard.formName_.trim()); ard.actionName_ = request.getParameter("action"); runtime.log.debug("action from request parameter: " + ard.actionName_); } // action is not set from request parameter, so try PathInfo. // NOTE: currently we always do regex matching if and only if action name comes from pathinfo. // NOTE: we allow a "form" request parameter to be used even if action came from PathInfo. boolean attempt_match_regexp = false; if (ard.actionName_ == null) { ard.actionName_ = request.getPathInfo(); runtime.log.debug("action from PathInfo: " + ard.actionName_); attempt_match_regexp = true; } // we always trim the action name regardless of where it came from. if (ard.actionName_ != null) ard.actionName_ = ard.actionName_.trim(); // we treat action names of null, "", and "/" all as equivalent (i.e. nothing found), // regardless of where the action name came from. if (ard.actionName_.length() == 0 || ard.actionName_.equals("/")) { runtime.log.debug("ignoring action name specified as '" + ard.actionName_ + "'"); ard.actionName_ = null; } // if action name is not specified, use the "new session" [sic: terrible name]. if (ard.actionName_ == null) { // new session or reload of the default page ard.template_ = newSession(context); if (ard.template_ == null) { ard.request_type_ = REQ_ANALYZE_EXCEPTION; ard.exception_ = new ActionException("No new-session template defined - " + "ActionServlet.newSession() method returns null"); return ard; } ard.request_type_ = REQ_NO_ACTION; return ard; } // else if action name is specified, look up the action, either via regexp // or assuming the exact name has been provided. if (attempt_match_regexp) { ard.action_ = (Action) runtime.regularActions.get(ard.actionName_); ard.isRegexAction_ = true; } else if (ard.actions_ != null) { ard.action_ = (Action) ard.actions_.get(ard.actionName_); } // if no action has been found, call unassignedAction if (ard.action_ == null) { ard.request_type_ = REQ_UNASSIGNED_ACTION; runtime.log.debug("action '" + ard.actionName_ + "' did not match as " + (attempt_match_regexp ? "regular" : "exact")); try {ard.template_ = unassignedAction(context, ard.formName_, ard.actionName_);} catch(ActionException e) { ard.template_ = onException(context, ard.formName_, ard.actionName_, e); ard.request_type_ = REQ_ANALYZE_EXCEPTION; } return ard; } // ok now we have an action // set up parameter retriever if (ard.action_.urlParams != null) { String s = request.getRequestURI().substring(((String) context.get("SERVLET")).length()); String param_string = s.substring(s.indexOf('/', 1)); // insert URLParameterRetriever between ContextParameterRetriever and HTTP/multipart retreiver ard.retriever_ = new ChainParameterRetriever( new URLParameterRetriever(runtime.log, ard.action_.urlParams, param_string), ard.retriever_); } // set InputVariableParameterRetriever as last retriever - if this action has any <input-variable>s if (ard.action_.inputVariables != null) ard.retriever_ = new InputVariableParameterRetriever(runtime.log, ard.action_.inputVariables, ard.retriever_); ard.request_type_ = REQ_REAL_ACTION; return ard; } /** * Called from {@link #handle(HttpServletRequest,HttpServletResponse,Context) handle()} method. */ private ActionReturnData processRequest(HttpServletRequest request, Context context) { ActionRequestData ard = analyzeRequest(request, context); Action action = ard.action_; String actionName = ard.actionName_; String formName = ard.formName_; ParameterRetriever retriever = ard.retriever_; Template error_template = null; ActionException e = null; try { if (ard.exception_ != null) e = ard.exception_; else { // TODO: ideally upload handling would be here, but right now, // it has already been done by analyzeRequest(). // if (ard.multipartRequest_ != null) handleUpload(request, ard); if (ard.template_ != null) { return evalOutputVars(ard.template_, ard.retriever_, context); } if (action == null) throw new Error("i should have template or action set"); // get component for action Object component = null; if (action.componentData.persistence != ComponentData.PERSISTENCE_STATIC) component = getComponent(action.componentData.componentName, true, null); try { return action.invoke(formName, actionName, context, ard.retriever_, component, false); } finally { // add component with "request" persistence to 'lastComponents' if (action.componentData.persistence == ComponentData.PERSISTENCE_REQUEST && component instanceof Destroyed) { runtime.putNewLastComponent(request.getSession(true).getId(), action.componentData.componentName, component); } } // unreachable } } catch (ConversionException ce) { runtime.log.error("[" + context.hashCode() + "] " + "in processRequest", ce); // ConverstionException is not an ActionException // this likely won't be used since we are getting an error_template. e = new ActionException("ConversionException", ce); try { error_template = conversionError(context, formName, actionName, ce); } catch(Exception ex) { e = new ActionException("conversionError", ex); } } catch (InstantiatorException ie) { runtime.log.error("[" + context.hashCode() + "] " + "in processRequest", ie); e = new ActionException("Instantiation error", ie); } catch (ActionException ae) { runtime.log.error("[" + context.hashCode() + "] " + "in processRequest", ae); e = ae; } catch (Exception ex) { runtime.log.error("[" + context.hashCode() + "] " + "in processRequest", ex); e = new ActionException("Unexpected exception", ex); } // at this point either e or error_template is not null. // note that with this logic, it is possible to get two calls to onException. // get an error template if we don't have one if (error_template == null) { if (e == null) throw new Error("shouldn't be here without an exception"); try {error_template = onException(context, formName, actionName, e);} catch (Exception ex) { runtime.log.error("[" + context.hashCode() + "] " + "Exception thrown in '" + getClass().getName() + ".onException()'", ex); return new ActionReturnData(error(context, ex.getMessage()), null, null); } } // get ActionReturnData for error template try { return evalOutputVars(error_template, retriever, context); } catch (ActionException ex) { runtime.log.error("[" + context.hashCode() + "] " + "Exception after invoking '" + getClass().getName() + ".onException()'", ex); return new ActionReturnData(error_template, null, null); } catch (ConversionException ex) { runtime.log.error("[" + context.hashCode() + "] " + "Conversion error while handling <invoke> elements of template '" + error_template.getName() + "'", ex); return new ActionReturnData(error_template, null, null); } } |
From: <bm...@ho...> - 2002-10-07 17:26:55
|
now I have another problem: how could I have file inputs and array of strings in a form at the same = time? the problem is that if I have the enctype "text/html" I cant upload = files, and if I have multipart/form-data I become the = java.lang.ArrayIndexOutOfBoundsException: -1 < 0 error. I also tried having the enctype "text/html, multipart/form-data" because = that it was I used to write while trying to upload files with a servlet. Thx in advance. ----- Original Message -----=20 From: Borja Mart=EDn=20 To: act...@li...=20 Sent: Monday, October 07, 2002 5:56 PM Subject: Re: [Actionframework-users] problem with the arrays the problem was that I was using an enctype in the form tag. ----- Original Message -----=20 From: Borja Mart=EDn=20 To: act...@li...=20 Sent: Monday, October 07, 2002 4:56 PM Subject: [Actionframework-users] problem with the arrays hi. While trying to receive an array of Strings I become the = following errror: Conversion error occurred when handling action '/grabarGaleria' = (field: 'txtimg'): org.actionframework.ConversionException: Unexpected = exception; nested exception is: = java.lang.ArrayIndexOutOfBoundsException: -1 < 0 the action node at the config xml file looks so: <action name =3D "/grabarGaleria" method =3D "grabarGaleria(int = idGaleria, String publicacion, String seccion, String idVisor, String[] = txtimg)"> <on-return value =3D "void" show-url =3D "url"> <output-variable name =3D "url" value =3D = "editarGaleria?idGaleria=3D$idGaleria&publicacion=3D$publicacion&= seccion=3D$seccion&idVisor=3D$idVisor" /> </on-return> </action> and the java method: public void grabarGaleria(int idGaleria, String publicacion, String = seccion, String idVisor, String[] txtimg){ // anything to do by the moment } in the velocity template I have 3 textfields called 'txtimg' (the = number of the textfields should change but I have put a fix number just = in order to test it) Thx in advance |
From: <bm...@ho...> - 2002-10-07 15:57:17
|
the problem was that I was using an enctype in the form tag. ----- Original Message -----=20 From: Borja Mart=EDn=20 To: act...@li...=20 Sent: Monday, October 07, 2002 4:56 PM Subject: [Actionframework-users] problem with the arrays hi. While trying to receive an array of Strings I become the following = errror: Conversion error occurred when handling action '/grabarGaleria' = (field: 'txtimg'): org.actionframework.ConversionException: Unexpected = exception; nested exception is: = java.lang.ArrayIndexOutOfBoundsException: -1 < 0 the action node at the config xml file looks so: <action name =3D "/grabarGaleria" method =3D "grabarGaleria(int = idGaleria, String publicacion, String seccion, String idVisor, String[] = txtimg)"> <on-return value =3D "void" show-url =3D "url"> <output-variable name =3D "url" value =3D = "editarGaleria?idGaleria=3D$idGaleria&publicacion=3D$publicacion&= seccion=3D$seccion&idVisor=3D$idVisor" /> </on-return> </action> and the java method: public void grabarGaleria(int idGaleria, String publicacion, String = seccion, String idVisor, String[] txtimg){ // anything to do by the moment } in the velocity template I have 3 textfields called 'txtimg' (the = number of the textfields should change but I have put a fix number just = in order to test it) Thx in advance |
From: <bm...@ho...> - 2002-10-07 14:57:22
|
hi. While trying to receive an array of Strings I become the following = errror: Conversion error occurred when handling action '/grabarGaleria' (field: = 'txtimg'): org.actionframework.ConversionException: Unexpected = exception; nested exception is: = java.lang.ArrayIndexOutOfBoundsException: -1 < 0 the action node at the config xml file looks so: <action name =3D "/grabarGaleria" method =3D "grabarGaleria(int = idGaleria, String publicacion, String seccion, String idVisor, String[] = txtimg)"> <on-return value =3D "void" show-url =3D "url"> <output-variable name =3D "url" value =3D = "editarGaleria?idGaleria=3D$idGaleria&publicacion=3D$publicacion&= seccion=3D$seccion&idVisor=3D$idVisor" /> </on-return> </action> and the java method: public void grabarGaleria(int idGaleria, String publicacion, String = seccion, String idVisor, String[] txtimg){ // anything to do by the moment } in the velocity template I have 3 textfields called 'txtimg' (the number = of the textfields should change but I have put a fix number just in = order to test it) Thx in advance |
From: Mark D. A. <md...@di...> - 2002-10-06 17:29:37
|
The VelocityContext object has no setChainedContext method; the only way to provide a chained context is in the constructor. Right now AS hides the call to the constructor of the context, so there is no way have a chained context. Maybe a hook method such as createContext() or getChainedContext()? -mda |
From: Mark D. A. <md...@di...> - 2002-10-06 17:22:53
|
> - what does it mean a "successful request"? You can get various errors - > <on-exception>/onException(), conversionError(), errors in error > handling code, ... Well, my definition is that the try clause in org.apache.velocity.servlet.doRequest catches no exceptions :). > > - Velocity.requestCleanup() is not called if handleRequest() returns > null (when output not a template = generated directly by AS) Presumably this can only happen if I myself return null from my overriding handle() method in my servlet does so. In that case, I won't have started a transaction. But it is a good thing to document. > - commit/rollback your transactions in the overrided invokeMethod() or > afterInvoke() method As I pointed out, this doesn't help, as these still get done before velocity mergeTemplate. > - set some kind of "ok" flag in overrided error() [this could be also > one solution for AS, but things get complicated if this method is > overridden] Yes, this is my current plan once error() from velocity is exposed from AS. > - VelocityInOutVar uses servlet's RuntimeInstance (for the case > Velocity does not fix this in 1.4 and it had to be done by AS - ok?) great. -mda |
From: Petr T. <Pet...@pi...> - 2002-10-06 15:02:07
|
>> ActionServlet.error(Context, String, Throwable) would be called is >> suitable [plus adding this method to AS as you suggested]. > > I'm in dire need for this change, because my servlet won't function > properly without it: it can't properly decide upon commit vs. > rollback of my per-request transaction. As I mentioned, > ActionServlet.cleanupRequest() is of no use because it is in a > finally clause and always gets run. Velocity's requestCleanup() is > more useful for doing a transaction commit(), but it is hidden from > me by AS. > > If AS exposes everything sent to Velocity's error(), then I can > probably trust it is safe to do a commit. In addition, AS might > override Velocity's requestCleanup and expose that in its servlet, > perhaps under the name "requestSuccessful" or "noException" or > something. I agree that such a method would be useful, but I see these problems: - what does it mean a "successful request"? You can get various errors - <on-exception>/onException(), conversionError(), errors in error handling code, ... - Velocity.requestCleanup() is not called if handleRequest() returns null (when output not a template = generated directly by AS) - WebMacro does not have such a method (not counting other template engines - to be supported in the future) Suggested solutions (to be discussed, of course): - commit/rollback your transactions in the overrided invokeMethod() or afterInvoke() method - set some kind of "ok" flag in overrided error() [this could be also one solution for AS, but things get complicated if this method is overridden] > Will you be releasing a version with the error() override in the next > week or so, or should I go ahead and write a patch of my own? I've commited AS to CVS - announced changes plus these: - Throwable is now catched instead of Exception in many places - template path with comma-separated values is relativized for Vel. - VelocityInOutVar uses servlet's RuntimeInstance (for the case Velocity does not fix this in 1.4 and it had to be done by AS - ok?) I'll be away next week, but I hope to stay on e-mail, though. Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Mark D. A. <md...@di...> - 2002-10-05 20:52:06
|
> I think that overriding error() in VelocityServlet where > ActionServlet.error(Context, String, Throwable) would be called is > suitable [plus adding this method to AS as you suggested]. I'm in dire need for this change, because my servlet won't function properly without it: it can't properly decide upon commit vs. rollback of my per-request transaction. As I mentioned, ActionServlet.cleanupRequest() is of no use because it is in a finally clause and always gets run. Velocity's requestCleanup() is more useful for doing a transaction commit(), but it is hidden from me by AS. If AS exposes everything sent to Velocity's error(), then I can probably trust it is safe to do a commit. In addition, AS might override Velocity's requestCleanup and expose that in its servlet, perhaps under the name "requestSuccessful" or "noException" or something. Will you be releasing a version with the error() override in the next week or so, or should I go ahead and write a patch of my own? -mda |
From: Mark D. A. <md...@di...> - 2002-10-05 20:52:06
|
Sorry, I just now read the thread on velocity-user list ("Initializing multiple VelocityServlets"). It is not obvious to me that Geir was actually promising to take Will Glass-Husain's patch. In any event, this issue is not bothering me near so much as the exception handling issue (separate thread). > - WebMacro/VelocityInOutVariable is going to be replaced by AS' own > implementation independent on template engine - for AS 0.96 Ok > - multiple webapps using Velocity can co-exist if velocity-*.jars are > included in WEB-INF\lib folder Not always. As you probably know, the J2EE classpath rules have been evolving between servlet 2.2 and 2.3, and in any event, different J2EE containers are buggy in this area. If there is no velocity at all in the container's classpath, but only the webapps, things might work, but i can't do it that way for other reasons. > - using RuntimeInstance, VelocityEngine etc. would stop AS working > with Velocity 1.1 (Method.invoke() may solve this problem) Yes, aren't we all glad that there is no #ifdef in java :). Regardless, I'm ok with waiting on this issue. -mda |
From: Petr T. <Pet...@pi...> - 2002-10-05 10:23:58
|
> If you look at doRequest() in > org/apache/velocity/servlet/VelocityServlet.java, you'll see that > handleRequest() is what calls into the actionservlet stuff. After > that returns, *then* it calls mergeTemplate, and any exceptions there > are missed by actionservlet. > > If actionservlet had an override for error() in > org/apache/velocity/servlet/VelocityServlet.java, things would be > better, but right now a lot is missed. Sorry, now I get to the point: exceptions from mergeTemplate() cannot be handled by AS. I think that overriding error() in VelocityServlet where ActionServlet.error(Context, String, Throwable) would be called is suitable [plus adding this method to AS as you suggested]. Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |
From: Petr T. <Pet...@pi...> - 2002-10-05 10:23:58
|
>> It seems that Geir is going to fix the problem for Velocity 1.4, so >> if you can live with that your .war-s include velocity-*.jar in >> WEB-INF\lib folder, I would let this up to Velocity. > > How is Geir going to fix a problem due to a static variable in > actionservlet source code? I don't see what can be done on the > velocity side about the fact that > org/actionframework/engines/velocity/VelocityInOutVariable.java has a > static variable that instead should reflect per webapp (and per > velocity configuration) state. If org.apache.velocity.servlet.VelocityServlet code changes (as W.Glass-Husain suggested on velocity-user list), then AS' template engine servlet would be initialized properly and the static RuntimeInstance in VelocityInOutVariable no problem. Am I right? > What has to happen IMHO is for VelocityInOutVariable stop using any > static variables, but use one of its constructor arguments for > gaining access to velocity functionality. I just don't want to make unnecessary changes... - WebMacro/VelocityInOutVariable is going to be replaced by AS' own implementation independent on template engine - for AS 0.96 - multiple webapps using Velocity can co-exist if velocity-*.jars are included in WEB-INF\lib folder - using RuntimeInstance, VelocityEngine etc. would stop AS working with Velocity 1.1 (Method.invoke() may solve this problem) Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |