cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lionel Crine <cr...@4dconcept.fr>
Subject Re: XSP : get and modify URL
Date Wed, 30 Apr 2003 10:26:03 GMT
The URL parameter is coming from an XML file ?

for example : <url>new_page?myID=5</url>
or <url>new_page</url> and he parameter is appending after.


Here is how I get the url parameters to create a new URL with an XSP :

<xsp:page xmlns:xsp="http://apache.org/xsp"
           xmlns:xsp-request="http://apache.org/xsp/request/2.0"
           xmlns:xsp-session="http://apache.org/xsp/session/2.0"
           create-session="true">

<xsp:structure>
   <xsp:include>java.util.Enumeration</xsp:include>
   <xsp:include>java.util.Vector</xsp:include>
   <xsp:include>java.lang.*</xsp:include>
   <xsp:include>java.lang.String.*</xsp:include>
   <xsp:include>java.lang.Byte.*</xsp:include>
</xsp:structure>

<page>

<xsp:logic>
Enumeration enum = request.getParameterNames();
Vector tempVector = new Vector();
         while (enum.hasMoreElements()) {
                 tempVector.add(enum.nextElement());
         }
Vector values = new Vector(tempVector.size());

for (int i = 0; i  &lt; tempVector.size(); i++) {


  values.addElement(request.getParameter((String) tempVector.elementAt(i)));
}
</xsp:logic>

   <content>
         <link>search?<xsp:logic>for(int i=0;i &lt; 
values.size();i++){</xsp:logic><xsp:expr>(String)tempVector.elementAt(i)</xsp:expr>=<xsp:expr>(String)values.elementAt(i)</xsp:expr><xsp:logic>if(i

&lt; values.size()-1){</xsp:logic>&amp;<xsp:logic>}}</xsp:logic>
         </link>
   </content>
  </page>
</xsp:page>


But this XSP create an new URL. the thing is that you want to get the url 
dynamically like in an xsl.


You may also create an xsl stylesheet and put some xsp tag in it.

Anyway, I hope my example can give you some hints.

Lionel





At 11:45 30/04/2003 +0200, you wrote:
>Hi,
>On a page I have a URL like : new_page?myID=5
>and I want to have an href with -> new_page.beta?myID=5
>
>How can I do this???
>
>Thanks a lot
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org


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


Mime
View raw message