Re: [PATCH] for xsp-session:getxml

2002-10-25 Thread Tuomo Lesonen
Hi Bert,

Try to put esql:parameter around xsp-sessio:getxml in your query.

-Tuomo


On Fri, 25 Oct 2002, Bert Van Kets wrote:

 Hi Antonio,
 I've been trying hard to get this esql sample to work.
 The tag works perfectly.
  userxsp-session:getxml context=authentication
 path=/authentication/ID//user
 returns the userID in my xsp page.  So there is nothing wrong with the
 class or the session.xsl file.

 However, I need to create a query containing the userID.  I think I went
 through the whole book of exceptions in Cocoon. :-(
 When I try it the way you describe below, I get an error saying method
 parseInt() not found in class java.lang.Integer.  I guess this means
 nothing is returned and the parseInt can't convert.
 I've tried all kind of combinations and always get an error.
 Here's what I've got now (doesn't work of course):

esql:execute-query
  esql:querySELECT * FROM members WHERE ID=xsp-session:getxml
 context=authentication path=/authentication/ID as=string//esql:query
  esql:results
esql:row-results
  esql:get-columns/
/esql:row-results
  /esql:results
/esql:execute-query

 What am I missing here


 Bert

 P.S. Using Cocoon 2.1 build of 14 May 2002, Tomcat 4.0.1, JDK 1.3.1_2


 At 05:54 8/10/2002 -0600, you wrote:
 Another usage of this tag is to set the parameters of a query based on the is
 in esql:query see the example:
 
 esql:query
SELECT usr_name, usr_full_name, usr_password FROM users
WHERE usr_id =
esql:parameter type=int
  xsp:expr
Integer.parseInt(
  xsp-session:getxml context=authentication
  path=/authentication/ID
 as=string/)
  /xsp:expr
/esql:parameter
 /esql:query
 
 Antonio Gallardo
 
 El Martes, 08 de Octubre de 2002 05:43, Antonio Gallardo Rivera escribió:
   Hi, I recently needed to write some app logi usin xsp:logic tags. Into
   tags we need to write some code like:
  
   String myUserID = xsp-session:getxml context=authentication
   path=/authentication/ID as=string/;
  
   Then, I updated xsp-session:getxml to serve strings.
  
   Currently the attribute as of the element can have 3 values:
  
   1-as=object (default) returns a org.w3c.dom.DocumentFragment object. More
   info at
   http://xml.apache.org/xerces2-j/javadocs/api/org/w3c/dom/DocumentFragment.h
  tml
  
   2-as=xml return the DocumentFragment into xsp-session:xml tags.
  
   3- return the value of the firstchild of the requested node. Example: If we
   have:
  
   IDMyID/ID
   roleMyRole/role
   data
   fullnameTheFullName/fullname
  
   A) Then if we write:
   xsp-session:getxml context=authentication path=/authentication/ID
   as=string/
  
   will return MyID
  
   B) xsp-session:getxml context=authentication
   path=/authentication/data/fullname as=string/
  
   will return: TheFullName
  
   Attached is the new session.xsl the place of this file is:
  
   xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java
  
   Antonio Gallardo
 
 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]


 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: XSP in XSL and Caching problem!

2002-10-15 Thread Tuomo Lesonen

We really need some advice on this problem. It's slowing our
development by 600% !

Anyone?

Cocoon 2.1-DEV (from CVS about a month ago)
Tomcat 4.0.5
JDK 1.4.1_01

On Thu, 10 Oct 2002, Timothy Larson wrote:

 I am having the same problem and am using the same ugly workaround.

 Tomcat 3.3.1
 Cocoon 2.0.4dev (from CVS around 9-17-2002)
 JDK 1.4.0_02

 If I serialize the XSP page as XML it is always is up-to-date, but when I
 use the XSP as a serverpage it is usually out-of-date.  This tells me that
 the XML of the XSP page is being cached properly, but the JAVA code
 that it generates is not being updated at the same time.

 On rare occasions it will update with changes to the XSL page that
 generates it, but most of the time I have to take down Tomcat and clear
 the work directory to get the code generated from the XSP to update.

 Tim

  [EMAIL PROTECTED] 10/10/02 10:52AM 
 I'm using 2.1-DEV, and one file in my application is a XSL page which
 generates XSP for the serverpagesGenerator. The problem here is, that no
 changes are committed to the browser result! Only removing the work-dir
 and restarting tomcat helps. And after one reload of that page it's still
 the same. I've changed all the pipelines to noncaching, and everything
 is set to false that seems like a caching instruction.

 I've tryed IE6, and NN7, no difference.

 Help, please!

 -Tuomo


 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: How to insert multiple rows in a table at once?

