Get and Set XSP-Session Attributes errors
Hello, I have to set and get a user name in my web-application. I use a xsp-session and followed the sample from Cocoon Developer's handbook : using content logic XSP about authentification. But if I write exaclty the same pages, I get this error: org.apache.cocoon.ProcessingException: Exception in ServerPagesGenerator.generate(): java.lang.NullPointerException But why? I checked the session:set-attribute name=userxsp:expruser/xsp:expr/session:set-attribute line, and it seems correct. The string user is not null. So why do I get an error Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
xsp-session and JAVA sessions
What is the difference between these two sessions??? : JAVA session: xsp:structure xsp:includeorg.apache.cocoon.environment.Session/xsp:include /xsp:structure ... xsp:logic Session session = null; ... session = request.getSession(true); session.setAttribute(user,user); ... /xsp:logic -- XSP SESSION: xsp:page language=java xmlns:xsp=http://apache.org/xsp; xmlns:session=http://apache.org/xsp/session/2.0; ... session:set-attribute name=userxsp:expruser/xsp:expr/session:set-attribute ... Is there a way to create and set a JAVA session and then get an attribute with session-xsp, like session:get-attribute name=user/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: xsp-session and JAVA sessions
from within an XSP you can have a session be created by specifying the xsp:page's attribute @create-session=true (this is handled by the session logicsheet. this way a session will be created if it didn't yet exist. problems can occur with these sessions, though; sessions created by the session logicsheet from within the XSP are created when actual generation begins, i.e. after pipeline setup. thus, transformers in the pipeline (for which the XSP is the generator) won't see the session instantly. your safest bet is to create the session before the generator step (e.g. via an action) and have the generator access this one via the session logicsheet. -Ursprungliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Auftrag von [EMAIL PROTECTED] Gesendet: Mittwoch, 26. Februar 2003 12:38 An: [EMAIL PROTECTED] Betreff: xsp-session and JAVA sessions What is the difference between these two sessions??? : JAVA session: xsp:structure xsp:includeorg.apache.cocoon.environment.Session/xsp:include /xsp:structure ... xsp:logic Session session = null; ... session = request.getSession(true); session.setAttribute(user,user); ... /xsp:logic -- XSP SESSION: xsp:page language=java xmlns:xsp=http://apache.org/xsp; xmlns:session=http://apache.org/xsp/session/2.0; ... session:set-attribute name=userxsp:expruser/xsp:expr/session:set-attribute ... Is there a way to create and set a JAVA session and then get an attribute with session-xsp, like session:get-attribute name=user/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp session logicsheet
Hi Cyril, try adding xmlns:session=http://apache.org/xsp/session/2.0; namespace to your xsp page. Then have a look at the generated code. Basically you should see a java variable (object) named session, with it you can do what you want. No need to declare it, cocoon does it for you. Roman -Original Message- From: Cyril Vidal [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 11:01 AM To: [EMAIL PROTECTED] Subject: Re: xsp session logicsheet Thanks for you response. hum, I guess actions are still a little bit too complex for me, regarding my knowledge of Cocoon... Isn't it really possible to add merely values to the same session's attribute with the ESQL logicsheet? It sounds odd... Cyril. Hi Cyril Why don't use an action, I think it's better not to have too much Java code in your xsp-pages. In an action you can take your code as it is. Cheers Beat Hi, I would like to deal with session through xsp, and serve as far as possible the same goal as with the following servlet: e.g put all the parameters named 'item' in the object of type Vector 'items' bound to the current session, so that it would be possible to list at any time all of the items chosen so far by the client in his session. public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType(text/html); PrintWriter out = res.getWriter(); // Get the current session object, create one if necessary. HttpSession session = req.getSession(true); // Cart items are maintained in the session object. Vector items = (Vector)session.getAttribute(cart.items); if (items == null) { items = new Vector(10,5);} String item = req.getParameter(item); items.add(item); session.setAttribute(cart.items,items); out.println(HTMLHEADTITLESessionTracker modifie/TITLE/HEAD); out.println(BODYH1Session Tracking Demo/H1); // Print the current cart items. out.println(You currently have the following items in your cart:BR); if (items == null) { out.println(BNone/B); } else { out.println(UL); for (int i = 0; i items.size(); i++) { out.println(LI + items.get(i)); } out.println(/UL); } out.println(/BODY/HTML); } } Below is the xsp i've written for the moment,: this is working fine, but does not do what I want: because each time the client chooses an item and pass it via the parameter 'item', instead of being added in the object cart.items, its value overrides this of the preceding parameter. ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true html xsp-session:set-attribute name=cart.itemsxsp-request:get-parameter name=item//xsp-session:set-attribute bYou currently have the following items in your cart:/b xsp-session:get-attribute name=cart.items/ br/ bYour session was created:/b xsp-session:get-creation-time as=string/ /html /xsp:page Some of you would know how I can improve my code? Indeed, I would like cart.items to be like a Vector, so that it would be possible to put merely values onto it. Thanks in advance for your help, Cyril. - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- +++ GMX - Mail, Messaging more http://www.gmx.net +++ NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen! - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xsp session logicsheet
Hi Roman, Indeed I've done this: ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true html xsp-session:set-attribute name=cart.itemsxsp-request:get-parameter name=item//xsp-session:set-attribute bThe list of items is:/b xsp-session:get-attribute name=cart.items default=not set/ br/ bYour session was created:/b xsp-session:get-creation-time as=string/ /html /xsp:page My problem is the following: I would like to add items to the attribute's session 'cart.items'. For the moment, the preceding code doesn't do this task. When I call http://localhost:8080/cocoo/mount/try/session.xsp?item=3 I receive the following html result: The list of items is: 3 Your session was created: Wed Feb 05 13:41:32 CET 2003 when I then call http://localhost:8080/cocoo/mount/try/session.xsp?item=5 The result is the following: The list of items is: 5 Your session was created: Wed Feb 05 13:41:32 CET 2003 and of course, I would like The list of items is: 3, 5 Your session was created: Wed Feb 05 13:41:32 CET 2003 What i would like to know : is it possible to achieve this task by using Session Logicsheet by itself, does this Logicsheet provides this functionnality? If not, the alternative is also to use actions, as suggested in this thread before? Is a built-in action available for this, or do I have to build one from scratch? Any help or hint would help me, Thanks, Cyril. Hi Cyril, try adding xmlns:session=http://apache.org/xsp/session/2.0; namespace to your xsp page. Then have a look at the generated code. Basically you should see a java variable (object) named session, with it you can do what you want. No need to declare it, cocoon does it for you. Roman -Original Message- From: Cyril Vidal [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 11:01 AM To: [EMAIL PROTECTED] Subject: Re: xsp session logicsheet Thanks for you response. hum, I guess actions are still a little bit too complex for me, regarding my knowledge of Cocoon... Isn't it really possible to add merely values to the same session's attribute with the ESQL logicsheet? It sounds odd... Cyril. Hi Cyril Why don't use an action, I think it's better not to have too much Java code in your xsp-pages. In an action you can take your code as it is. Cheers Beat Hi, I would like to deal with session through xsp, and serve as far as possible the same goal as with the following servlet: e.g put all the parameters named 'item' in the object of type Vector 'items' bound to the current session, so that it would be possible to list at any time all of the items chosen so far by the client in his session. public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType(text/html); PrintWriter out = res.getWriter(); // Get the current session object, create one if necessary. HttpSession session = req.getSession(true); // Cart items are maintained in the session object. Vector items = (Vector)session.getAttribute(cart.items); if (items == null) { items = new Vector(10,5);} String item = req.getParameter(item); items.add(item); session.setAttribute(cart.items,items); out.println(HTMLHEADTITLESessionTracker modifie/TITLE/HEAD); out.println(BODYH1Session Tracking Demo/H1); // Print the current cart items. out.println(You currently have the following items in your cart:BR); if (items == null) { out.println(BNone/B); } else { out.println(UL); for (int i = 0; i items.size(); i++) { out.println(LI + items.get(i)); } out.println(/UL); } out.println(/BODY/HTML); } } Below is the xsp i've written for the moment,: this is working fine, but does not do what I want: because each time the client chooses an item and pass it via the parameter 'item', instead of being added in the object cart.items, its value overrides this of the preceding parameter. ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true html xsp-session:set-attribute name=cart.itemsxsp-request:get-parameter name=item//xsp-session:set-attribute bYou currently have the following items in your cart:/b xsp-session:get-attribute name=cart.items/ br/ bYour session was created:/b xsp-session:get-creation-time as=string/ /html /xsp:page Some of you would know how I can improve my code? Indeed, I would like cart.items to be like
Re: xsp session logicsheet
On 05.Feb.2003 -- 11:00 AM, Cyril Vidal wrote: Thanks for you response. hum, I guess actions are still a little bit too complex for me, regarding my knowledge of Cocoon... Isn't it really possible to add merely values to the same session's attribute with the ESQL logicsheet? It sounds odd... Er, no. But you probably didn't mean ESQL anyway. You need to do it as you did it before: retrieve the value, add a new element to it and then store it again. // Cart items are maintained in the session object. Vector items = (Vector)session.getAttribute(cart.items); if (items == null) { items = new Vector(10,5);} String item = req.getParameter(item); items.add(item); session.setAttribute(cart.items,items); Would translate to xsp:logic Object items = xsp-session:get-attribute name=cart.items/; if (items == null) items = new Vector(10,5); ((Vector) items).add(xsp-request:get-parameter name=item/); request.getSession().setAttribute(items); // logicsheet only supports setting Strings objects :-( // thus do it manually. /xsp:logic Chris. -- C h r i s t i a n H a u l [EMAIL PROTECTED] fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xsp session logicsheet
Hello Christian, Thanks again for your help and your availibility. Of course, I meant Session logicsheet and not ESQL one...Sorry... I've tried to launch the code you've suggested: ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true xsp:logic Object items = xsp-session:get-attribute name=cart.items/; if (items == null) items = new Vector(10,5); ((Vector) items).add(xsp-request:get-parameter name=item/); request.getSession().setAttribute(items); // logicsheet only supports setting Strings objects :-( // thus do it manually. /xsp:logic /xsp:page But, I receive following error message: type fatal message Language Exception description org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Error compiling session3_xsp: Line 78, column 6: illegal start of type Line 79, column 6: illegal start of type Line 88, column 24: expected Line 88, column 14: cannot access class getSession; file request\getSession.class not found Line 73, column 47: variable session not found in class org.apache.cocoon.www.mount.essai.session3_xsp Line 0, column 0: 5 errors sender org.apache.cocoon.servlet.CocoonServlet source Cocoon servlet stack-trace org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Error compiling session3_xsp: Line 78, column 6: illegal start of type Line 79, column 6: illegal start of type Line 88, column 24: expected Line 88, column 14: cannot access class getSession; file request\getSession.class not found Line 73, column 47: variable session not found in class org.apache.cocoon.www.mount.essai.session3_xsp Line 0, column 0: 5 errors I've cheked out in the source code of the xsp file generated: 68 /* User Class Declarations */ 70 Object items = 72 ( 73 XSPSessionHelper.getSessionAttribute(session, 74 String.valueOf(cart.items), 75 null) 76) 77 ; 78 if (items == null) items = new Vector(10,5); 79 ((Vector) items).add( 81 ( 82 (XSPRequestHelper.getParameter(objectModel, 83 item, null, 84null, 85null)) 86) 87); I can't figure out why the line 78 throws an illegal start type...Do you see what can be wrong? Regards, Cyril. PS: In the code, you've written: request.getSession().setAttribute(items); shall we not write instead request.getSession().setAttribute(cart-item, items); as in the traditional java servlet? I'm not sure... - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xsp session logicsheet
On 05.Feb.2003 -- 02:56 PM, Cyril Vidal wrote: Hello Christian, Thanks again for your help and your availibility. Of course, I meant Session logicsheet and not ESQL one...Sorry... I've tried to launch the code you've suggested: ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true The class Vector is unknown here. Add xsp:structure xsp:includejava.util.Vector/xsp:include /xsp:structure in order to create an import statement. Add some markup here, otherwise the following code won't be inside the generate() method but would be expected to be a valid method declaration. content xsp:logic Object items = xsp-session:get-attribute name=cart.items/; if (items == null) items = new Vector(10,5); ((Vector) items).add(xsp-request:get-parameter name=item/); request.getSession().setAttribute(items); // logicsheet only supports setting Strings objects :-( // thus do it manually. /xsp:logic /content /xsp:page Regards, Cyril. PS: In the code, you've written: request.getSession().setAttribute(items); shall we not write instead request.getSession().setAttribute(cart-item, items); as in the traditional java servlet? Absolutely, you are right. And the other poster is also right that there is a variable named session if the session logicsheet is used. Thus it suffices to write session.setAttribute(cart.items, items); Chris. BTW when writing to the list you don't need to CC me -- it will end up in the same mailbox anyway (as duplicates). -- C h r i s t i a n H a u l [EMAIL PROTECTED] fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xsp session logicsheet
I think I'm on the point of being successful with my business. But I still have one question, considering the following short code and especially the uncommented snippet: (serves to retrieve and display all the items of the current session) ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true xsp:structure xsp:includejava.util.Vector/xsp:include /xsp:structure content xsp:logic Object items = xsp-session:get-attribute name=cart.items/; if (items == null) items = new Vector(10,5); ((Vector) items).add(xsp-request:get-parameter name=item/); session.setAttribute(cart.items,items); /**Error here: method get() and variable i are not known from Cocoon's servlet ul for (int i=0; ilt;items.size(); i++) { lixsp:expritems.get(i)/xsp:expr/li } /ul **/ /xsp:logic /content /xsp:page Why do I receive the following two errors: Line 174, column 58: variable i not found in class org.apache.cocoon.www.mount.essai.session3_xsp Line 174, column 54: method get() not found in class java.lang.Object Is the syntax I am using here not the same as the following, which is OK? elements xsp:logic for (int i=1; ilt;11; i++) { elementxsp:expri/xsp:expr/element } /xsp:logic /elements Which is the difference between them? Regards, Cyril - Original Message - From: Christian Haul [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 05, 2003 3:19 PM Subject: Re: xsp session logicsheet On 05.Feb.2003 -- 02:56 PM, Cyril Vidal wrote: Hello Christian, Thanks again for your help and your availibility. Of course, I meant Session logicsheet and not ESQL one...Sorry... I've tried to launch the code you've suggested: ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true The class Vector is unknown here. Add xsp:structure xsp:includejava.util.Vector/xsp:include /xsp:structure in order to create an import statement. Add some markup here, otherwise the following code won't be inside the generate() method but would be expected to be a valid method declaration. content xsp:logic Object items = xsp-session:get-attribute name=cart.items/; if (items == null) items = new Vector(10,5); ((Vector) items).add(xsp-request:get-parameter name=item/); request.getSession().setAttribute(items); // logicsheet only supports setting Strings objects :-( // thus do it manually. /xsp:logic /content /xsp:page Regards, Cyril. PS: In the code, you've written: request.getSession().setAttribute(items); shall we not write instead request.getSession().setAttribute(cart-item, items); as in the traditional java servlet? Absolutely, you are right. And the other poster is also right that there is a variable named session if the session logicsheet is used. Thus it suffices to write session.setAttribute(cart.items, items); Chris. BTW when writing to the list you don't need to CC me -- it will end up in the same mailbox anyway (as duplicates). -- C h r i s t i a n H a u l [EMAIL PROTECTED] fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xsp session logicsheet
On 05.Feb.2003 -- 04:53 PM, Cyril Vidal wrote: I think I'm on the point of being successful with my business. But I still have one question, considering the following short code and especially the uncommented snippet: (serves to retrieve and display all the items of the current session) ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true xsp:structure xsp:includejava.util.Vector/xsp:include /xsp:structure content xsp:logic Object items = xsp-session:get-attribute name=cart.items/; if (items == null) items = new Vector(10,5); ((Vector) items).add(xsp-request:get-parameter name=item/); session.setAttribute(cart.items,items); /**Error here: method get() and variable i are not known from Cocoon's servlet ul for (int i=0; ilt;items.size(); i++) { Mind you that items is declared of type Object because that cast to Vector might result in a NPE when applied to null. Thus size() and get() method are not declared for this object! You need to cast it first (and probably assign it to a variable of type vector). lixsp:expritems.get(i)/xsp:expr/li } /ul **/ /xsp:logic /content /xsp:page Chris. -- C h r i s t i a n H a u l [EMAIL PROTECTED] fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xsp session logicsheet
Hi Roman, thank you very much for your reponse. I know that in theory, using actions is better than simply mixing pure Java code in XSP pages. But it's true that I must go quite quickly, and just to have an idea of how sessions work in Cocoon, I just would to have a first try with the second solution. Of course, I have in project to have a deeper understanding of what goes on under the hood with actions, but a little bit latter. AFAIK, this concept is not really simple to figure out... The solution you suggested to me works well, thanks: ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true xsp:structure xsp:includejava.util.Vector/xsp:include /xsp:structure content xsp:logic Vector items = (Vector)xsp-session:get-attribute name=cart.items/; if (items == null) items = new Vector(10,5); items.add(xsp-request:get-parameter name=item/); session.setAttribute(cart.items,items); bThe list of items is:/b xsp-session:get-attribute name=cart.items default=not set/ /xsp:logic /content /xsp:page But the result is of the following form: The list of items is: 1336364336433643323643 and I would like better it would be of this form: The list of items is: .133636 433 643 3643 323643 So instead of the following code, bThe list of items is:/b xsp-session:get-attribute name=cart.items default=not set/ I' ve tried the following one: bThe list of items is:/b ul for (int i = 0; i lt; items.size(); i++) { lixsp:expritems.get(i)/xsp:expr/li } /ul I have the following error: Line 226, column 59: variable i not found in class org.apache.cocoon.www.mount.essai.session3_xsp Christian Haul has already taken pains (one more time) to explain me what went wrong, but I'm afraid I've not all understood. I've casted the former Object items onto Vector one, as suggested, but it doesn't seem to be sufficient. Have any idea? Regards, Cyril. Hi Cyril, you do not have to use actions if you do not want :-) As I said, when you use session namespace, there is always a variable session there in the generated java code. You can access this session either directly in xsp page from within xsp:logic tags, or you can write your own taglib. This taglib can then implicitly use session variable, though it will never be declared there. What I propose to you is a kind of dirty programming style, but as I understood you want a quick solution. Try something like this, you have to experiment and always look at the generated code: ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true html xsp:logic // beginning of the java code try { // Cart items are maintained in the session object. Vector items = (Vector)session.getAttribute(cart.items); if (items == null) { items = new Vector(10,5);} String item = req.getParameter(item); items.add(item); session.setAttribute(cart.items,items); /xsp:logic bThe list of items is:/b xsp-session:get-attribute name=cart.items default=not set/ /html /xsp:page Roman -Original Message- From: Cyril Vidal [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 1:53 PM To: [EMAIL PROTECTED] Subject: Re: xsp session logicsheet Hi Roman, Indeed I've done this: ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true html xsp-session:set-attribute name=cart.itemsxsp-request:get-parameter name=item//xsp-session:set-attribute bThe list of items is:/b xsp-session:get-attribute name=cart.items default=not set/ br/ bYour session was created:/b xsp-session:get-creation-time as=string/ /html /xsp:page My problem is the following: I would like to add items to the attribute's session 'cart.items'. For the moment, the preceding code doesn't do this task. When I call http://localhost:8080/cocoo/mount/try/session.xsp?item=3 I receive the following html result: The list of items is: 3 Your session was created: Wed Feb 05 13:41:32 CET 2003 when I then call http://localhost:8080/cocoo/mount/try/session.xsp?item=5 The result is the following: The list of items is: 5 Your session was created: Wed Feb 05 13:41:32 CET 2003 and of course, I would like The list of items is: 3, 5 Your session was created: Wed Feb 05 13:41:32 CET 2003 What i would like to know : is it possible to achieve this task by using Session Logicsheet by itself, does this Logicsheet provides this functionnality? If not, the alternative is also to use actions, as suggested in this thread before? Is a built-in action available for this, or do I have to build one
xsp session
Hi, I would like to deal with session through xsp, and serve as far as possible the same goal as with the following servlet: e.g put all the parameters named 'item' in the object of type Vector 'items' bound to the current session, so that it would be possible to list at any time all of the items chosen so far by the client in his session. public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType(text/html); PrintWriter out = res.getWriter(); // Get the current session object, create one if necessary. HttpSession session = req.getSession(true); // Cart items are maintained in the session object. Vector items = (Vector)session.getAttribute(cart.items); if (items == null) { items = new Vector(10,5);} String item = req.getParameter(item); items.add(item); session.setAttribute(cart.items,items); out.println(HTMLHEADTITLESessionTracker modifie/TITLE/HEAD); out.println(BODYH1Session Tracking Demo/H1); // Print the current cart items. out.println(You currently have the following items in your cart:BR); if (items == null) { out.println(BNone/B); } else { out.println(UL); for (int i = 0; i items.size(); i++) { out.println(LI + items.get(i)); } out.println(/UL); } out.println(/BODY/HTML); } } Below is the xsp i've written for the moment,: this is working fine, but does not do what I want: because each time the client chooses an item and pass it via the parameter 'item', instead of being added in the object cart.items, its value overrides this of the preceding parameter. ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true html xsp-session:set-attribute name=cart.itemsxsp-request:get-parameter name=item//xsp-session:set-attribute bYou currently have the following items in your cart:/b xsp-session:get-attribute name=cart.items/ br/ bYour session was created:/b xsp-session:get-creation-time as=string/ /html /xsp:page Some of you would know how I can improve my code? Indeed, I would like cart.items to be like a Vector, so that it would be possible to put merely values onto it. Thanks in advance for your help, Cyril. - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xsp session
Hi Cyril Why don't use an action, I think it's better not to have too much Java code in your xsp-pages. In an action you can take your code as it is. Cheers Beat Hi, I would like to deal with session through xsp, and serve as far as possible the same goal as with the following servlet: e.g put all the parameters named 'item' in the object of type Vector 'items' bound to the current session, so that it would be possible to list at any time all of the items chosen so far by the client in his session. public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType(text/html); PrintWriter out = res.getWriter(); // Get the current session object, create one if necessary. HttpSession session = req.getSession(true); // Cart items are maintained in the session object. Vector items = (Vector)session.getAttribute(cart.items); if (items == null) { items = new Vector(10,5);} String item = req.getParameter(item); items.add(item); session.setAttribute(cart.items,items); out.println(HTMLHEADTITLESessionTracker modifie/TITLE/HEAD); out.println(BODYH1Session Tracking Demo/H1); // Print the current cart items. out.println(You currently have the following items in your cart:BR); if (items == null) { out.println(BNone/B); } else { out.println(UL); for (int i = 0; i items.size(); i++) { out.println(LI + items.get(i)); } out.println(/UL); } out.println(/BODY/HTML); } } Below is the xsp i've written for the moment,: this is working fine, but does not do what I want: because each time the client chooses an item and pass it via the parameter 'item', instead of being added in the object cart.items, its value overrides this of the preceding parameter. ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; create-session=true html xsp-session:set-attribute name=cart.itemsxsp-request:get-parameter name=item//xsp-session:set-attribute bYou currently have the following items in your cart:/b xsp-session:get-attribute name=cart.items/ br/ bYour session was created:/b xsp-session:get-creation-time as=string/ /html /xsp:page Some of you would know how I can improve my code? Indeed, I would like cart.items to be like a Vector, so that it would be possible to put merely values onto it. Thanks in advance for your help, Cyril. - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- +++ GMX - Mail, Messaging more http://www.gmx.net +++ NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen! - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp-session : Bug with Cocoon? or Bug with programmer?
After searching the created Java file (apologies for my earlier mistake), the request helper is the only place it could be trying to set the variable. For example the following XSP (entire file) : +-+ ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; create-session=true page xsp-session:set-attribute name=fruitApple/xsp-session:set-attribute fruitxsp-session:get-attribute name=fruit//fruit /page /xsp:page +-+ Generates the following Java +-+ public class test_xsp extends XSPGenerator { static { dateCreated = 1037088922427L; dependencies = new File[]{ }; } /* Built-in parameters available for use */ // context- ServletContext // request- HttpServletRequest // response - HttpServletResponse // parameters - parameters defined in the sitemap /* User Class Declarations */ /** * Generate XML data. */ public void generate() throws SAXException, IOException, ProcessingException { this.contentHandler.startDocument(); AttributesImpl xspAttr = new AttributesImpl(); this.contentHandler.startPrefixMapping(xml, http://www.w3.org/XML/1998/namespace;); this.contentHandler.startPrefixMapping(xsp, http://apache.org/xsp;); this.contentHandler.startPrefixMapping(xsp-session, http://apache.org/xsp/session/2.0;); this.contentHandler.startElement(, page, page, xspAttr); xspAttr.clear(); this.characters(\n); XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); this.characters(\n); this.contentHandler.startElement(, fruit, fruit, xspAttr); xspAttr.clear(); XSPObjectHelper.xspExpr(contentHandler, XSPRequestHelper.getSessionAttribute(objectModel, String.valueOf(fruit), )); this.contentHandler.endElement(, fruit, fruit); this.characters(\n ); this.contentHandler.endElement(, page, page); this.contentHandler.endPrefixMapping(xml); this.contentHandler.endPrefixMapping(xsp); this.contentHandler.endPrefixMapping(xsp-session); this.contentHandler.endDocument(); } } +-+ So as you can see from the above the only place it is possible creating the session variable is XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); And this is where the rogue semicolon appears. I can remove the rogue semicolon by creating the String Apple and reverencing that string through xsp:expr tags. But this leads to a nullPointerException. I think that either I am being really dim with this or some powers that I can't control are at work here! Thanks for everyone's help so far Tom Place - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp-session : Bug with Cocoon? or Bug with programmer?
I dont make use of it. But I use XSP. :-D Try to change the order of the namespaces to: xsp:page xmlns:xsp-session=http://apache.org/xsp/session/2.0; create-session=true xmlns:xsp=http://apache.org/xsp; The check again the Java code. It is a interesting error. What version are you using? Regards, Antonio Gallardo. Tom Place dijo: After searching the created Java file (apologies for my earlier mistake), the request helper is the only place it could be trying to set the variable. For example the following XSP (entire file) : +-+ ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; create-session=true page xsp-session:set-attribute name=fruitApple/xsp-session:set-attribute fruitxsp-session:get-attribute name=fruit//fruit /page /xsp:page +-+ Generates the following Java +-+ public class test_xsp extends XSPGenerator { static { dateCreated = 1037088922427L; dependencies = new File[]{ }; } /* Built-in parameters available for use */ // context- ServletContext // request- HttpServletRequest // response - HttpServletResponse // parameters - parameters defined in the sitemap /* User Class Declarations */ /** * Generate XML data. */ public void generate() throws SAXException, IOException, ProcessingException { this.contentHandler.startDocument(); AttributesImpl xspAttr = new AttributesImpl(); this.contentHandler.startPrefixMapping(xml, http://www.w3.org/XML/1998/namespace;); this.contentHandler.startPrefixMapping(xsp, http://apache.org/xsp;); this.contentHandler.startPrefixMapping(xsp-session, http://apache.org/xsp/session/2.0;); this.contentHandler.startElement(, page, page, xspAttr); xspAttr.clear(); this.characters(\n); XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); this.characters(\n); this.contentHandler.startElement(, fruit, fruit, xspAttr); xspAttr.clear(); XSPObjectHelper.xspExpr(contentHandler, XSPRequestHelper.getSessionAttribute(objectModel, String.valueOf(fruit), )); this.contentHandler.endElement(, fruit, fruit); this.characters(\n ); this.contentHandler.endElement(, page, page); this.contentHandler.endPrefixMapping(xml); this.contentHandler.endPrefixMapping(xsp); this.contentHandler.endPrefixMapping(xsp-session); this.contentHandler.endDocument(); } } +-+ So as you can see from the above the only place it is possible creating the session variable is XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); And this is where the rogue semicolon appears. I can remove the rogue semicolon by creating the String Apple and reverencing that string through xsp:expr tags. But this leads to a nullPointerException. I think that either I am being really dim with this or some powers that I can't control are at work here! Thanks for everyone's help so far Tom Place - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp-session : Bug with Cocoon? or Bug with programmer?
Unfortunately this makes no difference. The cocoon version is 2.03 Going to try downloading the 2.03 for JDK 1.4 binary - see if this makes any difference . . . -Original Message- From: Antonio A. Gallardo Rivera [mailto:agallardo;agsoftware.dnsalias.com] Sent: 12 November 2002 10:25 To: [EMAIL PROTECTED] Subject: RE: xsp-session : Bug with Cocoon? or Bug with programmer? I dont make use of it. But I use XSP. :-D Try to change the order of the namespaces to: xsp:page xmlns:xsp-session=http://apache.org/xsp/session/2.0; create-session=true xmlns:xsp=http://apache.org/xsp; The check again the Java code. It is a interesting error. What version are you using? Regards, Antonio Gallardo. Tom Place dijo: After searching the created Java file (apologies for my earlier mistake), the request helper is the only place it could be trying to set the variable. For example the following XSP (entire file) : +-+ ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; create-session=true page xsp-session:set-attribute name=fruitApple/xsp-session:set-attribute fruitxsp-session:get-attribute name=fruit//fruit /page /xsp:page +-+ Generates the following Java +-+ public class test_xsp extends XSPGenerator { static { dateCreated = 1037088922427L; dependencies = new File[]{ }; } /* Built-in parameters available for use */ // context- ServletContext // request- HttpServletRequest // response - HttpServletResponse // parameters - parameters defined in the sitemap /* User Class Declarations */ /** * Generate XML data. */ public void generate() throws SAXException, IOException, ProcessingException { this.contentHandler.startDocument(); AttributesImpl xspAttr = new AttributesImpl(); this.contentHandler.startPrefixMapping(xml, http://www.w3.org/XML/1998/namespace;); this.contentHandler.startPrefixMapping(xsp, http://apache.org/xsp;); this.contentHandler.startPrefixMapping(xsp-session, http://apache.org/xsp/session/2.0;); this.contentHandler.startElement(, page, page, xspAttr); xspAttr.clear(); this.characters(\n); XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); this.characters(\n); this.contentHandler.startElement(, fruit, fruit, xspAttr); xspAttr.clear(); XSPObjectHelper.xspExpr(contentHandler, XSPRequestHelper.getSessionAttribute(objectModel, String.valueOf(fruit), )); this.contentHandler.endElement(, fruit, fruit); this.characters(\n ); this.contentHandler.endElement(, page, page); this.contentHandler.endPrefixMapping(xml); this.contentHandler.endPrefixMapping(xsp); this.contentHandler.endPrefixMapping(xsp-session); this.contentHandler.endDocument(); } } +-+ So as you can see from the above the only place it is possible creating the session variable is XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); And this is where the rogue semicolon appears. I can remove the rogue semicolon by creating the String Apple and reverencing that string through xsp:expr tags. But this leads to a nullPointerException. I think that either I am being really dim with this or some powers that I can't control are at work here! Thanks for everyone's help so far Tom Place - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp-session : Bug with Cocoon? or Bug with programmer?
What version of cocoon are you using? Geoff --- Tom Place [EMAIL PROTECTED] wrote: After searching the created Java file (apologies for my earlier mistake), the request helper is the only place it could be trying to set the variable. For example the following XSP (entire file) : +-+ ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; create-session=true page xsp-session:set-attribute name=fruitApple/xsp-session:set-attribute fruitxsp-session:get-attribute name=fruit//fruit /page /xsp:page +-+ Generates the following Java +-+ public class test_xsp extends XSPGenerator { static { dateCreated = 1037088922427L; dependencies = new File[]{ }; } /* Built-in parameters available for use */ // context- ServletContext // request- HttpServletRequest // response - HttpServletResponse // parameters - parameters defined in the sitemap /* User Class Declarations */ /** * Generate XML data. */ public void generate() throws SAXException, IOException, ProcessingException { this.contentHandler.startDocument(); AttributesImpl xspAttr = new AttributesImpl(); this.contentHandler.startPrefixMapping(xml, http://www.w3.org/XML/1998/namespace;); this.contentHandler.startPrefixMapping(xsp, http://apache.org/xsp;); this.contentHandler.startPrefixMapping(xsp-session, http://apache.org/xsp/session/2.0;); this.contentHandler.startElement(, page, page, xspAttr); xspAttr.clear(); this.characters(\n); XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); this.characters(\n); this.contentHandler.startElement(, fruit, fruit, xspAttr); xspAttr.clear(); XSPObjectHelper.xspExpr(contentHandler, XSPRequestHelper.getSessionAttribute(objectModel, String.valueOf(fruit), )); this.contentHandler.endElement(, fruit, fruit); this.characters(\n ); this.contentHandler.endElement(, page, page); this.contentHandler.endPrefixMapping(xml); this.contentHandler.endPrefixMapping(xsp); this.contentHandler.endPrefixMapping(xsp-session); this.contentHandler.endDocument(); } } +-+ So as you can see from the above the only place it is possible creating the session variable is XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); And this is where the rogue semicolon appears. I can remove the rogue semicolon by creating the String Apple and reverencing that string through xsp:expr tags. But this leads to a nullPointerException. I think that either I am being really dim with this or some powers that I can't control are at work here! Thanks for everyone's help so far Tom Place - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp-session : Bug with Cocoon? or Bug with programmer?
Thanks for everyone's help with this. I was using cocoon 2.03 and when I downloaded a new copy, this bug seemed to disappear. Thanks anyway! Tom -Original Message- From: Geoff Howard [mailto:cocoongeoff;yahoo.com] Sent: 12 November 2002 15:46 To: [EMAIL PROTECTED] Subject: RE: xsp-session : Bug with Cocoon? or Bug with programmer? What version of cocoon are you using? Geoff --- Tom Place [EMAIL PROTECTED] wrote: After searching the created Java file (apologies for my earlier mistake), the request helper is the only place it could be trying to set the variable. For example the following XSP (entire file) : +-+ ?xml version=1.0? xsp:page xmlns:xsp=http://apache.org/xsp; xmlns:xsp-session=http://apache.org/xsp/session/2.0; create-session=true page xsp-session:set-attribute name=fruitApple/xsp-session:set-attribute fruitxsp-session:get-attribute name=fruit//fruit /page /xsp:page +-+ Generates the following Java +-+ public class test_xsp extends XSPGenerator { static { dateCreated = 1037088922427L; dependencies = new File[]{ }; } /* Built-in parameters available for use */ // context- ServletContext // request- HttpServletRequest // response - HttpServletResponse // parameters - parameters defined in the sitemap /* User Class Declarations */ /** * Generate XML data. */ public void generate() throws SAXException, IOException, ProcessingException { this.contentHandler.startDocument(); AttributesImpl xspAttr = new AttributesImpl(); this.contentHandler.startPrefixMapping(xml, http://www.w3.org/XML/1998/namespace;); this.contentHandler.startPrefixMapping(xsp, http://apache.org/xsp;); this.contentHandler.startPrefixMapping(xsp-session, http://apache.org/xsp/session/2.0;); this.contentHandler.startElement(, page, page, xspAttr); xspAttr.clear(); this.characters(\n); XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); this.characters(\n); this.contentHandler.startElement(, fruit, fruit, xspAttr); xspAttr.clear(); XSPObjectHelper.xspExpr(contentHandler, XSPRequestHelper.getSessionAttribute(objectModel, String.valueOf(fruit), )); this.contentHandler.endElement(, fruit, fruit); this.characters(\n ); this.contentHandler.endElement(, page, page); this.contentHandler.endPrefixMapping(xml); this.contentHandler.endPrefixMapping(xsp); this.contentHandler.endPrefixMapping(xsp-session); this.contentHandler.endDocument(); } } +-+ So as you can see from the above the only place it is possible creating the session variable is XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(fruit), this.characters(Apple); ); And this is where the rogue semicolon appears. I can remove the rogue semicolon by creating the String Apple and reverencing that string through xsp:expr tags. But this leads to a nullPointerException. I think that either I am being really dim with this or some powers that I can't control are at work here! Thanks for everyone's help so far Tom Place - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp-session : Bug with Cocoon? or Bug with programmer?
xsp-session:set-attributename=fruitApple/xsp-session:set-attribute ^ It looks to me like a misplaced . You are attempting to evaluate (name=fruit Apple) or some such. HTH, Mark. -Original Message- From: Tom Place [mailto:trp99c;cs.nott.ac.uk] Sent: Tuesday, 12 November 2002 7:49 To: [EMAIL PROTECTED] Subject: xsp-session : Bug with Cocoon? or Bug with programmer? Hi All, I emailed recently about a problem using session variables in cocoon (this was solved by the modifying of config.xconf - thanks to Sylvain Wallez). Now the problem I have is the following line in XSP : generates the following JSP : XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(verified), this.characters(False); ); Now I'm sure most of you will be able to spot a miss-placed semicolon after the (False) which gives me a compilation error. However if I put the following XSP in it seams to cure this : String myParam = Apple; xsp-session:set-attributename=fruitxsp:exprmyParam/xsp :expr/xs p-session:set-attribute I get correct JSP generated (at that point anyway). However I still get a NullPointerException. This originates at org.apache.cocoon.components.language.markup.xsp.XSPRequestHel per.setSes sionAttribute(XSPRequestHelper.java:454) Anyone come across this before? I am using Cocoon 2.03 running on Tomcat 4.1.12 Cheers Tom Place - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp-session : Bug with Cocoon? or Bug with programmer?
My apologies. I made a typo on this message (not in cocoon). The line should have read xsp-session:set-attribute name=fruitApple/xsp-session:set-attribute I have included me original message below (with correction) Hi All, I emailed recently about a problem using session variables in cocoon (this was solved by the modifying of config.xconf - thanks to Sylvain Wallez). Now the problem I have is the following line in XSP : generates the following JSP : XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(verified), this.characters(False); ); Now I'm sure most of you will be able to spot a miss-placed semicolon after the (False) which gives me a compilation error. However if I put the following XSP in it seams to cure this : String myParam = Apple; xsp-session:set-attributename=fruitxsp:exprmyParam/xsp :expr/xs p-session:set-attribute I get correct JSP generated (at that point anyway). However I still get a NullPointerException. This originates at org.apache.cocoon.components.language.markup.xsp.XSPRequestHel per.setSes sionAttribute(XSPRequestHelper.java:454) Anyone come across this before? I am using Cocoon 2.03 running on Tomcat 4.1.12 Cheers Tom Place - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp-session : Bug with Cocoon? or Bug with programmer?
Are you sure you're looking at the right section of your xsp? The section you've quoted doesn't match, making it most likely that something else in your xsp is causing the problem. Search for fruit in the generated java file you've been looking at - you should find something almost identical to: session.setAttribute(String.valueOf(fruit),Apple); XSPRequestHelper should never enter the picture. By the way, the XSP creates a java file to be compiled, not JSP. Geoff Howard --- Tom Place [EMAIL PROTECTED] wrote: My apologies. I made a typo on this message (not in cocoon). The line should have read xsp-session:set-attribute name=fruitApple/xsp-session:set-attribute I have included me original message below (with correction) Hi All, I emailed recently about a problem using session variables in cocoon (this was solved by the modifying of config.xconf - thanks to Sylvain Wallez). Now the problem I have is the following line in XSP : generates the following JSP : XSPRequestHelper.setSessionAttribute(objectModel, String.valueOf(verified), this.characters(False); ); Now I'm sure most of you will be able to spot a miss-placed semicolon after the (False) which gives me a compilation error. However if I put the following XSP in it seams to cure this : String myParam = Apple; xsp-session:set-attributename=fruitxsp:exprmyParam/xsp :expr/xs p-session:set-attribute I get correct JSP generated (at that point anyway). However I still get a NullPointerException. This originates at org.apache.cocoon.components.language.markup.xsp.XSPRequestHel per.setSes sionAttribute(XSPRequestHelper.java:454) Anyone come across this before? I am using Cocoon 2.03 running on Tomcat 4.1.12 Cheers Tom Place - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Auth-Framework] Using xsp-session and session namespaces
Hi, you can put the session transformer in your pipeline behind your serverpages generator - but then you don't have access to the authentication information in your xsp. If you need this, you have to write your own logicsheet for the authentication framework. In this logicsheet you can embed any java. What you have to do then is to lookup a session manager component and can invoke according methods to get the information. HTH Carsten -Original Message- From: Antonio Gallardo Rivera [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 24, 2002 7:11 PM To: [EMAIL PROTECTED] Subject: [Auth-Framework] Using xsp-session and session namespaces Hi folks! Please, can someone help me with this. Is possible to use auth-framework with xsp? I am trying to make the interface to let user changes his own password. The problem is that I cannot use xsp to retrieve data using: session:getxml context=authentication path=/authentication/ID/ or xsp-session:getxml context=authentication path=/authentication/ID/ How I can do? Thanks, in advance. Antonio Gallardo. - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Auth-Framework] Using xsp-session and session namespaces
Thanks Carsten after thinking about that all the afternoon and half of the night fighting with the 2 pipelines (curently 1:00 a.m here). I comes to the same place .( I need a logicsheet since I am working with XSP. I am trying to working on this logicsheet since 9:00 p.m. BTW, I think many people using XSP (like me) need this logicshhet. I thinked about to write it and (if you want) built-in into Cocoon like an standard logicsheet that will do the same work as the well knowed session:getxml. What about that? My main problem is how to get the SessionContext from Java in a xsl from scratch. I am reading and reading the Cocoon API. Now I know the packages are the: org.apache.cocoon.webapps.authentication org.apache.cocoon.webapps.authentication.acting org.apache.cocoon.webapps.authentication.components org.apache.cocoon.webapps.authentication.context org.apache.cocoon.webapps.authentication.generation org.apache.cocoon.webapps.authentication.selection and maybe more, who knows I am also going into and trying to understand the Cocoon Java code and trying to write it. But I dont know how. Anyway I am a very hardhead ;) I will try until I will get this, because I need it to check the permission of the user for more than 120 pages. Its a database application in Cocoon. Also it can help me to change password, etc. Maybe this can be my mastering in Cocoon! Who knows :) I know you are very busy, but can you help me a little more just some tips, please. Thanks in advance, Antonio Gallardo El Miércoles, 25 de Septiembre de 2002 00:50, Carsten Ziegeler escribió: Hi, you can put the session transformer in your pipeline behind your serverpages generator - but then you don't have access to the authentication information in your xsp. If you need this, you have to write your own logicsheet for the authentication framework. In this logicsheet you can embed any java. What you have to do then is to lookup a session manager component and can invoke according methods to get the information. HTH Carsten -Original Message- From: Antonio Gallardo Rivera [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 24, 2002 7:11 PM To: [EMAIL PROTECTED] Subject: [Auth-Framework] Using xsp-session and session namespaces Hi folks! Please, can someone help me with this. Is possible to use auth-framework with xsp? I am trying to make the interface to let user changes his own password. The problem is that I cannot use xsp to retrieve data using: session:getxml context=authentication path=/authentication/ID/ or xsp-session:getxml context=authentication path=/authentication/ID/ How I can do? Thanks, in advance. Antonio Gallardo. - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Auth-Framework] Using xsp-session and session namespaces
Hi folks! Please, can someone help me with this. Is possible to use auth-framework with xsp? I am trying to make the interface to let user changes his own password. The problem is that I cannot use xsp to retrieve data using: session:getxml context=authentication path=/authentication/ID/ or xsp-session:getxml context=authentication path=/authentication/ID/ How I can do? Thanks, in advance. Antonio Gallardo. - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Auth-Framework] Diference between xsp-session and session
Can someone explain what is the diference between xsp-session and session? I am trying to do this. But does not work: xsp:page xmlns:xsp-session=http://apache.org/xsp/session/2.0; xmlns:xsp=http://apache.org/xsp; document xsp-session:getxml context=authentication path=/authentication/data/full_name/ /document /xsp:page My main development is using XSP and I cannot get the authentication data in anyway. I need to use then: xsp:page xmlns:session=http://cocoon.apache.org/session/1.0; xmlns:xsp=http://apache.org/xsp; Then after generate a servepage, I need to do a transformation to make work the session name space. All this works fine. But when I need to use esql. This all the stuf is broken. The serverpages is generated first and then he cannot use session:getxml context=authentication path=/authentication/data/full_name/ to filter the result of a query. What can I do? Thanks, in advance. Antonio Gallardo. - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
difference between xsp-session and session
Hi, I was browsing Cocoon documentation and wondered what the difference in use and definition was between using xmlns:session=http://apache.org/xsp/session/2.0; and xmlns:xsp-session=http://apache.org/xsp/session/2.0; and also referencing it in code as session:get-attribute name=somename/ or xsp-session:get-attribute name=somename/ Examples are shown at http://xml.apache.org/cocoon/userdocs/xsp/sessions.html Yet the second to last example at : http://xml.apache.org/cocoon/userdocs/xsp/session.html uses xmlns:session=http://apache.org/xsp/session/2.0; yet references it using xsp-session ?xml version=1.0 encoding=iso-8859-1? xsp:page language=java xmlns:xsp=http://apache.org/xsp; xmlns:session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; para Session ID = xsp-session:get-id as=xml/ /para /xsp:page Thanks, Geert - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: difference between xsp-session and session
From: Geert Poels [mailto:[EMAIL PROTECTED]] Hi, I was browsing Cocoon documentation and wondered what the difference in use and definition was between using xmlns:session=http://apache.org/xsp/session/2.0; and xmlns:xsp-session=http://apache.org/xsp/session/2.0; There is no difference as long as the namespace URI is the same. The namespace prefix is just a short name for the namespace URI. and also referencing it in code as session:get-attribute name=somename/ or xsp-session:get-attribute name=somename/ You can declare either prefix. As for the documentation, thanks for reporting, it should be fixed. -- Konstantin Examples are shown at http://xml.apache.org/cocoon/userdocs/xsp/sessions.html Yet the second to last example at : http://xml.apache.org/cocoon/userdocs/xsp/session.html uses xmlns:session=http://apache.org/xsp/session/2.0; yet references it using xsp-session ?xml version=1.0 encoding=iso-8859-1? xsp:page language=java xmlns:xsp=http://apache.org/xsp; xmlns:session=http://apache.org/xsp/session/2.0; xmlns:xsp-request=http://apache.org/xsp/request/2.0; para Session ID = xsp-session:get-id as=xml/ /para /xsp:page Thanks, Geert - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: difference between xsp-session and session
xmlns:xsp-session=http://apache.org/xsp/session/2.0; There is no difference as long as the namespace URI is the same. The namespace prefix is just a short name for the namespace URI. That's what I assumed at first, but as one example showed otherwise. ** How about the necessity of create-session=true ? ** How can I use the session- or request-object within a xsp:logic Like in : xsp:logic boolean isTrue() { boolean result = false; String language = (String)session:get-attribute name=somename/; or (String) session.getAttribute(somename); return ; } xsp:logic This give me a compilation-error because no object session can be found. This method gets compiled as class-method but as session is not defined globally, this doesn't get compiled. - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faq/index.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: xsp-session ns calls element creation funcs?
Hi, I had the same problem with esql in a Dynamic XSLT using XSP. There was no solution found or given, so I made a workaround and skipped the logic sheet and did everything straight in Java. I too find the behavior very strange and would rather see this solved. It would open a lot of possibilities in XSP. Bert At 19:20 14/05/2002 -0500, you wrote: C2 doesn't seem to be behaving as expected...my code looks just like the examples. Any ideas? I'm sure it's something obvious. Okay, so apparently this: String userID = xsp-session:get-attribute name=malin-uid/; Generates into this (and, obviously, generates some errors): String userID = xspAttr.addAttribute( , name, name, CDATA, malin-uid ); this.contentHandler.startElement( http://apache.org/session/2.0;, get-attribute, xsp-session:get-attribute, xspAttr ); xspAttr.clear(); this.contentHandler.endElement( http://apache.org/session/2.0;, get-attribute, xsp-session:get-attribute ); ; TIA, Zack - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faqs.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faqs.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: xsp-session ns calls element creation funcs?
From: Zack Angelo [mailto:[EMAIL PROTECTED]] C2 doesn't seem to be behaving as expected...my code looks just like the examples. Any ideas? I'm sure it's something obvious. Okay, so apparently this: String userID = xsp-session:get-attribute name=malin-uid/; Do you have xsp-session namespace declared? xmlns:xsp-session=http://apache.org/xsp/session/2.0; Vadim Generates into this (and, obviously, generates some errors): String userID = xspAttr.addAttribute( , name, name, CDATA, malin-uid ); this.contentHandler.startElement( http://apache.org/session/2.0;, get-attribute, xsp-session:get-attribute, xspAttr ); xspAttr.clear(); this.contentHandler.endElement( http://apache.org/session/2.0;, get-attribute, xsp-session:get-attribute ); ; TIA, Zack - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faqs.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
xsp-session ns calls element creation funcs?
C2 doesn't seem to be behaving as expected...my code looks just like the examples. Any ideas? I'm sure it's something obvious. Okay, so apparently this: String userID = xsp-session:get-attribute name=malin-uid/; Generates into this (and, obviously, generates some errors): String userID = xspAttr.addAttribute( , name, name, CDATA, malin-uid ); this.contentHandler.startElement( http://apache.org/session/2.0;, get-attribute, xsp-session:get-attribute, xspAttr ); xspAttr.clear(); this.contentHandler.endElement( http://apache.org/session/2.0;, get-attribute, xsp-session:get-attribute ); ; TIA, Zack - Please check that your question has not already been answered in the FAQ before posting. http://xml.apache.org/cocoon/faqs.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]