Re: Getting access to jData through AJAX
Richard Gate <[email protected]>
| Newsgroups | gmane.comp.cms.jahia.template |
|---|---|
| Message-ID | <[email protected]> |
Basically I have several container lists - and lists within lists that have numbers that need calculated based on whether certain boolean fields (also contained in these containers) are true. I want this calculation done every time the user selects a check box or drop down on the screen that effects the calculation. I could of course at JSP time send down all the data the javascript will need and do the calculation client side. The problem is I already have the calculation method in the back end and would prefer to use this rather than a replicated javascript version. That way I am only maintaining one piece of code. I also don't have to send down a large amount of JAVAScript to the page. This is where I figured AJAX could help. I've noticed in the Jahia code base they use Struts actions and are able to get the ProcessingContext and thus JahiaData inside AjaxAction.java. My concern is that I don't really consider these the struts actions. I was going to create my own class which didnt inherit from Action but I've noticed a call to getServlet which is inherited from inside struts. Thus without using this method currently employed by Jahia's codebase I don't see how I can gain access to JahiaData. I don't really want to use the struts actions methology because I don't like the idea of one class having one purpose - ie the execute method. Instead I would like to create one class to act as an AJAX interface to several of my methods on the back end. With the current situation this would require a) seperate classes for each method call I want to use or b) a parameter which customises which part of the execute method which gets called. Neither a) or b) appeal to me. Thanks, Richard. dominique (joe) pillot wrote: > hi richard, > > i'm not very sure to understand why you need to make an ajax call to > calculate sum's result from différent container lists. > > i presume you can obtain this within a scriptlet using the jahia api > with the methods like getContainerList and getAbsoluteContainerlist, > and iterate through all these containers(and fields's values?) and > make your computing processes as u need? > > for your 2nd question, there is no simple way to transfer from > javascript a java object (like jData). > Usually, in an ajax requests, you can send only unique references or > ids as parameter. > this way, server-side, the class in charge, can get the object(s) and > respond successfully to the request. > > joe pillot > jahia.com > > Le 12 févr. 07 à 17:56, Richard Gate a écrit : > >> Hi all, >> >> I have an AJAX method that runs through some containers lists and >> calculates totals. I need jData to make the getAbsoluteContainerList >> call. >> >> I can access the jData object through <%=jData%> from inside the JSP. >> I want to pass this to my AJAX method but i'm not even sure if thats >> possible. >> >> Alternatively I would like to get the jData object from within my >> class. I don't have access to ProcessingContext from here. Is this >> possible? >> >> Thanks, >> >> Richard. >> >> -- >> Richard Gate >> Developer >> >> >> Souk Digital >> A Souk Group Company. >> >> London Office >> 1st Floor, >> Shaftesbury House, >> 151 Shaftesbury Avenue, >> London WC2H 8AL >> Tel: +44 (0) 20 7420 7880 >> >> Nottingham Office >> High Pavement Business Centre, >> 3-5 High Pavement, >> The Lace Market, >> Nottingham. >> NG1 1HF >> Tel: +44 (0) 115 959 6455 >> Fax: +44 (0) 115 959 6456 >> >> www.soukdigital.com >> >> Confidentiality: This e-mail and its attachments are intended for the >> above named only and may be confidential. If they have come to you in >> error you must take no action based on them, nor must you copy or >> show them to anyone; please reply to this e-mail and highlight the error. >> >> Security Warning: Please note that this e-mail has been created in >> the knowledge that Internet e-mail is not a 100% secure >> communications medium. We advise that you understand and observe this >> lack of security when e-mailing us. >> >> Viruses: Although we have taken steps to ensure that this e-mail and >> attachments are free from any virus, we advise that in keeping with >> good computing practice the recipient should ensure they are actually >> virus free. >> >> >> >> >> From - Thu Oct 19 11:47:14 2006 >> X-Account-Key: account2 >> X-UIDL: A"Z!!afc!!=8'#!7b'"! >> X-Mozilla-Status: 0009 >> X-Mozilla-Status2: 00000000 >> Return-Path: >> <developers-return-443-richard.gate=soukdigital.com@choosemcs.co.uk >> <mailto:[email protected]>> >> Delivered-To: [email protected] >> <mailto:[email protected]> >> Received: (qmail 7867 invoked by alias); 19 Oct 2006 10:42:50 -0000 >> Mailing-List: contact [email protected] >> <mailto:[email protected]>; run by ezmlm >> Precedence: bulk >> X-No-Archive: yes >> Delivered-To: mailing list [email protected] >> <mailto:[email protected]> >> Received: (qmail 7863 invoked from network); 19 Oct 2006 10:42:49 -0000 >> Message-ID: <[email protected] >> <mailto:[email protected]>> >> Date: Thu, 19 Oct 2006 11:45:51 +0100 >> From: Nat Titman <[email protected] >> <mailto:[email protected]>> >> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; >> rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666 >> MIME-Version: 1.0 >> To: [email protected] <mailto:[email protected]> >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >> Content-Transfer-Encoding: 7bit >> Subject: [developers] Useful articles on accessibility and testing >> X-UIDL: A"Z!!afc!!=8'#!7b'"! >> >> Hi, >> >> A couple of useful articles. >> >> Accessibility for the Apathetic: >> >> http://www.hacknot.info/hacknot/action/showEntry?eid=69 >> >> Testing: >> >> http://www.hacknot.info/hacknot/action/showEntry?eid=68 >> >> Thanks, >> >> >> Nat. >> >> -- >> Nat Titman >> Senior Developer >> >> SOUK Digital >> A SOUK Group Company. >> >> http://www.soukdigital.com/ >> >> Nottingham Office >> High Pavement Business Centre, >> 3-5 High Pavement, >> The Lace Market, >> Nottingham. >> NG1 1HF >> Tel: +44 (0) 115 959 6455 >> Fax: +44 (0) 115 959 6456 >> Direct: +44 (0) 115 959 6462 >> >> London Office >> 1st Floor, >> Shaftesbury House, >> 151 Shaftesbury Avenue, >> London WC2H 8AL >> Tel: +44 (0) 20 7420 7880 >> >> Confidentiality: This e-mail and its attachments are intended for >> the above named only and may be confidential. If they have come >> to you in error you must take no action based on them, nor must >> you copy or show them to anyone; please reply to this e-mail and >> highlight the error. >> >> Security Warning: Please note that this e-mail has been created >> in the knowledge that Internet e-mail is not a 100% secure >> communications medium. We advise that you understand and observe >> this lack of security when e-mailing us. >> >> Viruses: Although we have taken steps to ensure that this e-mail >> and attachments are free from any virus, we advise that in keeping >> with good computing practice the recipient should ensure they are >> actually virus free. >> >> >> >> >> >> > > dominique (joe) pillot > Jahia Solutions France > portable: 0663543179 > bureau: 0153546968 > > > -- Richard Gate Developer Souk Digital A Souk Group Company. London Office 1st Floor, Shaftesbury House, 151 Shaftesbury Avenue, London WC2H 8AL Tel: +44 (0) 20 7420 7880 Nottingham Office High Pavement Business Centre, 3-5 High Pavement, The Lace Market, Nottingham. NG1 1HF Tel: +44 (0) 115 959 6455 Fax: +44 (0) 115 959 6456 www.soukdigital.com Confidentiality: This e-mail and its attachments are intended for the above named only and may be confidential. If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e-mail and highlight the error. Security Warning: Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. We advise that you understand and observe this lack of security when e-mailing us. Viruses: Although we have taken steps to ensure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. From - Thu Oct 19 11:47:14 2006 X-Account-Key: account2 X-UIDL: A"Z!!afc!!=8'#!7b'"! X-Mozilla-Status: 0009 X-Mozilla-Status2: 00000000 Return-Path: <developers-return-443-richard.gate=soukdigital.com@choosemcs.co.uk> Delivered-To: [email protected] Received: (qmail 7867 invoked by alias); 19 Oct 2006 10:42:50 -0000 Mailing-List: contact [email protected]; run by ezmlm Precedence: bulk X-No-Archive: yes Delivered-To: mailing list [email protected] Received: (qmail 7863 invoked from network); 19 Oct 2006 10:42:49 -0000 Message-ID: <[email protected]> Date: Thu, 19 Oct 2006 11:45:51 +0100 From: Nat Titman <[email protected]> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: [email protected] Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [developers] Useful articles on accessibility and testing X-UIDL: A"Z!!afc!!=8'#!7b'"! Hi, A couple of useful articles. Accessibility for the Apathetic: http://www.hacknot.info/hacknot/action/showEntry?eid=69 Testing: http://www.hacknot.info/hacknot/action/showEntry?eid=68 Thanks, Nat. -- Nat Titman Senior Developer SOUK Digital A SOUK Group Company. http://www.soukdigital.com/ Nottingham Office High Pavement Business Centre, 3-5 High Pavement, The Lace Market, Nottingham. NG1 1HF Tel: +44 (0) 115 959 6455 Fax: +44 (0) 115 959 6456 Direct: +44 (0) 115 959 6462 London Office 1st Floor, Shaftesbury House, 151 Shaftesbury Avenue, London WC2H 8AL Tel: +44 (0) 20 7420 7880 Confidentiality: This e-mail and its attachments are intended for the above named only and may be confidential. If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e-mail and highlight the error. Security Warning: Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. We advise that you understand and observe this lack of security when e-mailing us. Viruses: Although we have taken steps to ensure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free.