On Wed, Aug 20, 2008 at 10:00 PM, Anna Klisiewicz wrote: > Tkank you Rahul for answer. I am sorry but I have to ask you for more > explicit answer as I read the documentation and I still do not really know > how to initialize those data stractures. I whish there were more examples > avaliable... > Please continue to ask questions, thats no problem at all. At the end of this thread, if you feel there is an example that makes things clearer, please write it up and post it to JIRA we'll be happy to consider adding it to the documentation. > What should I do inside sxml code like: > > > > > > > > > if I want data1 and data2 to be stacks. > What the element does is create variables in the underlying context for the state (or the root document). So, for example, this snippet of code ... ... creates a variable "foo" in the root context of the state machine instance (root since its child of , rather than any state) whose value starts off as being the DOM Node containing pertinent application data (as indicated by the comment above). I say starts off because this value can be manipulated as the state machine progresses, so in that sense it is a "live" copy of the data. Commons SCXML also allows you to interact with the contexts (root, or otherwise) programmatically. This is useful for injecting non-XML data. So, given that you want data1 and data2 to be stacks, that would look like: SCXMLExecutor exec; // Initialize the above executor appropriately exec.getRootContext().set("data1", new Stack()); exec.getRootContext().set("data2", new Stack()); // Set executor in motion try { exec.go(); } catch (ModelException me) { // app-specific exception handling } Given the above, the state machine definition itself (SCXML document) could now use the above data structures as follows (say on entering state "bar" you want to pop stack "data1" and do something with the popped data): Note that it is possible to get the behavior of a stack purely using XML data and SCXML actions (such as ) but that discussion is best saved for another time. Finally, towards your question about JSP EL vs. JEXL in your original email below, I'd recommend using JEXL (it doesn't appear your usecase has anything to do with JSPs). -Rahul > 2008/8/19 Rahul Akolkar > >> >> To summarize, each context is populated by a combination of: >> * elements at the corresponding location in the SCXML document >> * programmatic population using data structures that make sense to >> the EL in use -- via Context#set(String, Object) > > > What the Contex corresponds to? How to set it to point on data1 or data2. > What is the "String" and "Object" in this case? > I would like to use jsp and what would you advise, jsp or jexl? > > Thank you in advance, > Anna > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org