From velocity-user-returnstephanie60@example.com Sat Dec 01 17:03:47 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 8059 invoked from network); 1 Dec 2001 17:03:47 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 1 Dec 2001 17:03:47 -0000 Received: (qmail 14974 invoked by uid 97); 1 Dec 2001 17:03:47 -0000 Delivered-To: stephanie60@example.com Received: (qmail 14924 invoked by uid 97); 1 Dec 2001 17:03:46 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 14898 invoked from network); 1 Dec 2001 17:03:45 -0000 Message-ID: <stephanie60@example.com> Date: Sat, 01 Dec 2001 12:03:16 -0500 From: Ted Husted <stephanie60@example.com> Organization: Apache Software Foundation / Jakarta X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: stephanie60@example.com Subject: RE: Velocity & Struts - redux Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N There is really only one object that the Struts framework puts into a servlet context that would be a must-have for the VelocityContext, the ActionForm bean. There are other objects there, that could be used by the VelServlet itself to create macros, but these would not need to be part of the template writer's context. The name of the ActionForm bean is encapsulated in the mapping passed in the request. The mapping is stored under a static given by Action.MAPPING_KEY. Once retrieved, you can can get the attribute name (mapping.getAttribute()) for the name of the current form bean, and pass that object to the VelocityContext. There are other framework objects, like the MessageResources, but those wouldn't be used by a Velocity developer directly, but through (I guess) a macro. Likewise for the mappings. A macro might want to lookup the URI for a logical forward, and use that to write a hyperlink tag, but that is not something you would expect in a VelocityContext (as I understand it). Now, the Struts developers may be passing other objects in the request, and there lies the rub. But, if you want to require that the Struts developers using VelServlet pass everything they need as part of the form bean, then you're done ;-) Though, in practice, the ActionForm is only used for input forms. Most pages can be rendered whatever JavaBeans the developer finds convenient. It would be very keen if Velocity Templates could be drop-in replacements for JSPs and other display mechanisms that rely on the standard contexts. So, the question might be, how do we transparently expose the standard servlet contexts to a Velocity template writer, without binding the core of Velocity to servlets. A strategy that JSP uses, and the Struts tag extensions follow, is to search the contexts from nearest to farthest (unless told otherwise). Could a subclass of the VelocityContext be constructed that would first search its native context, then the servlet request context, then the session context, and finally the application context, returning the instance first found? If so, then you might be able to simply pass to a ServletVelocityContext the instant request context, and let it encapsulate which context (Velocity, request, session, or application) actually returns the property. I apologize for ommitting Geir's original example application from my resource page. Pure oversight on my part. (Must have been a busy news week;-) I've got it up now, and will commit the link to the Struts resource page in due course. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel (434)979-5350 -- http://www.husted.com/struts/ -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sat Dec 01 18:56:00 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 39393 invoked from network); 1 Dec 2001 18:55:59 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 1 Dec 2001 18:55:59 -0000 Received: (qmail 16747 invoked by uid 97); 1 Dec 2001 18:56:00 -0000 Delivered-To: stephanie60@example.com Received: (qmail 16708 invoked by uid 97); 1 Dec 2001 18:55:59 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 16694 invoked from network); 1 Dec 2001 18:55:58 -0000 Reply-To: <stephanie60@example.com> From: "Paulo Gaspar" <stephanie60@example.com> To: "Velocity Users List" <stephanie60@example.com> Subject: RE: Velocity & Struts - redux Date: Sat, 1 Dec 2001 20:10:58 +0100 Message-ID: <stephanie60@example.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <stephanie60@example.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N > Now, the Struts developers may be passing other objects in the request, > and there lies the rub. But, if you want to require that the Struts > developers using VelServlet pass everything they need as part of the > form bean, then you're done ;-) I talked about passing a facade to whatever is the object behind the form tag from Struts. Which mechanism builds such facade and passes it to the Velocity context is something to find out. I just do NOT understand why Velocity has to change. (Would it be good to make Velocity more JSP-like? Argh! Even the JSP guys are starting to want using Velocity!) Anyway, I think the mechanism you suggest is the direction to go: let an intermediate object do the job. Convenience facades as the above mentioned wrap and replace the original object as part of the discovery process you describe. A map from JSP-object-clas => Facade-class or Facade-factory-class would make the thing flexible and extensible. Have fun, Paulo Gaspar http://www.krankikom.de http://www.ruhronline.de > -----Original Message----- > From: Ted Husted [mailto:stephanie60@example.com] > Sent: Saturday, December 01, 2001 6:03 PM > To: stephanie60@example.com > Subject: RE: Velocity & Struts - redux > > > There is really only one object that the Struts framework puts into a > servlet context that would be a must-have for the VelocityContext, the > ActionForm bean. > > There are other objects there, that could be used by the VelServlet > itself to create macros, but these would not need to be part of the > template writer's context. > > The name of the ActionForm bean is encapsulated in the mapping passed in > the request. The mapping is stored under a static given by > Action.MAPPING_KEY. Once retrieved, you can can get the attribute name > (mapping.getAttribute()) for the name of the current form bean, and pass > that object to the VelocityContext. > > There are other framework objects, like the MessageResources, but those > wouldn't be used by a Velocity developer directly, but through (I guess) > a macro. Likewise for the mappings. A macro might want to lookup the URI > for a logical forward, and use that to write a hyperlink tag, but that > is not something you would expect in a VelocityContext (as I understand > it). > > Now, the Struts developers may be passing other objects in the request, > and there lies the rub. But, if you want to require that the Struts > developers using VelServlet pass everything they need as part of the > form bean, then you're done ;-) > > Though, in practice, the ActionForm is only used for input forms. Most > pages can be rendered whatever JavaBeans the developer finds convenient. > > It would be very keen if Velocity Templates could be drop-in > replacements for JSPs and other display mechanisms that rely on the > standard contexts. So, the question might be, how do we transparently > expose the standard servlet contexts to a Velocity template writer, > without binding the core of Velocity to servlets. > > A strategy that JSP uses, and the Struts tag extensions follow, is to > search the contexts from nearest to farthest (unless told otherwise). > Could a subclass of the VelocityContext be constructed that would first > search its native context, then the servlet request context, then the > session context, and finally the application context, returning the > instance first found? > > If so, then you might be able to simply pass to a ServletVelocityContext > the instant request context, and let it encapsulate which context > (Velocity, request, session, or application) actually returns the > property. > > I apologize for ommitting Geir's original example application from my > resource page. Pure oversight on my part. (Must have been a busy news > week;-) I've got it up now, and will commit the link to the Struts > resource page in due course. > > -- Ted Husted, Husted dot Com, Fairport NY USA. > -- Custom Software ~ Technical Services. > -- Tel (434)979-5350 > -- http://www.husted.com/struts/ > > -- > To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sat Dec 01 19:27:30 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 47394 invoked from network); 1 Dec 2001 19:27:30 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 1 Dec 2001 19:27:30 -0000 Received: (qmail 24098 invoked by uid 97); 1 Dec 2001 19:27:31 -0000 Delivered-To: stephanie60@example.com Received: (qmail 24082 invoked by uid 97); 1 Dec 2001 19:27:31 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 24071 invoked from network); 1 Dec 2001 19:27:30 -0000 Message-ID: <stephanie60@example.com> Date: Sat, 01 Dec 2001 14:27:09 -0500 From: Ted Husted <stephanie60@example.com> Organization: Apache Software Foundation / Jakarta X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Velocity Users List <stephanie60@example.com> Subject: Re: Velocity & Struts - redux References: <stephanie60@example.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hey, I see that Velocity already supports chained contexts. So could a session facade be chained to a request facade chained to a base Velocity context? Then neither Struts (or another system using the session and request contexts) nor Velocity would need to change, and everyone could just do what they do best. Paulo Gaspar wrote: > > > Now, the Struts developers may be passing other objects in the request, > > and there lies the rub. But, if you want to require that the Struts > > developers using VelServlet pass everything they need as part of the > > form bean, then you're done ;-) > > I talked about passing a facade to whatever is the object behind the form > tag from Struts. > > Which mechanism builds such facade and passes it to the Velocity context > is something to find out. I just do NOT understand why Velocity has to > change. > > (Would it be good to make Velocity more JSP-like? Argh! Even the JSP guys > are starting to want using Velocity!) > > Anyway, I think the mechanism you suggest is the direction to go: let an > intermediate object do the job. Convenience facades as the above > mentioned wrap and replace the original object as part of the discovery > process you describe. > > A map from JSP-object-clas => Facade-class or Facade-factory-class would > make the thing flexible and extensible. > > Have fun, > Paulo Gaspar -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sat Dec 01 22:08:50 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 83153 invoked from network); 1 Dec 2001 22:08:50 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 1 Dec 2001 22:08:50 -0000 Received: (qmail 25962 invoked by uid 97); 1 Dec 2001 22:08:53 -0000 Delivered-To: stephanie60@example.com Received: (qmail 25946 invoked by uid 97); 1 Dec 2001 22:08:52 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 25935 invoked from network); 1 Dec 2001 22:08:52 -0000 Reply-To: <stephanie60@example.com> From: "Paulo Gaspar" <stephanie60@example.com> To: "Velocity Users List" <stephanie60@example.com> Subject: RE: Velocity & Struts - redux Date: Sat, 1 Dec 2001 23:23:52 +0100 Message-ID: <stephanie60@example.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <stephanie60@example.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I do not remember enough from JSP (I was converted very soon) but, again, it sounds like you might be pointing in the right direction. Maybe Geir knows better. He was fighting with the taglib stuff more recently. Have fun, Paulo Gaspar > -----Original Message----- > From: Ted Husted [mailto:stephanie60@example.com] > Sent: Saturday, December 01, 2001 8:27 PM > > Hey, I see that Velocity already supports chained contexts. > > So could a session facade be chained to a request facade chained to a > base Velocity context? > > Then neither Struts (or another system using the session and request > contexts) nor Velocity would need to change, and everyone could just do > what they do best. > -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 12:59:18 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 81524 invoked from network); 2 Dec 2001 12:59:18 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 12:59:18 -0000 Received: (qmail 7225 invoked by uid 97); 2 Dec 2001 12:59:13 -0000 Delivered-To: stephanie60@example.com Received: (qmail 7215 invoked by uid 97); 2 Dec 2001 12:59:11 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 12825 invoked from network); 2 Dec 2001 06:41:58 -0000 Message-Id: <stephanie60@example.com> Content-Type: text/plain; charset="iso-8859-1" From: Peter Donald <stephanie60@example.com> To: stephanie60@example.com Subject: Magic execute adaptor ? Date: Sun, 2 Dec 2001 17:39:00 +1100 X-Mailer: KMail [version 1.3.2] X-Wisdom-Cookie: . MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi, Today I just noticed that you could implement a get(String name) method an object and access to properties would be routed through that. Unfrotunately I had already done a bunch of work to wrap some objects but now that I know about get() I am rewriting them to use get. Question: Is this documented anywhere ? I didn't notice any documentation and some doco would have saved me a bunch of work ... though it could be Ijust missed it ;) However the real question for this mail is - is there an equivelent for method calls. For instance I wouldn't mind it at all if you could do something like public Object execute( String name, Object[] params ) {} and rout method calls in a similar way. So am I in luck ? ;) BTW I am using this to adapt JMX objects so that I can use them like normal beans in the page. Has anyone done something similar to this? Or any other sort of management app written using Velocity for the view ? -- Cheers, Pete ------------------------------------------------------ Mark Twain: "In the real world, the right thing never happens in the right place at the right time. It is the task of journalists and historians to rectify this error." ------------------------------------------------------ -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 12:59:38 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 81583 invoked from network); 2 Dec 2001 12:59:38 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 12:59:38 -0000 Received: (qmail 7726 invoked by uid 97); 2 Dec 2001 12:59:32 -0000 Delivered-To: stephanie60@example.com Received: (qmail 7716 invoked by uid 97); 2 Dec 2001 12:59:32 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 13089 invoked from network); 2 Dec 2001 06:44:12 -0000 Message-Id: <stephanie60@example.com> Content-Type: text/plain; charset="iso-8859-1" From: Peter Donald <stephanie60@example.com> To: stephanie60@example.com Subject: Struts integration? Date: Sun, 2 Dec 2001 17:41:13 +1100 X-Mailer: KMail [version 1.3.2] X-Wisdom-Cookie: . MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hiya, I am using Struts for my cotroller portion and all is well. The one thing that is painful is that Velocity doesn't have the kinda of inbuilt support that JSP does because for all the tags that they have written (I am specifically thinking about "form" integration). Has anyone else done this integration before ? If so any tips or macros you want to share ? ;) -- Cheers, Pete *------------------------------------------------------* | "Computers are useless. They can only give you | | answers." - Pablo Picasso | *------------------------------------------------------* -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 12:59:48 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 81644 invoked from network); 2 Dec 2001 12:59:47 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 12:59:47 -0000 Received: (qmail 8227 invoked by uid 97); 2 Dec 2001 12:59:41 -0000 Delivered-To: stephanie60@example.com Received: (qmail 8217 invoked by uid 97); 2 Dec 2001 12:59:41 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 14558 invoked from network); 2 Dec 2001 07:05:12 -0000 Message-Id: <stephanie60@example.com> Content-Type: text/plain; charset="utf-8" From: Peter Donald <stephanie60@example.com> To: stephanie60@example.com Subject: Re: Magic execute adaptor ? Date: Sun, 2 Dec 2001 18:02:07 +1100 X-Mailer: KMail [version 1.3.2] X-Wisdom-Cookie: . MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi, Okay from my scanning of the code the answer is no. However I really can't understand the flow of the code and which is autogenerated and what is hand maintained. From the looks of things I would need to modify ASTMethod.doIntrospection(): 136 to check for this execute() method if there is no other methods matched. Am I correct ? If so do I modify this file or is there some file that this is generated from or some other wierdness ? On Sun, 2 Dec 2001 17:39, Peter Donald wrote: > Hi, > > Today I just noticed that you could implement a get(String name) method an > object and access to properties would be routed through that. Unfrotunately > I had already done a bunch of work to wrap some objects but now that I know > about get() I am rewriting them to use get. > > Question: Is this documented anywhere ? I didn't notice any documentation > and some doco would have saved me a bunch of work ... though it could be > Ijust missed it ;) > > However the real question for this mail is - is there an equivelent for > method calls. For instance I wouldn't mind it at all if you could do > something like > > public Object execute( String name, Object[] params ) {} > > and rout method calls in a similar way. So am I in luck ? ;) > > BTW I am using this to adapt JMX objects so that I can use them like normal > beans in the page. Has anyone done something similar to this? Or any other > sort of management app written using Velocity for the view ? -- Cheers, Pete *-----------------------------------------------------* * "Faced with the choice between changing one's mind, * * and proving that there is no need to do so - almost * * everyone gets busy on the proof." * * - John Kenneth Galbraith * *-----------------------------------------------------* -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 13:05:29 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 83455 invoked from network); 2 Dec 2001 13:05:29 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 13:05:29 -0000 Received: (qmail 9399 invoked by uid 97); 2 Dec 2001 13:05:26 -0000 Delivered-To: stephanie60@example.com Received: (qmail 9383 invoked by uid 97); 2 Dec 2001 13:05:26 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 9372 invoked from network); 2 Dec 2001 13:05:26 -0000 Date: Sun, 02 Dec 2001 08:05:13 -0500 From: "Geir Magnusson Jr." <stephanie60@example.com> Subject: Re: Magic execute adaptor ? In-reply-to: <stephanie60@example.com> To: stephanie60@example.com Message-id: <stephanie60@example.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/83.161.120.1559 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 12/2/01 1:39 AM, "Peter Donald" <stephanie60@example.com> wrote: > Hi, > > Today I just noticed that you could implement a get(String name) method an > object and access to properties would be routed through that. Unfrotunately I > had already done a bunch of work to wrap some objects but now that I know > about get() I am rewriting them to use get. > > Question: Is this documented anywhere ? I didn't notice any documentation and > some doco would have saved me a bunch of work ... though it could be Ijust > missed it ;) > It may be in the user or VTL doc. I am meaning to update it as it will search out 'isFoo()' as well now. > However the real question for this mail is - is there an equivelent for > method calls. For instance I wouldn't mind it at all if you could do > something like > > public Object execute( String name, Object[] params ) {} > > and rout method calls in a similar way. So am I in luck ? ;) How do you mean? You could always call $foo.execute("woogie", $array ) note that Velocity can create ArrayList objects in VTL : #set( $arr = [ $foo, $bar, $woogie, 1] ) So you might want to do something like public Object execute( String, List ) If you want to use the VTL ArrayObject creation > > BTW I am using this to adapt JMX objects so that I can use them like normal > beans in the page. Has anyone done something similar to this? Or any other > sort of management app written using Velocity for the view ? Look at Xadra in the powered-by page - its some kind of JMX management console product (not free...) -- Geir Magnusson Jr. stephanie60@example.com System and Software Consulting Be a giant. Take giant steps. Do giant things... -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 13:07:49 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 86056 invoked from network); 2 Dec 2001 13:07:49 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 13:07:49 -0000 Received: (qmail 10312 invoked by uid 97); 2 Dec 2001 13:07:46 -0000 Delivered-To: stephanie60@example.com Received: (qmail 10296 invoked by uid 97); 2 Dec 2001 13:07:46 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 10285 invoked from network); 2 Dec 2001 13:07:45 -0000 Date: Sun, 02 Dec 2001 08:07:38 -0500 From: "Geir Magnusson Jr." <stephanie60@example.com> Subject: Re: Struts integration? In-reply-to: <stephanie60@example.com> To: stephanie60@example.com Message-id: <stephanie60@example.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/83.161.120.1559 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 12/2/01 1:41 AM, "Peter Donald" <stephanie60@example.com> wrote: > Hiya, > > I am using Struts for my cotroller portion and all is well. The one thing > that is painful is that Velocity doesn't have the kinda of inbuilt support > that JSP does because for all the tags that they have written (I am > specifically thinking about "form" integration). You need a tag to do <html> ? :) There is an ongoing thread regarding this subject... We are trying to do what we can to support Struts users, although as it's so JSP oriented WRT some of the tools, we are working out how to do it. > > Has anyone else done this integration before ? If so any tips or macros you > want to share ? ;) I did it once, a long time ago as a toy project to show it could be done. Of course, it didn't get those tools that allow you to do <html> W/o typing '<html>' :) -- Geir Magnusson Jr. stephanie60@example.com System and Software Consulting "He who throws mud only loses ground." - Fat Albert -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 13:10:35 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 86690 invoked from network); 2 Dec 2001 13:10:35 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 13:10:35 -0000 Received: (qmail 10940 invoked by uid 97); 2 Dec 2001 13:10:32 -0000 Delivered-To: stephanie60@example.com Received: (qmail 10924 invoked by uid 97); 2 Dec 2001 13:10:32 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 10913 invoked from network); 2 Dec 2001 13:10:31 -0000 Date: Sun, 02 Dec 2001 08:10:19 -0500 From: "Geir Magnusson Jr." <stephanie60@example.com> Subject: Re: Magic execute adaptor ? In-reply-to: <stephanie60@example.com> To: stephanie60@example.com Message-id: <stephanie60@example.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/83.161.120.1559 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 12/2/01 2:02 AM, "Peter Donald" <stephanie60@example.com> wrote: > Hi, > > Okay from my scanning of the code the answer is no. However I really can't > understand the flow of the code and which is autogenerated and what is hand > maintained. From the looks of things I would need to modify > > ASTMethod.doIntrospection(): 136 It's all hand maintained. There is no real functional autogenerated code. > > to check for this execute() method if there is no other methods matched. Am I > correct ? If so do I modify this file or is there some file that this is > generated from or some other wierdness ? That depends on what you are doing - what are you putting in the template? If you want $foo To magically call your execute( String Object[] ) method, just overrride toString() in your object to do that.... public String toString() { return thingy.execute( stringy, array ); } > > On Sun, 2 Dec 2001 17:39, Peter Donald wrote: >> Hi, >> >> Today I just noticed that you could implement a get(String name) method an >> object and access to properties would be routed through that. Unfrotunately >> I had already done a bunch of work to wrap some objects but now that I know >> about get() I am rewriting them to use get. >> >> Question: Is this documented anywhere ? I didn't notice any documentation >> and some doco would have saved me a bunch of work ... though it could be >> Ijust missed it ;) >> >> However the real question for this mail is - is there an equivelent for >> method calls. For instance I wouldn't mind it at all if you could do >> something like >> >> public Object execute( String name, Object[] params ) {} >> >> and rout method calls in a similar way. So am I in luck ? ;) >> >> BTW I am using this to adapt JMX objects so that I can use them like normal >> beans in the page. Has anyone done something similar to this? Or any other >> sort of management app written using Velocity for the view ? -- Geir Magnusson Jr. stephanie60@example.com System and Software Consulting "Whoever would overthrow the liberty of a nation must begin by subduing the freeness of speech." - Benjamin Franklin -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 13:13:15 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 87277 invoked from network); 2 Dec 2001 13:13:15 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 13:13:15 -0000 Received: (qmail 12144 invoked by uid 97); 2 Dec 2001 13:13:12 -0000 Delivered-To: stephanie60@example.com Received: (qmail 12128 invoked by uid 97); 2 Dec 2001 13:13:12 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 12117 invoked from network); 2 Dec 2001 13:13:11 -0000 Message-ID: <stephanie60@example.com> Date: Sun, 02 Dec 2001 08:12:52 -0500 From: Ted Husted <stephanie60@example.com> Organization: Apache Software Foundation / Jakarta X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Velocity Users List <stephanie60@example.com> Subject: Re: Struts integration? References: <stephanie60@example.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Geir started something here http://jakarta.apache.org/builds/jakarta-velocity/contrib/struts/ and there's been some new discussion recently. http://www.mail-archive.com/velocity-user%40jakarta.apache.org/msg03970.html I posted a follow up yesterday, but it hasn't made the archive yet. (Wither eyebrowse ...) I was suggesting that VelServlet use a facade over the standard requeset, session, and application contexts, to make them appear to be VelocityContexts, and then chain them together, so that a requirst for $foo goes first to the VelocityContext, then to the request facade, and then to the sesssion and application. First one found wins. This would mimic the default JSP and Struts tag extension behaviour. OT, but have you been using the Excalibur DataSources package with Struts? Peter Donald wrote: > > Hiya, > > I am using Struts for my cotroller portion and all is well. The one thing > that is painful is that Velocity doesn't have the kinda of inbuilt support > that JSP does because for all the tags that they have written (I am > specifically thinking about "form" integration). > > Has anyone else done this integration before ? If so any tips or macros you > want to share ? ;) > > -- > Cheers, > > Pete > > *------------------------------------------------------* > | "Computers are useless. They can only give you | > | answers." - Pablo Picasso | > *------------------------------------------------------* > > -- > To unsubscribe, e-mail: <mailto:stephanie60@example.com> > For additional commands, e-mail: <mailto:stephanie60@example.com> -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 13:25:20 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 90953 invoked from network); 2 Dec 2001 13:25:20 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 13:25:20 -0000 Received: (qmail 13195 invoked by uid 97); 2 Dec 2001 13:25:17 -0000 Delivered-To: stephanie60@example.com Received: (qmail 13179 invoked by uid 97); 2 Dec 2001 13:25:17 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 13168 invoked from network); 2 Dec 2001 13:25:15 -0000 Date: Sun, 02 Dec 2001 08:25:03 -0500 From: "Geir Magnusson Jr." <stephanie60@example.com> Subject: Re: Velocity & Struts - redux In-reply-to: <stephanie60@example.com> To: stephanie60@example.com Message-id: <stephanie60@example.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/83.161.120.1559 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 12/1/01 12:03 PM, "Ted Husted" <stephanie60@example.com> wrote: > There is really only one object that the Struts framework puts into a > servlet context that would be a must-have for the VelocityContext, the > ActionForm bean. > > There are other objects there, that could be used by the VelServlet > itself to create macros, but these would not need to be part of the > template writer's context. It's not just about creating macros... Struts stuffs all sorts of things in there, like the error stuff. > > The name of the ActionForm bean is encapsulated in the mapping passed in > the request. The mapping is stored under a static given by > Action.MAPPING_KEY. Once retrieved, you can can get the attribute name > (mapping.getAttribute()) for the name of the current form bean, and pass > that object to the VelocityContext. > > There are other framework objects, like the MessageResources, but those > wouldn't be used by a Velocity developer directly, but through (I guess) > a macro. Wait. Why not? It's perfectly valid for a template author to use them directly. I made this work in the proof of concept (POC) example and it worked fine. > Likewise for the mappings. A macro might want to lookup the URI > for a logical forward, and use that to write a hyperlink tag, but that > is not something you would expect in a VelocityContext (as I understand > it). Anything and everyhing should be available to the template. That is one of the really nice things about Velocity - you aren't constrained to use artificial framework-y data types... So a user should be able to just access stuff. > Now, the Struts developers may be passing other objects in the request, > and there lies the rub. But, if you want to require that the Struts > developers using VelServlet pass everything they need as part of the > form bean, then you're done ;-) > No, I was just thinking that some sort of pattern could be converged to... The problem I had when making the POC was that I was constantly having to dump the scopes and see what was in there. > Though, in practice, the ActionForm is only used for input forms. Most > pages can be rendered whatever JavaBeans the developer finds convenient. > > It would be very keen if Velocity Templates could be drop-in > replacements for JSPs and other display mechanisms that rely on the > standard contexts. So, the question might be, how do we transparently > expose the standard servlet contexts to a Velocity template writer, > without binding the core of Velocity to servlets. > > A strategy that JSP uses, and the Struts tag extensions follow, is to > search the contexts from nearest to farthest (unless told otherwise). > Could a subclass of the VelocityContext be constructed that would first > search its native context, then the servlet request context, then the > session context, and finally the application context, returning the > instance first found? I did this a while ago for the taglib I wrote that lets you use Velocity in JSP http://jakarta.apache.org/velocity/veltag.html The problem I saw before was that stuff had really bizarre names, and it wasn't clear where anything was put and why. Might have been a documentation issue, but I am not sure. > > If so, then you might be able to simply pass to a ServletVelocityContext > the instant request context, and let it encapsulate which context > (Velocity, request, session, or application) actually returns the > property. > > I apologize for ommitting Geir's original example application from my > resource page. Pure oversight on my part. (Must have been a busy news > week;-) I've got it up now, and will commit the link to the Struts > resource page in due course. Oooh... I better fix it up then :) > -- Ted Husted, Husted dot Com, Fairport NY USA. > -- Custom Software ~ Technical Services. > -- Tel (434)979-5350 > -- http://www.husted.com/struts/ > > -- > To unsubscribe, e-mail: > <mailto:stephanie60@example.com> > For additional commands, e-mail: > <mailto:stephanie60@example.com> > -- Geir Magnusson Jr. stephanie60@example.com System and Software Consulting "Whoever would overthrow the liberty of a nation must begin by subduing the freeness of speech." - Benjamin Franklin -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 13:28:21 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 91566 invoked from network); 2 Dec 2001 13:28:21 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 13:28:21 -0000 Received: (qmail 13864 invoked by uid 97); 2 Dec 2001 13:28:19 -0000 Delivered-To: stephanie60@example.com Received: (qmail 13848 invoked by uid 97); 2 Dec 2001 13:28:19 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 13837 invoked from network); 2 Dec 2001 13:28:18 -0000 Date: Sun, 02 Dec 2001 08:28:06 -0500 From: "Geir Magnusson Jr." <stephanie60@example.com> Subject: Re: Velocity & Struts - redux In-reply-to: <stephanie60@example.com> To: stephanie60@example.com Message-id: <stephanie60@example.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/83.161.120.1559 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 12/1/01 5:23 PM, "Paulo Gaspar" <stephanie60@example.com> wrote: > I do not remember enough from JSP (I was converted very soon) but, > again, it sounds like you might be pointing in the right direction. > > Maybe Geir knows better. He was fighting with the taglib stuff more > recently. When I ran across this issue in the tag library, I just extended the Context to be a flail-o-matic, and search 'upwards' in scope to find something. (There was a switch to turn this off...) I think that was a good approach to start, and I can't think of anything else... What would be nice is a description of what objects are placed in the session and request scopes, and under what name... > > > Have fun, > Paulo Gaspar > >> -----Original Message----- >> From: Ted Husted [mailto:stephanie60@example.com] >> Sent: Saturday, December 01, 2001 8:27 PM >> >> Hey, I see that Velocity already supports chained contexts. >> >> So could a session facade be chained to a request facade chained to a >> base Velocity context? >> >> Then neither Struts (or another system using the session and request >> contexts) nor Velocity would need to change, and everyone could just do >> what they do best. >> > > > -- > To unsubscribe, e-mail: > <mailto:stephanie60@example.com> > For additional commands, e-mail: > <mailto:stephanie60@example.com> > -- Geir Magnusson Jr. stephanie60@example.com System and Software Consulting "Whoever would overthrow the liberty of a nation must begin by subduing the freeness of speech." - Benjamin Franklin -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 13:43:50 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 99237 invoked from network); 2 Dec 2001 13:43:49 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 13:43:49 -0000 Received: (qmail 16360 invoked by uid 97); 2 Dec 2001 13:43:48 -0000 Delivered-To: stephanie60@example.com Received: (qmail 16344 invoked by uid 97); 2 Dec 2001 13:43:47 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 16333 invoked from network); 2 Dec 2001 13:43:47 -0000 Message-ID: <stephanie60@example.com> Date: Sun, 02 Dec 2001 08:43:26 -0500 From: Ted Husted <stephanie60@example.com> Organization: Apache Software Foundation / Jakarta X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Velocity Users List <stephanie60@example.com> Subject: Re: Velocity & Struts - redux References: <stephanie60@example.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N "Geir Magnusson Jr." wrote: > It's not just about creating macros... Struts stuffs all sorts of things in > there, like the error stuff. The mappings, messages, and error queue are expected to be used by the tag extensions, or other presentation tools. Page designers are not expected to use these directly, but only through tag extensions, or the equivalent. Though, everything there would be available in the usual way if they did want to to use it directly. We just discourage that (as pennance for past excesses). The only custom data that Struts puts into the context intended for a page designer to use directly, by reference through a tag extension or equivalent, is the form bean. Though, developers often provide other custom beans in the request as well. > The problem I saw before was that stuff had really bizarre names, and it > wasn't clear where anything was put and why. Might have been a > documentation issue, but I am not sure. The context attribute names are maintained as static fields in the Action class. http://jakarta.apache.org/struts/api-1.0/org/apache/struts/action/Action.html They use a *_KEY suffix. If there is anything specific I can clarify, please feel free to ask. -T. -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 14:23:59 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 7270 invoked from network); 2 Dec 2001 14:23:59 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 14:23:59 -0000 Received: (qmail 20409 invoked by uid 97); 2 Dec 2001 14:23:58 -0000 Delivered-To: stephanie60@example.com Received: (qmail 20393 invoked by uid 97); 2 Dec 2001 14:23:57 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 20382 invoked from network); 2 Dec 2001 14:23:57 -0000 Date: Sun, 02 Dec 2001 09:23:44 -0500 From: "Geir Magnusson Jr." <stephanie60@example.com> Subject: Re: Velocity & Struts - redux In-reply-to: <stephanie60@example.com> To: stephanie60@example.com Message-id: <stephanie60@example.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/83.161.120.1559 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 12/2/01 8:43 AM, "Ted Husted" <stephanie60@example.com> wrote: > "Geir Magnusson Jr." wrote: >> It's not just about creating macros... Struts stuffs all sorts of things in >> there, like the error stuff. > > The mappings, messages, and error queue are expected to be used by the > tag extensions, or other presentation tools. Page designers are not > expected to use these directly, but only through tag extensions, or the > equivalent. Though, everything there would be available in the usual way > if they did want to to use it directly. We just discourage that (as > pennance for past excesses). There *is* no other way to use them other then through tag extensions. Ok scriptlets, but I think they are universally understood to be evil at this point anyway :) I guess one approach would be to have any data that is universal (messages, errors) be placed into the scopes with a nice name and nice API. Then both the tag extensions could use them, and Velocity and other templating systems as well. That would be huge - Struts then doesn't give up anything in support of it's biggest user base, the JSP-ers, but allows us templating wierdo's access :) > > The only custom data that Struts puts into the context intended for a > page designer to use directly, by reference through a tag extension or > equivalent, is the form bean. Though, developers often provide other > custom beans in the request as well. Sure - and as beans, with nice names (basically anything that could be a Java lexical identifier...) would be accessible from Velocity. >> The problem I saw before was that stuff had really bizarre names, and it >> wasn't clear where anything was put and why. Might have been a >> documentation issue, but I am not sure. > > The context attribute names are maintained as static fields in the > Action class. > > http://jakarta.apache.org/struts/api-1.0/org/apache/struts/action/Action.html Cool beans :) > They use a *_KEY suffix. That might be ugly in a Velocity template, but would still work. :) This is getting interesting. > If there is anything specific I can clarify, please feel free to ask. > > -T. > > -- > To unsubscribe, e-mail: > <mailto:stephanie60@example.com> > For additional commands, e-mail: > <mailto:stephanie60@example.com> > -- Geir Magnusson Jr. stephanie60@example.com System and Software Consulting Be a giant. Take giant steps. Do giant things... -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 14:55:28 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 14362 invoked from network); 2 Dec 2001 14:55:28 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 14:55:28 -0000 Received: (qmail 25367 invoked by uid 97); 2 Dec 2001 14:55:28 -0000 Delivered-To: stephanie60@example.com Received: (qmail 25351 invoked by uid 97); 2 Dec 2001 14:55:27 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 25340 invoked from network); 2 Dec 2001 14:55:27 -0000 Message-ID: <stephanie60@example.com> Date: Sun, 02 Dec 2001 09:55:06 -0500 From: Ted Husted <stephanie60@example.com> Organization: Apache Software Foundation / Jakarta X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Velocity Users List <stephanie60@example.com> Subject: Re: Velocity & Struts - redux References: <stephanie60@example.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N "Geir Magnusson Jr." wrote: > There *is* no other way to use them other then through tag extensions. > I guess one approach would be to have any data that is universal (messages, > errors) be placed into the scopes with a nice name and nice API. We're discussing a JavaBean wrapper to encapsulate the shared resources, but that's not going to happen quickly. Each of these objects have their own API. The contexts are just used to make the objects available to other components in the application. In a JSP environment, each object's API is exposed to the developer through the tag extensions. Most developers are not aware of how these are stored, since either the tags access them or the object is provided through a method on the Action or the servlet. So, if I want a mapping for a particular path, I can just call servlet.findMapping(path), we don't go searching through the contexts. The servlet knows where it is. Likewise, to get the path for a particular Action, the developer doesn't have to access the contexts, the html:form tag knows where the mappings are, and then the uses the ActionMapping's API to get the path. The developer just provides a logical name, and the tag extension does the rest. The context keys are not cleanly documented, since it is really a deep implementation detail, not something that needs to be exposed in everyday development. I don't actually understand how Velocity works, but it sounded like any of the resources documented in the Action class (and exposed through tag extensions) should be made available through an easy-to-use macro or the equivalent. This then becomes the designer's API. > Sure - and as beans, with nice names (basically anything that could be a > Java lexical identifier...) would be accessible from Velocity. The objects that Struts and developers place in the standard contexts for use on the presentation layer have typical Java names, like "itemForm". In the tag extensions, we refer to the various JavaBean properties using a dotted syntax like property="itemForm.lastName" to call the equivalent of itemForm.getLastName(). I imagine the same thing works in Velocity, but as $itemForm.lastName. So, we all on the same page here. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel (434)979-5350 -- http://www.husted.com/struts/ -- To unsubscribe, e-mail: <mailto:stephanie60@example.com> For additional commands, e-mail: <mailto:stephanie60@example.com> From velocity-user-returnstephanie60@example.com Sun Dec 02 15:03:52 2001 Return-Path: <velocity-user-returnstephanie60@example.com> Delivered-To: stephanie60@example.com Received: (qmail 16005 invoked from network); 2 Dec 2001 15:03:51 -0000 Received: from unknown (HELO nagoya.betaversion.org) (83.161.120.155) by daedalus.apache.org with SMTP; 2 Dec 2001 15:03:51 -0000 Received: (qmail 26522 invoked by uid 97); 2 Dec 2001 15:03:48 -0000 Delivered-To: stephanie60@example.com Received: (qmail 26506 invoked by uid 97); 2 Dec 2001 15:03:48 -0000 Mailing-List: contact stephanie60@example.com; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:stephanie60@example.com> List-Subscribe: <mailto:stephanie60@example.com> List-Help: <mailto:stephanie60@example.com> List-Post: <mailto:stephanie60@example.com> List-Id: "Velocity Users List" <velocity-user.jakarta.apache.org> Reply-To: "Velocity Users List" <stephanie60@example.com> Delivered-To: mailing list stephanie60@example.com Received: (qmail 26491 invoked from network); 2 Dec 2001 15:03:47 -0000 Date: Sun, 02 Dec 2001 10:03:34 -0500 From: "Geir Magnusson Jr." <stephanie60@example.com> Subject: Re: Velocity & Struts - redux In-reply-to: <stephanie60@example.com> To: stephanie60@example.com Message-id: <stephanie60@example.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/83.161.120.1559 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 12/2/01 9:55 AM, "Ted Husted" <stephanie60@example.com> wrote: > "Geir Magnusson Jr." wrote: >> There *is* no other way to use them other then through tag extensions. >> I guess one approach would be to have any data that is universal (messages, >> errors) be placed into the scopes with a nice name and nice API. > > We're discussing a JavaBean wrapper to encapsulate the shared resources, > but that's not going to happen quickly. > > Each of these objects have their own API. The contexts are just used to > make the objects available to other components in the application. In a > JSP environment, each object's API is exposed to the developer through > the tag extensions. Most developers are not aware of how these are > stored, since either the tags access them or the object is provided > through a method on the Action or the servlet. > > So, if I want a mapping for a particular path, I can just call > servlet.findMapping(path), we don't go searching through the contexts. > The
{'source': 'Apache Software Foundation Public Mail Archives'}