Re: How to use JSTL XSLT tags with "result" attribute

2002-11-25 Thread matsuhashi

Thank you, Hans.

Inspired by your reply, I got the following JSP code. It worked!

-
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>

raw Model

<%@ page import="java.io.StringWriter" %>
<%@ page import="javax.xml.transform.stream.StreamResult" %>
<%
 StringWriter sw = new StringWriter();
 pageContext.setAttribute("resultString",sw);
 StreamResult outputResult = new StreamResult(sw);
 pageContext.setAttribute("outputResult", outputResult);
 %>








--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Dbtags dumps SQL code to output page on empty result

2002-11-25 Thread VP Research
We're using the dbtags tag library (v 1.0) to retrieve and format data from
a
back-end database in a Struts web-app. When a query has no results, the SQL
code for the query will appear in the output page. This may be useful for
debugging in some cases, but since empty results are expected in our queries
and are accounted for using the dbtags:wasEmpty tag, we need to be able to
suppress the SQL code dump.

We understand that in some incarnations of the dbtags tag library, there was
an option to dump the SQL code under programmer control. We cannot find this
feature in the current documentation or taglib descriptors, and cannot find
any reference to control of the code-dumping behavior in the on-line docs or
through Google.

Note that even behavior attached to the dbtags:wasEmpty tag cannot provide
proper warnings in all cases. Some database operations within a page (e.g.,
queries resulting in the creation of a temporary table when the back-end
database SQL implementation does not support nested queries) are triggered
by a dbtags:execute tag rather than by the dbtags:resultSet tags. To our
understanding, the dbtags:wasEmpty tag can only be used following the
dbtags:resultSet tags.

It may be worth noting that we use these queries for the original purpose of
tags -- that is, allowing non-programmers to modify and maintain their own
web pages. The in-page queries are read-only for security and we have found
this approach useful in moving small page-maintenance tasks out of the
programming team and back into the domain of the page-designers. More
complex database activities, including any updates, take place through our
business-entity lightweight classes (a lightweight replacement for the EJB
architecture) and are retained within the programming team.

We would like to control the presence or absence of the code-dumping
behavior, or -- at the very least -- be able to suppress it completely. Any
suggestions compatible with continued use of dbtags?


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: How to use JSTL XSLT tags with "result" attribute

2002-11-25 Thread Hans Bergsten
[EMAIL PROTECTED] wrote:

Hi, I am wondering how to use JSTL XML  tag with "result"
attribute.

I am using the jakarta-taglibs/standard-1.0.2 with Tomcat 4.1.3 on
Windows2000.

I have a String variable "${pipeline_final_output_String}" within the
request scope in which a XML document is contained.

I needed to transform the String via a simple identityTransform because the
original XML is in a canonical-form; therefore no \n and no line
indentation is used. I want to perform  on the
original.

Also I want to print the variable's content while escaping "<" and "&"
characters into "<" and "&" respectively;

All these are meant to provide a debug-view to see "XML as it is" in the
resulting HTML.

I coded a JSP as follows :
--
<%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>

raw Model

<%@ page import="javax.xml.transform.stream.StreamResult" %>
<%@ page import="javax.xml.transform.Result" %>
 <%@ page import="java.io.StringWriter" %>
<%
 StringWriter sw = new StringWriter();
StreamResult outputResult = new StreamResult(sw);
%>

<%
String escapedString = escape(sw.toString());
%>

<%= escapedString %>

<%!
String escape(String s) {
StringBuffer buffer = new StringBuffer(1024);
if (s != null) {
for (int i = 0; i < s.length(); i++) {
String c = s.substring(i,i+1);
if (c.equals("<")) {
buffer.append("<");
} else if (c.equals(">")) {
buffer.append(">");
} else if (c.equals("&")) {
buffer.append("&");
} else {
buffer.append(c);
}
}
return buffer.toString();
} else {
return null;
}
}


When executed, a ServletException occured. The diagnostics says something
as follows (in Japanse) :

"An error occured during evaluating the custome action attribute "result"
with the value "outputResult".
When tried to convert a String "outputResutl" into the type of
"javax.xml.transform.Result",
there is not a PropertyEditor to the type."

I could not find a instructive articles on Web how to use "result"
attribute of .


You're example looks okay, except that you need to use an EL expression
to pass in the StreamResult _object_, not the name of the variable that
holds the object:

  

Also, you don't need to code the escaping yourself.  does it
by default, so this should work:

  

Hans
--
Hans Bergsten<[EMAIL PROTECTED]>
Gefion Software   
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: is it possible to re-use an existing sql:query variable?