2002-10-15 Thread Tuomo Lesonen

In your sitemap inside map:actions put:

map:action name=mod-db-add src=org.apache.cocoon.acting.modular.DatabaseAddAction
  descriptorcontext://foo/bar/database.xml/descriptor
  throw-exceptiontrue/throw-exception
/map:action

In pipeline:

map:act type=mod-db-add
  map:parameter name=table-set value=some_table_set /
/map:act

In database.xml put:

table name=foo
  keys
key name=my_sub_id type=int autoincrement=true primarykey=true
  mode name=auto type=autoincr /
/key
  /keys
  values
value name=my_id type=int
  mode name=request-param parameter=my_id type=all/
/value
value name=my_data type=string
  mode name=request-param parameter=my_data_* type=all set=master/
/value
  /values
/table

That should work. See:
http://xml.apache.org/cocoon/userdocs/actions/database-actions.html
for more info, and http://localhost:8080/cocoon/samples/mod-db

-Tuomo

On Tue, 15 Oct 2002, Antonio Gallardo Rivera wrote:

 Hi,

 I am trying to insert multiple rows into a table after the user press a
 Finish buton.

 I think this can be done with modular.databse. But I dont know how to do that.

 Given a fixed key: my_id from a master table
 and rows:

 my_id
 my_subid
 my_data   --- usr input.

 Can someone provide a simple example?

 Regards,

 Antonio Gallardo

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




XSP in XSL and Caching problem!

2002-10-10 Thread Tuomo Lesonen

I'm using 2.1-DEV, and one file in my application is a XSL page which
generates XSP for the serverpagesGenerator. The problem here is, that no
changes are committed to the browser result! Only removing the work-dir
and restarting tomcat helps. And after one reload of that page it's still
the same. I've changed all the pipelines to noncaching, and everything
is set to false that seems like a caching instruction.

I've tryed IE6, and NN7, no difference.

Help, please!

-Tuomo


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Updating only certain columns with the modular DatabaseUpdateAction

2002-10-05 Thread Tuomo Lesonen

Hi,

How can I set up my db descriptor so that only some columns are updated?
Now,
if I don't pass values with the request (With hidden fields for example)
for all columns, they become NULL.

Thanks,
Tuomo


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Uploading to a network directory

2002-10-01 Thread Tuomo Lesonen

Hi all!

I need to let users to upload files. The problem is, that the files have
to go to another machine.

I was thinking about WebDav, but does it work with Cocoon? The fileserver
is running IIS.

Thanks,
-Tuomo


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: how to access without cocoon

2002-09-29 Thread Tuomo Lesonen

On Sat, 28 Sep 2002, funing wrote:

 Hi!
 I can run my webapp by http://host:8080/cocoon/xxx correctly.
 How to access it without cocoon by http://host:8080/xxx ?

 I change the map:pattern but it doesn't work :(


Or rename webapps/ROOT to webapps/tomcat, and rename your webapps/xxx
to webapps/ROOT.

-Tuomo



 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




JDBC driver for MS SQL Server 2000 with blob support

2002-09-27 Thread Tuomo Lesonen

