cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scherler, Thorsten" <Thorsten.Scher...@weidmueller.de>
Subject AW: AW: AW: xsp-element equivalent to xsl:param?
Date Fri, 31 Jan 2003 15:13:42 GMT
Thanks,

but now I am not getting any results because is always timeOfDay = "".

I will look into using <esql:parameter> tags.

Thanks for your patience.

-----Urspr√ľngliche Nachricht-----
Von: Andrew Timberlake [mailto:andrew@timberlake.co.za]
Gesendet: Freitag, 31. Januar 2003 16:07
An: cocoon-users@xml.apache.org
Betreff: Re: AW: AW: xsp-element equivalent to xsl:param?


Try this

...
<dataset>
   <xsp:logic>
      String timeOfDay = "";
      try{
         timeOfDay = (new
SimpleDateFormat("MM/dd/yyyy")).format(request.getParameter("date"));
      }catch(Exception e){}
   </xsp:logic>
   
<esql:connection>
<esql:pool>IDC2_int</esql:pool>
<esql:execute-query>
<esql:query>
select * from info_bericht  where country ='<xsp-request:get-parameter
name="GETcountry"/>'   AND  Info_datum =
#<xsp:expr>timeOfDay</xsp:expr>#
</esql:query>

I will mention again that you should look into using <esql:parameter>
tags.

Andrew

On Fri, 2003-01-31 at 16:46, Scherler, Thorsten wrote:
> Hello Andrew,
> 
> my final xsp should look like this:
> ...
> <dataset>
>   <xsp:logic>
>  try{
>      String timeOfDay = (new
> SimpleDateFormat("MM/dd/yyyy")).format(request.getParameter("date"));
> }catch(Exception e){}
>  </xsp:logic>
> <esql:connection>
> <esql:pool>IDC2_int</esql:pool>
> <esql:execute-query>
> <esql:query>
>  select * from info_bericht  where country ='<xsp-request:get-parameter name="GETcountry"/>'
  AND  Info_datum = #<xsp:expr>timeOfDay</xsp:expr>#
>  </esql:query>
> ...
> 
> like I stated before, as soon I get rid off the logic my query is successful.
> 
> Like you told me before my method now starts after the first xml element:
> 
> snip from IDC2_info_int_xsp.java
>   /**
> * Generate XML data.
> */
>   public void generate() throws SAXException, IOException, ProcessingException {
>   this.contentHandler.startDocument();
>  AttributesImpl xspAttr = new AttributesImpl();
> 
> ...
> 
> this.contentHandler.startElement(
>   "",
>   "dataset",
>   "dataset",
>   xspAttr
> );
> xspAttr.clear();
> 
> 
>  this.characters("\n  ");
>   
>  try{
>  String timeOfDay = (new
> SimpleDateFormat("MM/dd/yyyy")).format(request.getParameter("date"));
> }catch(Exception e){}
>  
>  this.characters("\n\t\t");
>   ... 
> 
> 
> -----Urspr√ľngliche Nachricht-----
> Von: Andrew Timberlake [mailto:andrew@timberlake.co.za]
> Gesendet: Freitag, 31. Januar 2003 15:30
> An: cocoon-users@xml.apache.org
> Betreff: Re: AW: xsp-element equivalent to xsl:param?
> 
> 
> On Fri, 2003-01-31 at 16:09, Scherler, Thorsten wrote:
> > Hello Jan,
> > 
> > I couldn't find the error.
> > 
> > But I attached it.
> > 
> I was reading your previous post in which you posted your xsp source.
> Instead of this:
> <esql:execute-query>
>     <esql:query>
>          select * from info_bericht  where country ='<xsp-request:get-parameter
> name="GETcountry"/>' AND  Info_datum = #<xsp-request:get-parameter name="date"/>#
>     </esql:query>
> 
> Try this:
> <esql:execute-query>
>     <esql:query>
>          select * from info_bericht  where country = <esql:parameter><xsp-request:get-parameter
> name="GETcountry"/></esql:parameter> AND  Info_datum = <esql:parameter><xsp-request:get-parameter
name="date"/></esql:parameter>
>     </esql:query>
> 
> This will then use a PreparedStatement which is safer from possible SQL exploit.
> 
> Other than that, the XSP source didn't show where you were using the direct access to
parameters.getParameter() or request.getParameter()
> 
> Andrew
> 
> Andrew
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
-- 
Andrew Timberlake <andrew@timberlake.co.za>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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