You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jarry Liu <ja...@gmail.com> on 2005/04/08 20:18:12 UTC

How can I put this java variable to xml attribute?

Hi, everyone,

I use xsp get the values of two strings? How can I use these variables
in the xml form. My code is as following. Thanks for your kind help.

Jarry


...
<xsp:logic>
     int i;
     int num = 1;   

     String col = <xsp-request:get-parameter name="dcol"/>;
     String filesname = <xsp-request:get-parameter name ="input"/>;
     
     <!-- the filename contains several files, and looks like
[sample1.xml, sample2.xml] -->
     String fname = filesname.substring(1,filesname.length()-1);
            
     StringTokenizer tk = new StringTokenizer( fname, ",");
     String file=""; 
    
     while( tk.hasMoreTokens())
     {
       file = tk.nextToken();

       <!-- Here I can get right result -->
              <col-name> <xsp:expr>col</xsp:expr> </col-name>;
            <file-name> <xsp:expr> file</xsp:expr></file-name>;
       
       <!-- How can I pass the the variable to following form in
collection and oid respectly? -->
       <p><form method = "post" action="">
             <textarea cols="50" rows="5" style="font-family:Verdana;
font-weight:bold" READONLY="true">
                       <db:query type="delete" collection="   ??????? 
#{col}" oid= "????????#{file}" />
             </textarea>      
       </form> </p>
     }      
</xsp:logic>
...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How can I put this java variable to xml attribute?

Posted by Jarry Liu <ja...@gmail.com>.
Carlos,

Thanks so much. I got it. 
Here is my code:

<db:query type="delete">
	<xsp:attribute name = "collection"><xsp:expr>col</xsp:expr></xsp:attribute>
	<xsp:attribute name = "oid"><xsp:expr>file</xsp:expr></xsp:attribute> 
</db:query>

Jarry




On Apr 8, 2005 2:40 PM, Carlos Chávez <cc...@agssa.net> wrote:
> 
> Jarry Liu Escribio :-)
> > Hi, everyone,
> >
> > I use xsp get the values of two strings? How can I use these variables
> > in the xml form. My code is as following. Thanks for your kind help.
> >
> > Jarry
> >
> >
> > ...
> > <xsp:logic>
> >      int i;
> >      int num = 1;
> >
> >      String col = <xsp-request:get-parameter name="dcol"/>;
> >      String filesname = <xsp-request:get-parameter name ="input"/>;
> >
> >      <!-- the filename contains several files, and looks like
> > [sample1.xml, sample2.xml] -->
> >      String fname = filesname.substring(1,filesname.length()-1);
> >
> >      StringTokenizer tk = new StringTokenizer( fname, ",");
> >      String file="";
> >
> >      while( tk.hasMoreTokens())
> >      {
> >        file = tk.nextToken();
> >
> >        <!-- Here I can get right result -->
> >               <col-name> <xsp:expr>col</xsp:expr> </col-name>;
> >             <file-name> <xsp:expr> file</xsp:expr></file-name>;
> >
> >        <!-- How can I pass the the variable to following form in
> > collection and oid respectly? -->
> >        <p><form method = "post" action="">
> >              <textarea cols="50" rows="5" style="font-family:Verdana;
> > font-weight:bold" READONLY="true">
> >                        <db:query type="delete" collection="   ???????
> > #{col}" oid= "????????#{file}" />
> 
>   Hi.
>   I think you can use the tag <xsp:attribute name="value"/>
>   for example:
> 
>   <db:query type="delete">
>       <xsp:attribute name="collection"> here put the value </xsp:attribute>
>       <xsp:attribute name="oid"> here put the value </xsp:attribute>
>   </db:query>
> 
>   Cheers.
>   Carlos Chávez.
> 
> 
> >              </textarea>
> >        </form> </p>
> >      }
> > </xsp:logic>
> > ...
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> 
> --
> Carlos Chávez
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How can I put this java variable to xml attribute?

Posted by Carlos Chávez <cc...@agssa.net>.
Jarry Liu Escribio :-)
> Hi, everyone,
>
> I use xsp get the values of two strings? How can I use these variables
> in the xml form. My code is as following. Thanks for your kind help.
>
> Jarry
>
>
> ...
> <xsp:logic>
>      int i;
>      int num = 1;
>
>      String col = <xsp-request:get-parameter name="dcol"/>;
>      String filesname = <xsp-request:get-parameter name ="input"/>;
>
>      <!-- the filename contains several files, and looks like
> [sample1.xml, sample2.xml] -->
>      String fname = filesname.substring(1,filesname.length()-1);
>
>      StringTokenizer tk = new StringTokenizer( fname, ",");
>      String file="";
>
>      while( tk.hasMoreTokens())
>      {
>        file = tk.nextToken();
>
>        <!-- Here I can get right result -->
>               <col-name> <xsp:expr>col</xsp:expr> </col-name>;
>             <file-name> <xsp:expr> file</xsp:expr></file-name>;
>
>        <!-- How can I pass the the variable to following form in
> collection and oid respectly? -->
>        <p><form method = "post" action="">
>              <textarea cols="50" rows="5" style="font-family:Verdana;
> font-weight:bold" READONLY="true">
>                        <db:query type="delete" collection="   ???????
> #{col}" oid= "????????#{file}" />

  Hi.
  I think you can use the tag <xsp:attribute name="value"/>
  for example:

  <db:query type="delete">
      <xsp:attribute name="collection"> here put the value </xsp:attribute>
      <xsp:attribute name="oid"> here put the value </xsp:attribute>
  </db:query>

  Cheers.
  Carlos Chávez.


>              </textarea>
>        </form> </p>
>      }
> </xsp:logic>
> ...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


-- 
Carlos Chávez

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org