You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by tgarijo <tg...@clickonline.es> on 2010/11/04 17:57:46 UTC
How to I can do to capture the html code
Hi all
I am developing an application where a remote url call my url defined in my
sitemap. I will return it to the url a number of data and the url returns me
a html code. I develop with myeclipse and html code that it returned , is
printed in the console of my eclipse. How to I can do to capture the html
code that url send me and set up a web page?
Thank you
Sorry for my English.
--
View this message in context: http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30134015.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: How to I can do to capture the html code
Posted by tgarijo <tg...@clickonline.es>.
Hi Robby
Thank You
I do not see too clear what you tell me. I decided to do with the classic
servlet, but if you appreciate some explanation.
Regards
Robby Pelssers-3 wrote:
>
> Are you trying to extract data from a xhtml page returned by invoking a
> cgi script? At least that is the impression I get.
>
> Yikes... of course that is possible but in that case i would definitely
> choose to have the CGI script return an xml document instead of xhtml and
> use a xml schema to define what the xml content is supposed to look like.
>
> In that way you can easily extract the data in a meaningfull way by using
> xpath or xquery.
>
> Robby
>
>
> -----Oorspronkelijk bericht-----
> Van: tgarijo [mailto:tgarijo@clickonline.es]
> Verzonden: vr 5-11-2010 12:09
> Aan: users@cocoon.apache.org
> Onderwerp: RE: How to I can do to capture the html code
>
>
> Hi Robby nice to meet you.
>
> when i return the control program to
> es.clickonline.transformation.Transformer
> the remote gci return to me html code and printed in the console of my
> eclipse
>
>
> My code its the next
>
> Sitemap
>
> .
> .
> <map:transformer name="transformer"
> src="es.clickonline.transformation.Transformer"/>
> .
> .
> .
> <map:match pattern="ReciveData4B">
> <map:generate type="request"/>
> <map:transform src="./xslt/efacturaRequest.xsl"/>
> <map:transform type="transformer"/>
> <map:transform src="./xslt/efacturaPaymentResponse.xsl"/>
> <map:serialize type="text"/>
> </map:match>
>
> public Document setup(org.w3c.dom.Node node,
> org.apache.cocoon.environment.Session session) throws
> UnknownHostException,
> SQLException
> {
> String order = null;
> String store = null;
> Data data = null;
> Session sessioneFacturaResponse = null;
> boolean bGrabar = true;
> User user = null;
> String sCliente = null;
> String payment = null;
> String Session = null;
> String datos = null;
>
>
> EfacturaResponseDocument document;
> document = EfacturaResponseDocument.Factory.newInstance();
> EfacturaResponse efacturaResponse;
>
> // Create new invoicde document by xmlbeans
>
> efacturaResponse = document.addNewEfacturaResponse();
>
>
> sessioneFacturaResponse =
> efacturaResponse.addNewHead().addNewSession();
> sessioneFacturaResponse.setId(session.getId()) ;
>
> // Nueva Data
> data = efacturaResponse.addNewData();
>
>
> XmlCursor xmlcursor =data.newCursor();
> xmlcursor.toFirstContentToken();
>
>
> //This data its sending by cgi program from url
>
> order = getParametersDataOfRequest(node, "order");
> store= getParametersDataOfRequest(node, "store");
> payment= getParametersDataOfRequest(node, "payment");
>
>
>
> Session =String.copyValueOf(getParametersDataOfRequest(node,
> "order").toCharArray(),0,32);
>
> int tamaño = getParametersDataOfRequest(node,
> "order").length()-Session.length();
> order = String.copyValueOf(getParametersDataOfRequest(node,
> order").toCharArray(),32,tamaño-1);
> store = getParametersDataOfRequest(node, "store");
>
> driverDatabase drvDatabase = new driverDatabase();
>
> // Nos conectamos a la base de datos que corresponda
> drvDatabase.connectDatabases();
>
> String s_Sql = "Select * from ExContadorPayment where session = '" +
> Session + "' oRDER BY counter DESC" ;
>
> drvDatabase.generateSql(s_Sql)
>
> String rt = "\n";
>
> ResultSet rs = drvDatabase.getRs();
>
> Double Payment = Double.valueOf(rs.getString("payment"))*100;
>
> DecimalFormat df = new DecimalFormat("###");
>
> String importeTotal= "M978" + df.format(Payment);
> String numeroReg ="1";
> String referencia =rs.getString("order"); //"A2530";
> String unidades = "1";
> String Precio = df.format(Payment);
>
> ResultDocument docPaymentResponse;
>
> docPaymentResponse = ResultDocument.Factory.newInstance();
> es.clickonline.response.efacturaPaymentResponse.Result result;
> result=docPaymentResponse.addNewResult();
>
> XmlCursor xmlCursorResult = result.newCursor();
> es.clickonline.response.efacturaPaymentResponse.Data data1;
>
> data1= result.addNewData();
>
> // I return this data to url
>
> data1.setImporteTotal(importeTotal.toString());
> data1.setNumeroReg(numeroReg.toString());
> data1.setReferencia(referencia);
> data1.setUnidades(unidades);
> data1.setPrecio(Precio);
>
>
> xmlCursorResult.moveXml(xmlcursor);
> xmlcursor.dispose();
>
> System.out.println("datos" + "\n" + datos);
>
>
>
>
>
> // return control program to
> es.clickonline.transformation.Transformer
> return this.parseXmlStringReader(document.toString(),false);
>
> in this moment the remote url return html code and printed in myeclipse
> console. I need capture this html code and set up html page
> }
>
>
>
>
> Robby Pelssers-3 wrote:
>>
>> A vague question if you ask me...
>>
>> What version of cocoon are you using by the way? 2.2?
>>
>>
>> Let's assume you have one of 2 options below configured in your sitemap:
>>
>> <!-- option 1: using request parameters -->
>> <map:match pattern="mypage.html">
>> <map:call function="generateMyPage"/>
>> </map:match>
>>
>> <!-- option 2: using sitemap parameters -->
>> <map:match pattern="mypage/*">
>> <map:call function="generateMyPage">
>> <map:parameter name="id" value="{1}"/>
>> </map:call>
>> </map:match>
>>
>> You would invoke option 1 like:
>>
>> http://localhost:8080/mywebapp/myblock/mypage.html?id=1040
>>
>> option 2 can be invoked like:
>>
>> http://localhost:8080/mywebapp/myblock/mypage/1040
>>
>>
>> Now your flowscript controller
>>
>> option 1:
>>
>> function generateMyPage() {
>> var id = cocoon.request.getParameter("id");
>> //fetch additional data
>> var employees = cocooon.getComponent("dataSource").findById(id);
>> cocoon.sendPage(
>> "mypage2html",
>> {
>> "id": id, "employees ": employees
>> }
>> );
>> }
>>
>> option 2:
>>
>> function generateMyPage() {
>> var id = cocoon.parameters["id"];
>> //fetch additional data
>> var employees = cocooon.getComponent("dataSource").findById(id);
>> cocoon.sendPage(
>> "mypage2html",
>> {
>> "id": id, "employees ": employees
>> }
>> );
>> }
>>
>> So you will also need a jxtemplate to render you html:
>>
>> <map:match pattern="mypage2html">
>> <map:generate src="pages/mypage.jx" type="jx"/>
>> <map:serialize type="xhtml"/>
>> </map:match>
>>
>>
>> the template could look like:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <jx:template
>> xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
>> <html>
>> <head>
>> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"
>> />
>> <title>Some Title </title>
>> <link type="text/css" rel="stylesheet"
>> href="resource/external/css/styles.css"/>
>> </head>
>> <body>
>> You invoked page with id ${id}
>> <table>
>> <thead>
>> <tr>
>> <th>First Name</th>
>> <th>Last Name</th>
>> </tr>
>> </thead>
>> <tbody>
>> <jx:forEach var="employee" items="${employees}">
>> <tr>
>> <td>${employee.fName}</td>
>> <td>${employee.lName}</td>
>> </tr>
>> </jx:forEach>
>> </tbody>
>> </table>
>> </body>
>> </html>
>> </jx:template>
>>
>> So the result of invoking both URL's is an xhtml page.
>>
>> Robby
>> -----Oorspronkelijk bericht-----
>> Van: tgarijo [mailto:tgarijo@clickonline.es]
>> Verzonden: do 4-11-2010 17:57
>> Aan: users@cocoon.apache.org
>> Onderwerp: How to I can do to capture the html code
>>
>>
>> Hi all
>>
>> I am developing an application where a remote url call my url defined in
>> my
>> sitemap. I will return it to the url a number of data and the url returns
>> me
>> a html code. I develop with myeclipse and html code that it returned , is
>> printed in the console of my eclipse. How to I can do to capture the
>> html
>> code that url send me and set up a web page?
>>
>> Thank you
>>
>> Sorry for my English.
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30134015.html
>> Sent from the Cocoon - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
> --
> View this message in context:
> http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30140111.html
> Sent from the Cocoon - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
--
View this message in context: http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30178305.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: How to I can do to capture the html code
Posted by Robby Pelssers <ro...@ciber.com>.
Are you trying to extract data from a xhtml page returned by invoking a cgi script? At least that is the impression I get.
Yikes... of course that is possible but in that case i would definitely choose to have the CGI script return an xml document instead of xhtml and use a xml schema to define what the xml content is supposed to look like.
In that way you can easily extract the data in a meaningfull way by using xpath or xquery.
Robby
-----Oorspronkelijk bericht-----
Van: tgarijo [mailto:tgarijo@clickonline.es]
Verzonden: vr 5-11-2010 12:09
Aan: users@cocoon.apache.org
Onderwerp: RE: How to I can do to capture the html code
Hi Robby nice to meet you.
when i return the control program to
es.clickonline.transformation.Transformer
the remote gci return to me html code and printed in the console of my
eclipse
My code its the next
Sitemap
.
.
<map:transformer name="transformer"
src="es.clickonline.transformation.Transformer"/>
.
.
.
<map:match pattern="ReciveData4B">
<map:generate type="request"/>
<map:transform src="./xslt/efacturaRequest.xsl"/>
<map:transform type="transformer"/>
<map:transform src="./xslt/efacturaPaymentResponse.xsl"/>
<map:serialize type="text"/>
</map:match>
public Document setup(org.w3c.dom.Node node,
org.apache.cocoon.environment.Session session) throws UnknownHostException,
SQLException
{
String order = null;
String store = null;
Data data = null;
Session sessioneFacturaResponse = null;
boolean bGrabar = true;
User user = null;
String sCliente = null;
String payment = null;
String Session = null;
String datos = null;
EfacturaResponseDocument document;
document = EfacturaResponseDocument.Factory.newInstance();
EfacturaResponse efacturaResponse;
// Create new invoicde document by xmlbeans
efacturaResponse = document.addNewEfacturaResponse();
sessioneFacturaResponse = efacturaResponse.addNewHead().addNewSession();
sessioneFacturaResponse.setId(session.getId()) ;
// Nueva Data
data = efacturaResponse.addNewData();
XmlCursor xmlcursor =data.newCursor();
xmlcursor.toFirstContentToken();
//This data its sending by cgi program from url
order = getParametersDataOfRequest(node, "order");
store= getParametersDataOfRequest(node, "store");
payment= getParametersDataOfRequest(node, "payment");
Session =String.copyValueOf(getParametersDataOfRequest(node,
"order").toCharArray(),0,32);
int tamaño = getParametersDataOfRequest(node,
"order").length()-Session.length();
order = String.copyValueOf(getParametersDataOfRequest(node,
order").toCharArray(),32,tamaño-1);
store = getParametersDataOfRequest(node, "store");
driverDatabase drvDatabase = new driverDatabase();
// Nos conectamos a la base de datos que corresponda
drvDatabase.connectDatabases();
String s_Sql = "Select * from ExContadorPayment where session = '" +
Session + "' oRDER BY counter DESC" ;
drvDatabase.generateSql(s_Sql)
String rt = "\n";
ResultSet rs = drvDatabase.getRs();
Double Payment = Double.valueOf(rs.getString("payment"))*100;
DecimalFormat df = new DecimalFormat("###");
String importeTotal= "M978" + df.format(Payment);
String numeroReg ="1";
String referencia =rs.getString("order"); //"A2530";
String unidades = "1";
String Precio = df.format(Payment);
ResultDocument docPaymentResponse;
docPaymentResponse = ResultDocument.Factory.newInstance();
es.clickonline.response.efacturaPaymentResponse.Result result;
result=docPaymentResponse.addNewResult();
XmlCursor xmlCursorResult = result.newCursor();
es.clickonline.response.efacturaPaymentResponse.Data data1;
data1= result.addNewData();
// I return this data to url
data1.setImporteTotal(importeTotal.toString());
data1.setNumeroReg(numeroReg.toString());
data1.setReferencia(referencia);
data1.setUnidades(unidades);
data1.setPrecio(Precio);
xmlCursorResult.moveXml(xmlcursor);
xmlcursor.dispose();
System.out.println("datos" + "\n" + datos);
// return control program to
es.clickonline.transformation.Transformer
return this.parseXmlStringReader(document.toString(),false);
in this moment the remote url return html code and printed in myeclipse
console. I need capture this html code and set up html page
}
Robby Pelssers-3 wrote:
>
> A vague question if you ask me...
>
> What version of cocoon are you using by the way? 2.2?
>
>
> Let's assume you have one of 2 options below configured in your sitemap:
>
> <!-- option 1: using request parameters -->
> <map:match pattern="mypage.html">
> <map:call function="generateMyPage"/>
> </map:match>
>
> <!-- option 2: using sitemap parameters -->
> <map:match pattern="mypage/*">
> <map:call function="generateMyPage">
> <map:parameter name="id" value="{1}"/>
> </map:call>
> </map:match>
>
> You would invoke option 1 like:
>
> http://localhost:8080/mywebapp/myblock/mypage.html?id=1040
>
> option 2 can be invoked like:
>
> http://localhost:8080/mywebapp/myblock/mypage/1040
>
>
> Now your flowscript controller
>
> option 1:
>
> function generateMyPage() {
> var id = cocoon.request.getParameter("id");
> //fetch additional data
> var employees = cocooon.getComponent("dataSource").findById(id);
> cocoon.sendPage(
> "mypage2html",
> {
> "id": id, "employees ": employees
> }
> );
> }
>
> option 2:
>
> function generateMyPage() {
> var id = cocoon.parameters["id"];
> //fetch additional data
> var employees = cocooon.getComponent("dataSource").findById(id);
> cocoon.sendPage(
> "mypage2html",
> {
> "id": id, "employees ": employees
> }
> );
> }
>
> So you will also need a jxtemplate to render you html:
>
> <map:match pattern="mypage2html">
> <map:generate src="pages/mypage.jx" type="jx"/>
> <map:serialize type="xhtml"/>
> </map:match>
>
>
> the template could look like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jx:template
> xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
> <title>Some Title </title>
> <link type="text/css" rel="stylesheet"
> href="resource/external/css/styles.css"/>
> </head>
> <body>
> You invoked page with id ${id}
> <table>
> <thead>
> <tr>
> <th>First Name</th>
> <th>Last Name</th>
> </tr>
> </thead>
> <tbody>
> <jx:forEach var="employee" items="${employees}">
> <tr>
> <td>${employee.fName}</td>
> <td>${employee.lName}</td>
> </tr>
> </jx:forEach>
> </tbody>
> </table>
> </body>
> </html>
> </jx:template>
>
> So the result of invoking both URL's is an xhtml page.
>
> Robby
> -----Oorspronkelijk bericht-----
> Van: tgarijo [mailto:tgarijo@clickonline.es]
> Verzonden: do 4-11-2010 17:57
> Aan: users@cocoon.apache.org
> Onderwerp: How to I can do to capture the html code
>
>
> Hi all
>
> I am developing an application where a remote url call my url defined in
> my
> sitemap. I will return it to the url a number of data and the url returns
> me
> a html code. I develop with myeclipse and html code that it returned , is
> printed in the console of my eclipse. How to I can do to capture the html
> code that url send me and set up a web page?
>
> Thank you
>
> Sorry for my English.
>
> --
> View this message in context:
> http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30134015.html
> Sent from the Cocoon - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
--
View this message in context: http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30140111.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: How to I can do to capture the html code
Posted by tgarijo <tg...@clickonline.es>.
Hi Robby nice to meet you.
when i return the control program to
es.clickonline.transformation.Transformer
the remote gci return to me html code and printed in the console of my
eclipse
My code its the next
Sitemap
.
.
<map:transformer name="transformer"
src="es.clickonline.transformation.Transformer"/>
.
.
.
<map:match pattern="ReciveData4B">
<map:generate type="request"/>
<map:transform src="./xslt/efacturaRequest.xsl"/>
<map:transform type="transformer"/>
<map:transform src="./xslt/efacturaPaymentResponse.xsl"/>
<map:serialize type="text"/>
</map:match>
public Document setup(org.w3c.dom.Node node,
org.apache.cocoon.environment.Session session) throws UnknownHostException,
SQLException
{
String order = null;
String store = null;
Data data = null;
Session sessioneFacturaResponse = null;
boolean bGrabar = true;
User user = null;
String sCliente = null;
String payment = null;
String Session = null;
String datos = null;
EfacturaResponseDocument document;
document = EfacturaResponseDocument.Factory.newInstance();
EfacturaResponse efacturaResponse;
// Create new invoicde document by xmlbeans
efacturaResponse = document.addNewEfacturaResponse();
sessioneFacturaResponse = efacturaResponse.addNewHead().addNewSession();
sessioneFacturaResponse.setId(session.getId()) ;
// Nueva Data
data = efacturaResponse.addNewData();
XmlCursor xmlcursor =data.newCursor();
xmlcursor.toFirstContentToken();
//This data its sending by cgi program from url
order = getParametersDataOfRequest(node, "order");
store= getParametersDataOfRequest(node, "store");
payment= getParametersDataOfRequest(node, "payment");
Session =String.copyValueOf(getParametersDataOfRequest(node,
"order").toCharArray(),0,32);
int tamaño = getParametersDataOfRequest(node,
"order").length()-Session.length();
order = String.copyValueOf(getParametersDataOfRequest(node,
order").toCharArray(),32,tamaño-1);
store = getParametersDataOfRequest(node, "store");
driverDatabase drvDatabase = new driverDatabase();
// Nos conectamos a la base de datos que corresponda
drvDatabase.connectDatabases();
String s_Sql = "Select * from ExContadorPayment where session = '" +
Session + "' oRDER BY counter DESC" ;
drvDatabase.generateSql(s_Sql)
String rt = "\n";
ResultSet rs = drvDatabase.getRs();
Double Payment = Double.valueOf(rs.getString("payment"))*100;
DecimalFormat df = new DecimalFormat("###");
String importeTotal= "M978" + df.format(Payment);
String numeroReg ="1";
String referencia =rs.getString("order"); //"A2530";
String unidades = "1";
String Precio = df.format(Payment);
ResultDocument docPaymentResponse;
docPaymentResponse = ResultDocument.Factory.newInstance();
es.clickonline.response.efacturaPaymentResponse.Result result;
result=docPaymentResponse.addNewResult();
XmlCursor xmlCursorResult = result.newCursor();
es.clickonline.response.efacturaPaymentResponse.Data data1;
data1= result.addNewData();
// I return this data to url
data1.setImporteTotal(importeTotal.toString());
data1.setNumeroReg(numeroReg.toString());
data1.setReferencia(referencia);
data1.setUnidades(unidades);
data1.setPrecio(Precio);
xmlCursorResult.moveXml(xmlcursor);
xmlcursor.dispose();
System.out.println("datos" + "\n" + datos);
// return control program to
es.clickonline.transformation.Transformer
return this.parseXmlStringReader(document.toString(),false);
in this moment the remote url return html code and printed in myeclipse
console. I need capture this html code and set up html page
}
Robby Pelssers-3 wrote:
>
> A vague question if you ask me...
>
> What version of cocoon are you using by the way? 2.2?
>
>
> Let's assume you have one of 2 options below configured in your sitemap:
>
> <!-- option 1: using request parameters -->
> <map:match pattern="mypage.html">
> <map:call function="generateMyPage"/>
> </map:match>
>
> <!-- option 2: using sitemap parameters -->
> <map:match pattern="mypage/*">
> <map:call function="generateMyPage">
> <map:parameter name="id" value="{1}"/>
> </map:call>
> </map:match>
>
> You would invoke option 1 like:
>
> http://localhost:8080/mywebapp/myblock/mypage.html?id=1040
>
> option 2 can be invoked like:
>
> http://localhost:8080/mywebapp/myblock/mypage/1040
>
>
> Now your flowscript controller
>
> option 1:
>
> function generateMyPage() {
> var id = cocoon.request.getParameter("id");
> //fetch additional data
> var employees = cocooon.getComponent("dataSource").findById(id);
> cocoon.sendPage(
> "mypage2html",
> {
> "id": id, "employees ": employees
> }
> );
> }
>
> option 2:
>
> function generateMyPage() {
> var id = cocoon.parameters["id"];
> //fetch additional data
> var employees = cocooon.getComponent("dataSource").findById(id);
> cocoon.sendPage(
> "mypage2html",
> {
> "id": id, "employees ": employees
> }
> );
> }
>
> So you will also need a jxtemplate to render you html:
>
> <map:match pattern="mypage2html">
> <map:generate src="pages/mypage.jx" type="jx"/>
> <map:serialize type="xhtml"/>
> </map:match>
>
>
> the template could look like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jx:template
> xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
> <title>Some Title </title>
> <link type="text/css" rel="stylesheet"
> href="resource/external/css/styles.css"/>
> </head>
> <body>
> You invoked page with id ${id}
> <table>
> <thead>
> <tr>
> <th>First Name</th>
> <th>Last Name</th>
> </tr>
> </thead>
> <tbody>
> <jx:forEach var="employee" items="${employees}">
> <tr>
> <td>${employee.fName}</td>
> <td>${employee.lName}</td>
> </tr>
> </jx:forEach>
> </tbody>
> </table>
> </body>
> </html>
> </jx:template>
>
> So the result of invoking both URL's is an xhtml page.
>
> Robby
> -----Oorspronkelijk bericht-----
> Van: tgarijo [mailto:tgarijo@clickonline.es]
> Verzonden: do 4-11-2010 17:57
> Aan: users@cocoon.apache.org
> Onderwerp: How to I can do to capture the html code
>
>
> Hi all
>
> I am developing an application where a remote url call my url defined in
> my
> sitemap. I will return it to the url a number of data and the url returns
> me
> a html code. I develop with myeclipse and html code that it returned , is
> printed in the console of my eclipse. How to I can do to capture the html
> code that url send me and set up a web page?
>
> Thank you
>
> Sorry for my English.
>
> --
> View this message in context:
> http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30134015.html
> Sent from the Cocoon - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
--
View this message in context: http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30140111.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: How to I can do to capture the html code
Posted by Robby Pelssers <ro...@ciber.com>.
A vague question if you ask me...
What version of cocoon are you using by the way? 2.2?
Let's assume you have one of 2 options below configured in your sitemap:
<!-- option 1: using request parameters -->
<map:match pattern="mypage.html">
<map:call function="generateMyPage"/>
</map:match>
<!-- option 2: using sitemap parameters -->
<map:match pattern="mypage/*">
<map:call function="generateMyPage">
<map:parameter name="id" value="{1}"/>
</map:call>
</map:match>
You would invoke option 1 like:
http://localhost:8080/mywebapp/myblock/mypage.html?id=1040
option 2 can be invoked like:
http://localhost:8080/mywebapp/myblock/mypage/1040
Now your flowscript controller
option 1:
function generateMyPage() {
var id = cocoon.request.getParameter("id");
//fetch additional data
var employees = cocooon.getComponent("dataSource").findById(id);
cocoon.sendPage(
"mypage2html",
{
"id": id, "employees ": employees
}
);
}
option 2:
function generateMyPage() {
var id = cocoon.parameters["id"];
//fetch additional data
var employees = cocooon.getComponent("dataSource").findById(id);
cocoon.sendPage(
"mypage2html",
{
"id": id, "employees ": employees
}
);
}
So you will also need a jxtemplate to render you html:
<map:match pattern="mypage2html">
<map:generate src="pages/mypage.jx" type="jx"/>
<map:serialize type="xhtml"/>
</map:match>
the template could look like:
<?xml version="1.0" encoding="UTF-8"?>
<jx:template
xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>Some Title </title>
<link type="text/css" rel="stylesheet" href="resource/external/css/styles.css"/>
</head>
<body>
<span>You invoked page with id ${id}</span>
<table>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<jx:forEach var="employee" items="${employees}">
<tr>
<td>${employee.fName}</td>
<td>${employee.lName}</td>
</tr>
</jx:forEach>
</tbody>
</table>
</body>
</html>
</jx:template>
So the result of invoking both URL's is an xhtml page.
Robby
-----Oorspronkelijk bericht-----
Van: tgarijo [mailto:tgarijo@clickonline.es]
Verzonden: do 4-11-2010 17:57
Aan: users@cocoon.apache.org
Onderwerp: How to I can do to capture the html code
Hi all
I am developing an application where a remote url call my url defined in my
sitemap. I will return it to the url a number of data and the url returns me
a html code. I develop with myeclipse and html code that it returned , is
printed in the console of my eclipse. How to I can do to capture the html
code that url send me and set up a web page?
Thank you
Sorry for my English.
--
View this message in context: http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30134015.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org