I'm trying to use the database reader, but the JDBC driver from MS doens't
support blob. We can't get one of the commercial (expensive) drivers at
this point, and I already tried FreeTDS which doesn't have this either. I
have to keep on using SQL Server 2000. :(

Any links ?

-Tuomo


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: JDBC driver for MS SQL Server 2000 with blob support

2002-09-27 Thread Tuomo Lesonen

On Fri, 27 Sep 2002, Peter Royal wrote:

 On Friday, September 27, 2002, at 05:10  AM, Tuomo Lesonen wrote:
  I'm trying to use the database reader, but the JDBC driver from MS
  doens't
  support blob. We can't get one of the commercial (expensive) drivers at
  this point, and I already tried FreeTDS which doesn't have this
  either. I
  have to keep on using SQL Server 2000. :(
 
  Any links ?

 Did you use the jTDS? (http://jtds.sourceforge.net/)

 Its a fork of the FreeTDS code, may have more support. Thats all the
 free options I know of.

Yep, tried it. Not implemented was the error, so it's no good. Thanks
anyway.

-Tuomo



 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: JDBC driver for MS SQL Server 2000 with blob support

2002-09-27 Thread Tuomo Lesonen

On Fri, 27 Sep 2002 [EMAIL PROTECTED] wrote:

 This is also a free JDBC driver but I don't know if blob are supported
 http://www.thinweb.com/products_twfreetds.html

 good luck
 Bernard

Thanks, I'll try it out. Their website is propably experiencing some
technical difficulties, download doesn't work...

-Tuomo


 Surlignage Tuomo Lesonen [EMAIL PROTECTED]:

  On Fri, 27 Sep 2002, Peter Royal wrote:
 
   On Friday, September 27, 2002, at 05:10  AM, Tuomo Lesonen wrote:
I'm trying to use the database reader, but the JDBC driver from MS
doens't
support blob. We can't get one of the commercial (expensive) drivers at
this point, and I already tried FreeTDS which doesn't have this
either. I
have to keep on using SQL Server 2000. :(
   
Any links ?
  
   Did you use the jTDS? (http://jtds.sourceforge.net/)
  
   Its a fork of the FreeTDS code, may have more support. Thats all the
   free options I know of.
 
  Yep, tried it. Not implemented was the error, so it's no good. Thanks
  anyway.
 
  -Tuomo
 
  
  
   -
   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: [EMAIL PROTECTED]
   For additional commands, e-mail:   [EMAIL PROTECTED]
  
 
 
  -
  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: [EMAIL PROTECTED]
  For additional commands, e-mail:   [EMAIL PROTECTED]
 
 



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: [C2.1-CVS] Problem using 2 pipelines

2002-09-25 Thread Tuomo Lesonen

On Wed, 25 Sep 2002, Antonio Gallardo Rivera wrote:

 Many thanks!

 Its a nice workaround. But what about to built the final logicsheet? many
 people will use it. I am trying to do that. I am sure you will welcome it.

 BTW, why is the XSL transform support first than the XSP? I feel like I am
 doing this in the wrong way, like I need to prefer XSL tranform over XSP. I
 saw that many people in thi maillist prefer make XSLT tranforms and few
 people use XSP. Why?

 Antonio Gallardo


If you're talking about the logicsheet, you have to do the XSLT first to
extend the XSP page with more Java. Then it's pushed through the
ServerPagesGenerator and processed. Logicsheet is easier to maintain than
writing the same XSP every time on every page it's needed.

-Tuomo



 El Miércoles, 25 de Septiembre de 2002 00:58, Tuomo Henrikki Lesonen escribió:
  Hi Antonio!
 
  I really tried to answer to your question about the auth-framework, but
  couldn't connect to my mailserver at all! :( Now it works again... But it
  seems that you're going through the same steps than I did a while ago.
  (With my own help)
 
  At this moment, the option of using 2 pipelines the way you are
  doing, with the cocoon: pseudo-protocol doesn't work. This is due to
  a major bug
  in the cocoon component handling. It has been reported, but no actions
  have been taken yet. BUT: There IS a way around this!
 
  I have my authentication resource generated with XSP and ESQL (Username
  and pwd are
  checked against db, and user data is being returned in the
  authentication section
  of that generated resource). In addition, I added another line inside the
  authentication section, which places the users ID in a session
  attribute. Now it can be used in XSP later on.
 
  authentication
IDesql:get-int column=id//ID
xsp-session:set-attributeesql:get-int
  column=id//xsp-session:set-attribute /authentication
 
  Hope this helps.
 
  -Tuomo
 
  On Tue, 24 Sep 2002, Antonio Gallardo Rivera wrote:
   The first pipeline get and XML - XSLT - XML
  
   map:match pattern=*-*.xml
   map:act type=auth-protect
 map:parameter name=handler value=agshandler/
 map:match pattern=*-*.xml
map:generate src=docs/{1}-{2}.xsp/
map:transform type=session/
map:serialize type=xml/
   /map:match
 /map:act
   /map:match
  
   The second read from the first pipeline making an XSP tranformation:
  
   map:match pattern=*-*.html
   map:generate src=cocoon://{1}-{2}.xml
   type=serverpages encoding=ISO-8859-1/
   map:transform src=stylesheets/agssa.xsl/
   map:serialize/
   /map:match
  
   I call only this second pipeline, but It returns:
  
   Exception during source resolving.
  
   org.apache.cocoon.ProcessingException: Exception during source
   resolving.: org.apache.excalibur.source.SourceException: Exception during
   processing of cocoon://usr-cambiar.xml:
   org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
   java.lang.NullPointerException
  
  
   If I call directly the fisrt pipeline it returns me a valid XML file.
   What I am doing wrong?
  
   Thanks in advance,
  
   Antonio Gallardo
  
   -
   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: [EMAIL PROTECTED]
   For additional commands, e-mail:   [EMAIL PROTECTED]
 
  -
  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: [EMAIL PROTECTED]
  For additional commands, e-mail:   [EMAIL PROTECTED]

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: [Auth-framwork] - How to manage multiple documents.

2002-09-05 Thread Tuomo Lesonen

I've done mine as Carsten proposed, by using the parameters returned by
the AuthAction in the pipeline. Works great for protecting multiple pages!

But if you want to show different things for different users, you will
have to use the SessionTransformer.

It can be done inside a xsp-page too, but at the moment there is a serious
bug with the cocoon: protocol, which prevents one to run the xsp-page
through the SessionTransformer before used as a source for the
ServerPagesGenerator. Hope this gets fixed soon!

-Tuomo

On Thu, 5 Sep 2002, Antonio Gallardo Rivera wrote:

 Hi Barbara I see you posting always! ;) Thanks,

 So Do you mean the best approach is to put the permission to every file
 into the data element of the auth-protect action? Then check this
 permission into each page?

 The auth-session data will return something like:

 authentication
   IDuserA/ID
   data
   create-categorytrue/create-category
   edit-categorytrue/edit-category
   create-productfalse/create-product
   edit-productfalse/edit-product
 /authentication

 Then in the beginning of each page, checks for:

 create-category

 session:getxml
   context=authentication
   path=authentication/data/create-category

 It will return true or false.

 In this way I can have only 1 handler. Is this the best approach?

 Antonio Gallardo



 El Jueves, 05 de Septiembre de 2002 00:42, Barbara Post escribió:
  Hello Antonio, you have somewhere a database, ldap directory or (for tests)
  an xml file storing ID, password, permissions for each user, and then the
  authentication simply happens the way you prefer, with an action etc.
 
  All the pages are protected by the same handler.
 
  Have a nice day,
 
  Babs
 
  - Original Message -
  From: Antonio Gallardo Rivera [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Thursday, September 05, 2002 8:26 AM
  Subject: [Auth-framwork] - How to manage multiple documents.
 
 
  Hi buddies!
 
  I read about the auth-document in
  http://xml.apache.org/cocoon/developing/webapps/authentication.html
 
  Its a very nice authentication framework!
 
  I have just one question after read that:
 
  Given 4 pages to authenticate:
 
  a) create-category
  b) edit-category
  c) create-product
  d) edit-product.
 
  and 5 users:
 
  userA, userB, userC, userD, userE
 
  and this permission rules:
 
  UserA can acces only pages a,b,c,d
  UserB can acces only pages a,b
  UserC can access only pages: c,d
  UserD can access only pages: a,c
  UserE can access only pages: b,d
 
  How is the best approach to do that with Cocoon?
 
  Of course we dont want that the user need to write his user ID and password
  to
  access every page.
 
  What we can do?
 
  Regards,
 
  Antonio Gallardo
 
  -
  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: [EMAIL PROTECTED]
  For additional commands, e-mail:   [EMAIL PROTECTED]
 
 
 
  -
  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: [EMAIL PROTECTED]
  For additional commands, e-mail:   [EMAIL PROTECTED]

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]