2002-11-25 Thread Shawn Bayern
On Mon, 25 Nov 2002, Mark Goking wrote:

> is it possible to re-use an existing sql:query variable?

Yes.

> 
>   
> 
> 
> now.. i want to use it in another forEach
> 
> 
>   
> 
> 
> is this possible? or do i have to do something else first

Yes, it's possible just as you've written it.

-- 
Shawn Bayern
"JSTL in Action"   http://www.manning.com/bayern


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: [Howto] use with varReader to import/parse large XMLfile ?

2002-11-25 Thread Shawn Bayern
On Mon, 25 Nov 2002, smallufo wrote:

> I have a big XML file (about 500Kbytes) ,
> while using general 
> 
>  
> 
> 
> It costs a lot of time (about 12~14 seconds) to select nodes.
> 
> I wonder if varReader can improve the efficiency, I tried but cannot
> find how to combine varReader with XML parsing, can somebody give me a
> demonstration ?

 accepts a Reader, so you can simply write

 
 

-- 
Shawn Bayern
"JSTL in Action"   http://www.manning.com/bayern


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




How to use JSTL XSLT tags with "result" attribute

2002-11-25 Thread matsuhashi

Hi, I am wondering how to use JSTL XML  tag with "result"
attribute.

I am using the jakarta-taglibs/standard-1.0.2 with Tomcat 4.1.3 on
Windows2000.

I have a String variable "${pipeline_final_output_String}" within the
request scope in which a XML document is contained.

I needed to transform the String via a simple identityTransform because the
original XML is in a canonical-form; therefore no \n and no line
indentation is used. I want to perform  on the
original.

Also I want to print the variable's content while escaping "<" and "&"
characters into "<" and "&" respectively;

All these are meant to provide a debug-view to see "XML as it is" in the
resulting HTML.

I coded a JSP as follows :
--
<%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>

raw Model

<%@ page import="javax.xml.transform.stream.StreamResult" %>
<%@ page import="javax.xml.transform.Result" %>
 <%@ page import="java.io.StringWriter" %>
<%
 StringWriter sw = new StringWriter();
StreamResult outputResult = new StreamResult(sw);
%>

<%
String escapedString = escape(sw.toString());
%>

<%= escapedString %>

<%!
String escape(String s) {
StringBuffer buffer = new StringBuffer(1024);
if (s != null) {
for (int i = 0; i < s.length(); i++) {
String c = s.substring(i,i+1);
if (c.equals("<")) {
buffer.append("<");
} else if (c.equals(">")) {
buffer.append(">");
} else if (c.equals("&")) {
buffer.append("&");
} else {
buffer.append(c);
}
}
return buffer.toString();
} else {
return null;
}
}


When executed, a ServletException occured. The diagnostics says something
as follows (in Japanse) :

"An error occured during evaluating the custome action attribute "result"
with the value "outputResult".
When tried to convert a String "outputResutl" into the type of
"javax.xml.transform.Result",
there is not a PropertyEditor to the type."

I could not find a instructive articles on Web how to use "result"
attribute of .

Anyone knows how?




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Possible bug?

2002-11-25 Thread David Durant

Hi,

I'd like to post this to the mailing list to see if
I'm making a mistake or it's a know problem before I
add it to the bug database.

Ref: DBTAGS taglib displaying request SQL when second
request on the same page returns no results.

Please consider the following section of JSP:


  select * from people
  Count 



  select * from jobs
  Notice 


This appears to work fine (printing "Count" for each
entry in the "people" table and "Notice" for each
entry in the "jobs" table) as long as there are any
entries in the "jobs" table. If the "jobs" table is
empty then it still prints the number of "Count"s
correctly but instead of displaying no "Notice"s it
displays "select * from jobs".

This has been tested with the nightly build of DBTAGS
taglib as well as the 1.0 release.

This has also been tested using a non-empty database
with a "WHERE" clause which also returned no results.
Ie if "select * from jobs where (firstname="David")"
returned no results the SQL request will still be
displayed.

Can anyone else duplicate this problem?

Cheers,

David Durant.

=
I'd start the revolution - if I could just get up in the morning...
-- Amiee Allen
.

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




is it possible to re-use an existing sql:query variable?

2002-11-25 Thread Mark Goking


is it possible to re-use an existing sql:query variable?

e..g.




and then i usde it in a forEach





now.. i want to use it in another forEach





is this possible? or do i have to do something else first

mark

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.422 / Virus Database: 237 - Release Date: 11/20/2002
 

--
To unsubscribe, e-mail:   
For additional commands, e-mail: