You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by MAHE Vincent FTRD/DIH/REN <vi...@rd.francetelecom.fr> on 2000/09/26 15:51:39 UTC

Insert a new node between two old nodes

I want to design a web site where a user can insert a new object inside a
list of objects at a given position in the list.
The user enters a list of items in a <form> (name of the object, it price,
...) and when it submits this form I want to update an XML file containing
the whole list of objects.
 
Is it possible to do it with XSP ?
Something like this but the problem here is that I don't know the position
of my new node until the user as validated the form to give it to me :
 
 
<xsp:page 
  language="java" 
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>
 
<objects>
  <object>
     <name>Knife</name>
     <price>10</price>
  </object>
  <object>
    <xsp:logic>
      InsertNewObject() 
      {
        ...
     }
    </xsp:logic>
  </object>
  <object>
     <name>Fork</name>
     <price>15</price>
   </object>
 </objects>
</xsp:page>
 
 
Is it possible to modify the content of another XML file with XSP than the
XSP file itself ?
 
 
Vincent Mahé
 

Mixing taglibs

Posted by Mats Norén <ma...@spectral.se>.
So if I want to mix two taglibs populate a form from a database and then save the
changes back to db...do I have to use the sql-processor and then use the xsp-processor
after...or the other way around ?

/regards Mats

Re: FP Taglib + New Taglib question

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 17:03 +0100 28/09/00, Mats Norén wrote:
>
>Ahh, I made a mistake and didn't include the esql-taglib properly..after
>doing that
>it didn't compile.
>Okey, so basically I have to find a workaround instead of mixing the two ?

Ideally you should be able to mix the two.

1. The version of FP that you are using is flawed in various ways, I am
working on the upgrade which is a complete rewrite.

2. Donald and I use completely different techniques for writing TagLibs.

3. We have never had the time to ensure they work together.


Early days I am afraid .....

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: FP Taglib + New Taglib question

Posted by Mats Norén <ma...@spectral.se>.
Ahh, I made a mistake and didn't include the esql-taglib properly..after doing that
it didn't compile.
Okey, so basically I have to find a workaround instead of mixing the two ?

/Mats

Jeremy Quinn wrote:

> At 16:43 +0100 28/09/00, Mats Norén wrote:
> >
> >Yep, that was the problem. Thanks!
> >Another question ?
> >If I mix two taglibs on the same page...like for instance fp with esql the
> >esql-tags doesn't execute..
> >Example:
>
> This is a really complicated issue.
> We are not necessarily writing TagLibs to co-exist at the moment.
> We are still learning the issues ....
>
> Does this XSP page compile properly?
>
> Can you work out from the Source code of your compiled XSP what is going wrong?
>
> regards Jeremy
> --
>    ___________________________________________________________________
>
>    Jeremy Quinn                                           Karma Divers
>                                                        webSpace Design
>                                             HyperMedia Research Centre
>
>    <ma...@mac.com>                    <http://www.media.demon.co.uk>
>     <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Re: FP Taglib + New Taglib question

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 16:43 +0100 28/09/00, Mats Norén wrote:
>
>Yep, that was the problem. Thanks!
>Another question ?
>If I mix two taglibs on the same page...like for instance fp with esql the
>esql-tags doesn't execute..
>Example:

This is a really complicated issue.
We are not necessarily writing TagLibs to co-exist at the moment.
We are still learning the issues ....

Does this XSP page compile properly?

Can you work out from the Source code of your compiled XSP what is going wrong?

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: FP Taglib + New Taglib question

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 28 Sep 2000, Mats [iso-8859-1] Nor�n wrote:

> Yep, that was the problem. Thanks!
> Another question ?
> If I mix two taglibs on the same page...like for instance fp with esql the
> esql-tags doesn't execute..
> Any suggestions what went wrong here ?

yeah - your XML isn't well-formed.

- donald


Re: FP Taglib + New Taglib question

Posted by Mats Norén <ma...@spectral.se>.
Yep, that was the problem. Thanks!
Another question ?
If I mix two taglibs on the same page...like for instance fp with esql the
esql-tags doesn't execute..
Example:

<?xml version="1.0"?>
<!-- Written by Mats Noren "mats.noren@spectral.se" -->
<?cocoon-process type="xsp"?>