-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen

Hi,

How can I count the rows in my resultset? I'm using esql, but
esql:row-count/ doesn't seem to be implemented yet. SQL COUNT(*) doesn't
work in this case either. Can I do this with XSP?

Thanks,
-Tuomo


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen



On Wed, 28 Aug 2002, Christian Haul wrote:

 On 28.Aug.2002 -- 10:07 AM, Tuomo Lesonen wrote:
  Hi,
 
  How can I count the rows in my resultset? I'm using esql, but
  esql:row-count/ doesn't seem to be implemented yet. SQL COUNT(*) doesn't
  work in this case either. Can I do this with XSP?

 Yes, have a new var declared before the execute-query and ++ it in
 your row-results


Thank you Chris, but in this case I need to know the number of rows
_before_ I do esql:row-results, in order to produce the right data.

-Tuomo

 ...
 xsp:logic
   int rowCount = 0;
 ...
   esql:execute-query
 ...
   esql:row-results
 ...
   xsp:logic
   rowCount++;


   Chris.
 --
 C h r i s t i a n   H a u l
 [EMAIL PROTECTED]
 fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen



On Wed, 28 Aug 2002, Christian Haul wrote:

 On 28.Aug.2002 -- 10:54 AM, Leszek Gawron wrote:
  try to do select count(*) as row_count from table;
 
  and then in esql:row-results do esql:get-long column=row_count/
 
  I'm not 100% sure but this highly probable to work

 Yes, if it is an option to run the query twice this should work. The
 as row_count is not necessary if you access the count(*) by column
 number i.e. esql:get-long column=1/

I did try these both. But COUNT(*) is not working, because I have to
specify more columns in the query. My query is something like this: SELECT
id, name FROM names WHERE id = 1;

This doesn't work: SELECT COUNT(*), id, name FROM names WHERE id = 1;

I'm using MS SQL2000. The query above is probably not well formed SQL, or
SQL2000 doesn't know what to do with it... :(

-Tuomo



   Chris.
 --
 C h r i s t i a n   H a u l
 [EMAIL PROTECTED]
 fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen

Time to take out some heavier arms. Since I only need to
get id and name
from my table, I'm placing these pairs in a hashtable inside
esql:row-results/. Then I have a nice hashtable, which I iterate through
later on. hashtables size() method gives the rowCount.

BUT: How to implement Enumeration interface in XSP in order to use the
keys()  method of the Hashtable object? (I'm pretty new to Java, so
there's probably a convinient way of doing this..)

-Tuomo

On Wed, 28 Aug 2002, Christian Haul wrote:

 On 28.Aug.2002 -- 10:54 AM, Leszek Gawron wrote:
  try to do select count(*) as row_count from table;
 
  and then in esql:row-results do esql:get-long column=row_count/
 
  I'm not 100% sure but this highly probable to work

 Yes, if it is an option to run the query twice this should work. The
 as row_count is not necessary if you access the count(*) by column
 number i.e. esql:get-long column=1/

   Chris.
 --
 C h r i s t i a n   H a u l
 [EMAIL PROTECTED]
 fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: Counting rows in a resultset

2002-08-28 Thread Tuomo Lesonen



On Wed, 28 Aug 2002, Christian Haul wrote:

 On 28.Aug.2002 -- 01:29 PM, Tuomo Lesonen wrote:
  Time to take out some heavier arms. Since I only need to
  get id and name
  from my table, I'm placing these pairs in a hashtable inside
  esql:row-results/. Then I have a nice hashtable, which I iterate through
  later on. hashtables size() method gives the rowCount.

 Tuomo, please tell us more about your XSP. I'm sure, someone will be
 able to suggest a better solution than this. But we need to understand
 the task.

My XSP page needs to output certain XML tags if there are _more than one_
row in the resultset. If there's more than one, a different XML node is
created using the information in the rows. More precisely, If there are more than
one row, I create a (X)HTML select list, and a line of text in case of one
row.


  BUT: How to implement Enumeration interface in XSP in order to use the
  keys()  method of the Hashtable object? (I'm pretty new to Java, so
  there's probably a convinient way of doing this..)

 You need to put your inenr class before the page element.

Is there such a class? I thought Enumeration is an interface, and cannot
be included with xsp:include ? Little confused here... :-|

-Tuomo


   Chris.
 --
 C h r i s t i a n   H a u l
 [EMAIL PROTECTED]
 fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: Dynamic XSP resource

2002-08-21 Thread Tuomo Lesonen

I tried that already, but no luck. If I remove the session:getxml tags
in the XSP file, everything works ok, which means that the path
(cocoon:/menu.xsp) is good.
This is weird!

This is what I have in the XSP file:

xsp:logic
  if(session:getxml context=authentication 
path=/authentication/data/access/==true){
xsp:content
  some-tags-here/
/xsp:content
  }
/xsp:logic

And after SessionTransformer this really becomes (I checked):

xsp:logic
  if(true==true){
xsp:content
  some-tags-here/
/xsp:content
  }
/xsp:logic

But when I use this as a source for the ServerPagesGenerator,
the NullPointerException occurs! :-(

Thanks for your answer, Carles.

-Tuomo

On Wed, 21 Aug 2002, Carles Canellas wrote:

 I think ( for my experience) you need to have
 map:match pattern=menu.xsp in another pipeline,
 not in the same thar the other match pattern. the
 cocoon:/ references to another pipeline in the same
 sitemap, not the same pipeline.

 Carles.

  --- Tuomo Lesonen [EMAIL PROTECTED] escribió: 
 
  On Tue, 20 Aug 2002, Roger I Martin PhD wrote:
 
   Just from a quick look, the map:generate src for
  menu.html has cocoon: as
   a part of it relative path; do you have such a
  path and can such an animal
   be part of a url?
 
  I use cocoon:/ protocol to tell cocoon, that
  menu.xsp in not directly
  located on my hard drive, but it's a resource in the
  current sitemap. cocoon://
  would mean the parent sitemap. Generators in Cocoon
  (including the
  serverpages generator) can use the new cocoon:
  protocol, right?
 
  -Tuomo
 
  
   --Roger
   - Original Message -
   From: Tuomo Lesonen [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Tuesday, August 20, 2002 4:57 AM
   Subject: Dynamic XSP resource
  
  
Hi all!
   
I have an XSP page which is extended with the
  Session Transformer before
it is used as an resource for the serverpages
  generator. Here's my
sitemap:
   
map:match pattern=menu.xsp
  map:generate src=docs/menu.xsp/
  map:transform type=session/
  map:serialize type=xml/
/map:match
   
map:match pattern=menu.html
  map:generate type=serverpages
  src=cocoon:/menu.xsp/
  map:transform
  src=stylesheets/menu-html.xsl/
  map:serialize type=html/
/map:match
   
If I open menu.xsp in browser, everything
  looks ok. Session Transformers
does the job and everything. But when opening
  menu.html Cocoon gives a
NullPointerException.
   
Seems like a bug, not sure though.
   
Thanks in advance,
   
-Tuomo
   
org.apache.cocoon.ProcessingException: Exception
  during source resolving.:
org.apache.excalibur.source.SourceException:
  Exception during processing
of cocoon://intranet/menu.xsp:
  org.apache.cocoon.ProcessingException:
Failed to execute pipeline.:
  java.lang.NullPointerException
at
   
 
 org.apache.cocoon.components.source.SourceUtil.handle(SourceUtil.java:136)
at
   
  
 
 org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.jav
   a:161)
at
   
  
 
 org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.generat
   eSourcecode(ProgramGeneratorImpl.java:438)
at
   
  
 
 org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(Pr
   ogramGeneratorImpl.java:285)
at
   
  
 
 org.apache.cocoon.generation.ServerPagesGenerator.setup(ServerPagesGenerator
   .java:209)
at
   
  
 
 org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeli
   ne(AbstractProcessingPipeline.java:368)
at
   
  
 
 org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline
  
 
 .setupPipeline(AbstractCachingProcessingPipeline.java:297)
at
   
  
 
 org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(Abs
   tractProcessingPipeline.java:475)
at
   
  
 
 org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(Seri
   alizeNode.java:142)
at
   
  
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
   keNodes(AbstractParentProcessingNode.java:83)
at
   
  
 
 org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invok
   e(PreparableMatchNode.java:163)
at
   
  
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
   keNodes(AbstractParentProcessingNode.java:83)
at
   
  
 
 org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.invoke(ActTyp
   eNode.java:155)
at
   
  
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
   keNodes(AbstractParentProcessingNode.java:83)
at
   
  
 
 org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invok
   e(PreparableMatchNode.java:163)
at
   
  
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
   keNodes(AbstractParentProcessingNode.java:107

Re: Dynamic XSP resource

2002-08-20 Thread Tuomo Lesonen



On Tue, 20 Aug 2002, Roger I Martin PhD wrote:

 Just from a quick look, the map:generate src for menu.html has cocoon: as
 a part of it relative path; do you have such a path and can such an animal
 be part of a url?

I use cocoon:/ protocol to tell cocoon, that menu.xsp in not directly
located on my hard drive, but it's a resource in the current sitemap. cocoon://
would mean the parent sitemap. Generators in Cocoon (including the
serverpages generator) can use the new cocoon: protocol, right?

-Tuomo


 --Roger
 - Original Message -
 From: Tuomo Lesonen [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, August 20, 2002 4:57 AM
 Subject: Dynamic XSP resource


  Hi all!
 
  I have an XSP page which is extended with the Session Transformer before
  it is used as an resource for the serverpages generator. Here's my
  sitemap:
 
  map:match pattern=menu.xsp
map:generate src=docs/menu.xsp/
map:transform type=session/
map:serialize type=xml/
  /map:match
 
  map:match pattern=menu.html
map:generate type=serverpages src=cocoon:/menu.xsp/
map:transform src=stylesheets/menu-html.xsl/
map:serialize type=html/
  /map:match
 
  If I open menu.xsp in browser, everything looks ok. Session Transformers
  does the job and everything. But when opening menu.html Cocoon gives a
  NullPointerException.
 
  Seems like a bug, not sure though.
 
  Thanks in advance,
 
  -Tuomo
 
  org.apache.cocoon.ProcessingException: Exception during source resolving.:
  org.apache.excalibur.source.SourceException: Exception during processing
  of cocoon://intranet/menu.xsp: org.apache.cocoon.ProcessingException:
  Failed to execute pipeline.: java.lang.NullPointerException
  at
  org.apache.cocoon.components.source.SourceUtil.handle(SourceUtil.java:136)
  at
 
 org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.jav
 a:161)
  at
 
 org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.generat
 eSourcecode(ProgramGeneratorImpl.java:438)
  at
 
 org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(Pr
 ogramGeneratorImpl.java:285)
  at
 
 org.apache.cocoon.generation.ServerPagesGenerator.setup(ServerPagesGenerator
 .java:209)
  at
 
 org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeli
 ne(AbstractProcessingPipeline.java:368)
  at
 
 org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline
 .setupPipeline(AbstractCachingProcessingPipeline.java:297)
  at
 
 org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(Abs
 tractProcessingPipeline.java:475)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(Seri
 alizeNode.java:142)
  at
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
 keNodes(AbstractParentProcessingNode.java:83)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invok
 e(PreparableMatchNode.java:163)
  at
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
 keNodes(AbstractParentProcessingNode.java:83)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.invoke(ActTyp
 eNode.java:155)
  at
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
 keNodes(AbstractParentProcessingNode.java:83)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invok
 e(PreparableMatchNode.java:163)
  at
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
 keNodes(AbstractParentProcessingNode.java:107)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(Pipel
 ineNode.java:157)
  at
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
 keNodes(AbstractParentProcessingNode.java:107)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(Pipe
 linesNode.java:155)
  at
 
 org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcess
 or.java:327)
  at
 
 org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcess
 or.java:309)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNod
 e.java:131)
  at
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
 keNodes(AbstractParentProcessingNode.java:83)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invok
 e(PreparableMatchNode.java:163)
  at
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
 keNodes(AbstractParentProcessingNode.java:107)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(Pipel
 ineNode.java:157)
  at
 
 org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
 keNodes(AbstractParentProcessingNode.java:107)
  at
 
 org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(Pipe
 linesNode.java:155

Interpreted sitemap failing in 2.0.3

2002-08-03 Thread Tuomo Lesonen

I enabled the interpreted sitemap component in order to get the
cocoon:/ protocol workin properly. Everything looked nice, but then I
noticed that mounted sitemaps were not inheriting any components from
their parents. I wouldn't like to include same declarations in every
sitemap. I have the map:components, map:transformers etc. in all the
subsitemaps, some of them are empty though.

Any workaround?

ps. I tried 2.1-DEV already to get around this. It helped, but cocoon kept
sending blank pages after a while. This is not good either, but is
probably another issue?

-Tuomo


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Controlling the flow based on users role

2002-07-31 Thread Tuomo Lesonen

Hi,

Is there a way to protect resources in a
way that only
certain roles have access to them? Already tried Session Selector, but
I wasn't able to access the session context that the auth-login action
creates.

I'd also like to know if it's possible for a user to have multiple roles
defined (for example user could be an dbAdmin and user)

Ideas?

-Tuomo


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




SUMMARY: Deleting multiple rows with the modular DatabaseDeleteAction

2002-07-17 Thread Tuomo Lesonen

Thank you Chris, everything works ok now! :)

-Tuomo

On 15.Jul.2002 -- 01:40 PM, Tuomo Lesonen wrote:
 Hi,
 
 I can't figure out how to remove multiple rows with this action within a
 single request. Am I using the right syntax in HTML? :

Tuomo, you need to define a set with a master that determines
how many rows are affected. Look again at the sample, search for
slave and master. Since you have only one column, you only
need a master.

 
 form method=post action=delete.html
   input type=checkbox name=inventory.id value=10
   input type=checkbox name=inventory.id value=11
   input type=checkbox name=inventory.id value=12
 /form
 
 This seems to remove only one row from the table. Also tried...
 
 form method=post action=delete.html
   input type=checkbox name=inventory.id[10] value=10
   input type=checkbox name=inventory.id[11] value=11
   input type=checkbox name=inventory.id[12] value=12
 /form
 
 and in database.xml:
 
 table name=inventory
   keys
 key name=id type=int autoincrement=true
   mode name=request parameter=inventory.id[*] type=request 
set=master/
   mode name=auto type=autoincr/
 /key
   /keys
   values
 value name=displayname type=string/value
   /values   
 /table
 
 table is accessed from the sitemap with this set:
 
 table-set name=inventory
   table name=inventory others-mode=request/
 /table-set
 
 ...But doesn't work either, only throws with a nullpointer exception. 
 
 Cocoon 2.03 (dev)

I'd strongly suggest to use 2.1-dev since with that those actions were
moved to trunk (i.e. not scratchpad anymore). In addition, they contain
additions that are not found in 2.0.3

 Tomcat 4.04
 JDK 1.4.1
 MS SQL2000

Chris.

Please follow up summarizing your problem and which suggested solution
/ information worked for you when you consider your problem
solved. Add SUMMARY:  to the subject line. This will make FAQ
generation and searching the list easier. In addition, it makes
helping you more fun. Thank you.

-- 
C h r i s t i a n   H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Deleting multiple rows with the modular DatabaseDeleteAction

2002-07-15 Thread Tuomo Lesonen

Hi,

I can't figure out how to remove multiple rows with this action within a
single request. Am I using the right syntax in HTML? :

form method=post action=delete.html
  input type=checkbox name=inventory.id value=10
  input type=checkbox name=inventory.id value=11
  input type=checkbox name=inventory.id value=12
/form

This seems to remove only one row from the table. Also tried...

form method=post action=delete.html
  input type=checkbox name=inventory.id[10] value=10
  input type=checkbox name=inventory.id[11] value=11
  input type=checkbox name=inventory.id[12] value=12
/form

and in database.xml:

table name=inventory
  keys
key name=id type=int autoincrement=true
  mode name=request parameter=inventory.id[*] type=request/
mode name=auto type=autoincr/
/key
  /keys
  values
value name=displayname type=string/value
  /values   
/table

table is accessed from the sitemap with this set:

table-set name=inventory
  table name=inventory others-mode=request/
/table-set

...But doesn't work either, only throws with a nullpointer exception. 

Cocoon 2.03 (dev)
Tomcat 4.04
JDK 1.4.1
MS SQL2000

Has anyone done this? Help needed.

Tuomo



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]