<xsp:page
        xmlns:esql="http://apache.org/cocoon/SQL/v2"
        xmlns:fp="http://apache.org/cocoon/XSP/FP/1.0"
        xmlns:request="http://www.apache.org/1999/XSP/Request"
        xmlns:util="http://www.apache.org/1999/XSP/Util"
        xmlns:xsp="http://www.apache.org/1999/XSP/Core"
        language="java"
>

        <page>
        <fp:resource id="lang_strings">
                             <fp:resource-file>lang_strings.xml</fp:resource-file>

<fp:resource-node>defaults/form/page/item</fp:resource-node>
        </fp:resource>
        <esql:execute-query>
           <esql:driver>com.inet.tds.TdsDriver</esql:driver>
           <esql:dburl>jdbc:inetdae:xxx.xxx.xxx:1433?database=xxx</esql:dburl>
           <esql:username>xxx</esql:username>
           <esql:password>xxx</esql:password>
           <fp:if-get>
           <esql:query>select n.txt_title, n.txt_subtitle, n.news_id FROM news_tbl
n WHERE news_id=<request:get-parameter name="item"/></esql:query>
           <esql:results>
                          <form action="item.xml" method="POST">
                <input name="title">
                      <xsp:attribute name="label"><fp:read  select="title/label"
from="lang_strings"/></xsp:attribute>
                                <esql:get-string column="txt_title"/>
                </input>
                <input name="subtitle">
                      <xsp:attribute name="label"><fp:read  select="subtitle/label"
from="lang_strings"/></xsp:attribute>
                                <esql:get-string column="txt_subtitle"/>
                </input>
                <input name="body" type="textarea">
                        <xsp:attribute name="label"><fp:read select="body/label"
from="lang_strings"/></xsp:attribute>
                                <esql:get-xml column="txt"/>
                </input>
                <input name="item" type="hidden">
                        <value><request:get-parameter name="item"/></value>
                </input>
                <input name="submit" type="submit">
                        <xsp:attribute name="label"><fp:read select="submit/label"
from="lang_strings"/></xsp:attribute>
                                <fp:read select="submit/label"
from="lang_strings"/>
                </input>
             </form>
        </esql:results>
    <esql:error-results>
    <message><esql:get-message/></message>
    <stacktrace><esql:get-stacktrace/></stacktrace>
    </esql:error-results>
    </esql:execute-query>
    </fp:if-get>

    <fp:if-post>
           <dummy>Dummy-post...should make update query to DB</dummy>
           <title><request:get-parameter name="title"/></title>
           <subtitle><request:get-parameter name="subtitle"/></subtitle>
           <body><request:get-parameter name="body"/></body>
     </fp:if-post>

    </page>
</xsp:page>


Any suggestions what went wrong here ?

/regards Mats

Re: FP Taglib

Posted by "Sebastián Castro M." <sc...@ci.cl>.
Jeremy Quinn wrote:

> At 14:09 +0100 27/09/00, Mats Norén wrote:
> >I'm having problems with the fp-taglib example.
> >When trying to edit or add paragraphs...nothing happens...nothing at all.
> >I see the edit/add pages but when I try to save the changes they don't go
> >through...
> >Any ideas ?
>
> Sorry, I have no idea what is going wrong for you.
> Do other XSP pages in the cocoon/samples work OK?
>
> regards Jeremy
> --
>    ___________________________________________________________________

Hi Mats ... mmmm , if your working on a Unix box, check if the files write
permissions are ok, remember that the FP examples and also the whole cocoon
engine will run using same user as the Servlet container you're working with (I
mean, Jserv by example runs as "nobody" by default ...).
Hope it helps ...

salu2

Sebastián Castro M.

Re: FP Taglib

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 14:09 +0100 27/09/00, Mats Norén wrote:
>I'm having problems with the fp-taglib example.
>When trying to edit or add paragraphs...nothing happens...nothing at all.
>I see the edit/add pages but when I try to save the changes they don't go
>through...
>Any ideas ?

Sorry, I have no idea what is going wrong for you.
Do other XSP pages in the cocoon/samples work OK?

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

FP Taglib

Posted by Mats Norén <ma...@spectral.se>.
I'm having problems with the fp-taglib example.
When trying to edit or add paragraphs...nothing happens...nothing at all.
I see the edit/add pages but when I try to save the changes they don't go
through...
Any ideas ?

/Mats Norén