initialize a java variable with an xml file tag's value
Hi, I wanna use a (maybe little bit extreme) solution but I don't know how. I want to make a single config file for users then use that file in the application. The config.xml file e.g ?xml version=1.0 encoding=ISO-8859-1? mysite driveroracle.jdbc.OracleDriver/driver urljdbc:oracle:thin:@192.168.0.115:1521:OEMMY/url usernamescott/username passwordtiger/password tableNamemytable/tableName /mysite Then in my application I want to use the username, driver, ... parameters as java variables from this xml (without using of session). So something like that: ?xml version=1.0 encoding=ISO-8859-1? xsp:page language=java xmlns:xsp=http://apache.org/xsp; ... xsp:logic // java code String url = //Here I want to use the value of driver from config.xml file. /xsp:logic ... /xsp:page Is there any solution without using of session? thanks, Gabor - 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]
esql tag instead of java ResultSet.getBytes()
Hi, I've got Cocoon 2.0.3. I'm developing an application and want to use esql for queries. Here is the following java statement: String metaName = new String(rs.getBytes(metaname),ASCII); Is there any esql template tag to be used instead of this java code, or any other solution? String metaName = esql:get-? column=metaname/; Regards, Gabor - 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: esql:get-string and java String
Hi, the java code: String formula = xspAttr.addAttribute( , column, column, CDATA, cd_formula ); this.contentHandler.startElement( http://apache.org/cocoon/SQL/v2;, get-string, esql:get-string, xspAttr ); xspAttr.clear(); this.contentHandler.endElement( http://apache.org/cocoon/SQL/v2;, get-string, esql:get-string ); ; If I try to use double () like this: String formula = ((String)esql:get-string column=formula/); I got ')' expected error, the source in this case: String formula = ((String) xspAttr.addAttribute( , column, column, CDATA, cd_formula ); this.contentHandler.startElement( http://apache.org/cocoon/SQL/v2;, get-string, esql:get-string, xspAttr ); xspAttr.clear(); this.contentHandler.endElement( http://apache.org/cocoon/SQL/v2;, get-string, esql:get-string ); ); Regards, Gabor Christian Haul wrote: On 30.Sep.2002 -- 05:12 PM, Gabor Bartha wrote: Hi, I want to use the esql:get-string method to initialize a java String object like this: xsp:logic String formula = esql:get-string column=formula/; /xsp:logic But I got incompatible types exception. If I tried to use casting: xsp:logic String formula = (String)esql:get-string column=formula/; /xsp:logic I got inconvertible types Exception. How can I use that variable as a java String object? I'm puzzled. Could you please post the lines from the resulting java code generated by the XSP? 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]
esql:get-string and java String
Hi, I want to use the esql:get-string method to initialize a java String object like this: xsp:logic String formula = esql:get-string column=formula/; /xsp:logic But I got incompatible types exception. If I tried to use casting: xsp:logic String formula = (String)esql:get-string column=formula/; /xsp:logic I got inconvertible types Exception. How can I use that variable as a java String object? thanks, Gabor - 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]
esql:parameter ?
Hi all, I want to use esql, but I've got problems with esql:parameter. It seems the parameter haven't been replaced by its real value. Here is my xsp, with a java function: xsp:logic private String createTable() throws SQLException, org.xml.sax.SAXException { String tableName = tmp123456; //Create table esql:connection esql:driver transactions=nooracle.jdbc.OracleDriver/esql:driver esql:dburljdbc:oracle:thin:@localhost:1521:OEMREP/esql:dburl esql:usernameSCOTT/esql:username esql:passwordTIGER/esql:password esql:execute-query esql:querycreate table esql:parameterxsp:exprtableName/xsp:expr/esql:parameter (id int not null primary key)/esql:query !--esql:error-results erroresql:get-message//error /esql:error-results-- /esql:execute-query /esql:connection return tableName; } /xsp:logic ... ... When I call the function from the xsp body I've got the following sql exception: Error executing statement: create table ? (cd_id int not null primary key): java.sql.SQLException: ORA-00903: invalid table name I tried to use the direction=in with the same result. Any Idea? Regards, Gabor - 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: esql:parameter ?
Ok it is working now, thanks Ugo yuryx wrote: try esql:queryxsp:exprcreate table + tableName/xsp:expr/esql:parameter Ugo Cei wrote: Gabor Bartha wrote: Hi all, I want to use esql, but I've got problems with esql:parameter. It seems the parameter haven't been replaced by its real value. You cannot have DDL statements with parametrized object names. At least, not in Oracle. Use string concatenation, if you must. Ugo Here is my xsp, with a java function: xsp:logic private String createTable() throws SQLException, org.xml.sax.SAXException { String tableName = tmp123456; //Create table esql:connection esql:driver transactions=nooracle.jdbc.OracleDriver/esql:driver esql:dburljdbc:oracle:thin:@localhost:1521:OEMREP/esql:dburl esql:usernameSCOTT/esql:username esql:passwordTIGER/esql:password esql:execute-query esql:querycreate table esql:parameterxsp:exprtableName/xsp:expr/esql:parameter (id int not null primary key)/esql:query !--esql:error-results erroresql:get-message//error /esql:error-results-- /esql:execute-query /esql:connection return tableName; } /xsp:logic ... ... When I call the function from the xsp body I've got the following sql exception: Error executing statement: create table ? (cd_id int not null primary key): java.sql.SQLException: ORA-00903: invalid table name I tried to use the direction=in with the same result. Any Idea? Regards, Gabor - 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] -- Best regards, Yury. -- Yury Mikhienko. IT engineer, ZAO Mobicom-Kavkaz - 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: session in xsp
Hi Luca, I have to change and check some of posted parameters' names and values. That's why I want to use an xsl (or anything else where I can define rules to changes) and cannot use a writeDOMSession transformer. After it I can use the writeDOMSession Gabor Luca Morandini wrote: Gabor, why don't you add a writeDOMSession transforming step ? You could generate an element using redefine-params.xsl with all the request paremeters you like, and then write that very element to the session. Best regards, - Luca Morandini GIS Consultant [EMAIL PROTECTED] http://utenti.tripod.it/lmorandini/index.html - -Original Message- From: Gabor Bartha [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 24, 2002 1:14 PM To: [EMAIL PROTECTED] Subject: session in xsp HI, I've got a page with input parameters, an action validate the parameters. If the validation (the action) is success I want to redefine parameters as get all posted parameters and put them to the session. I want it do in the redefine-params.xsl like here: map:match pattern=examples/xsp/welcome map:act type=form-validator map:parameter name=descriptor value=context:///mount/myapp/descriptor.xml/ map:parameter name=validate-set value=query/ map:transform src=stylesheets/redefine-params.xsl map:parameter name=use-request-parameters value=true/ /map:transform map:generate src=examples/xsp/searching.xsp/ map:transform src=stylesheets/simple-page2html.xsl/ map:serialize/ /map:act map:generate src=examples/xsp/query.xsp/ map:transform src=stylesheets/simple-page2html.xsl/ map:serialize/ /map:match how can I access the session from the redefine-params.xsl , because I want to put parameters into session but I cannot. Or is there any other solution to do this (define an own action is not acceptable for me)? Gabor - 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]
form validator
Hi, I've got a page with input parameters, I want to post it via formvalidator. I've got the descriptor.xml, with the required parameters. eg: ?xml version=1.0? root parameter name=persons type=long min=2 default=9 nullable=yes/ constraint-set name=car-reservation validate name=persons/ /constraint-set /root If I don't give value to the persons input parameter (at the site into the textbox) the formvalidator drop the default page back, not the next page. I don't understand Why? - I defined it with nullable=yes. So - I mean - if I define a parameter at the descriptor.xml I need to post it with an exact value? Thanks, Gabor - 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: form validator
I have Cocoon 2.0, might it be the problem? Vadim Gritsenko wrote: Gabor Bartha wrote: Hi, I've got a page with input parameters, I want to post it via formvalidator. I've got the descriptor.xml, with the required parameters. eg: ?xml version=1.0? root parameter name=persons type=long min=2 default=9 nullable=yes/ constraint-set name=car-reservation validate name=persons/ /constraint-set /root If I don't give value to the persons input parameter (at the site into the textbox) the formvalidator drop the default page back, not the next page. I don't understand Why? - I defined it with nullable=yes. So - I mean - if I define a parameter at the descriptor.xml I need to post it with an exact value? Do you have latest Cocoon release? Vadim Thanks, Gabor - 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]
javascript in xsl
Hi, How can I insert javascript into my generated html by xsl? I would like my final html like this: body head script language=javascript !-- .. .. .. //-- /script I have an xsp and an xsl stylesheet to generate the html. Gabor - 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: applet, module, Class.forName() - ClassNotFoundException
Hi Ilya the **.class is working fine. The trouble was with my jar file, it was obfuscated in a wrong way. Thanks again, Gabor Ilya A. Kriveshko wrote: You should match **.class. Not using ** definitely will not let you access .class files in sub-directories, and may simply be covering another problem with accessing the jar. After you re-enable **.class matching, attempt to access your jar by typing in its URL in the browser. Then, try to access the problematic .class by tying in the URL in the browser. Then, inspect the log files (WEB-INF/logs/access.log for which files are accessed, WEB-INF/logs/sitemap.log for how the file is served and for errors, and WEB-INF/logs/error.log just in case). If your browser can access the files individually, then Cocoon is doing its job, and the JVM should be able to access all the files as well. Look for the problem elsewhere. Can you also post the HTML code that is used to establish the applet? I wonder if there are issues with CODEBASE or ARCHIVE parameters? A couple of more hints: I assume that you had compiled your req class with package outclasses.needed; in the beginnning of the source file, and aren't simply placing the class file in the outclasses directory. Is that correct? Are you running your servlet container behind a web-server, like Apache? Or are you running, say, Tomcat directly on port 80? If it's the former, look at the web server's access log to determine which files are requested by the browser. Maybe some of them are not reaching the servlet container? A problem with JkMount, in case of Tomcat could be the issue. Try unpacking your jar into /myApp directory. Does that work? Alternatively, try putting your outer class files inside the jar. Does that work? I'm running out of suggestions. Need more info. -- Ilya Gabor Bartha wrote: Hi, summarized: I have an applet in a jar with outer classes (java modules). There are several classes in the jar and beside the jar. When the applet is running (from the jar) it finds the classes inside the jar, but is unable to find the classes beside the jar. I have the jar file: /myApp/main.jar I have the classes: /myApp/outclasses/needed/req.class /myApp/outclasses/eq.class When Class.forName(outclasses/needed/req) is called, ClassNotFoundExecption occures. I have pipeline for the jar, and for class: map:match pattern=*.jar map:read src={1}.jar mime-type=application/java-archive/ /map:match map:match pattern=*.class map:read src={1}.class mime-type=application/java-class/ /map:match If I use the map:match pattern=**.class pipeline, the classes inside the jar cannot be loaded, and ClassNotFoundException occures. Gabor - 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]
How to use session variables in XML (eg. JSP session variables)
HI, I have to write our JSP examples to XML. I'm wonder is there any solution in xsl/xslt or sitemap to use session variables as in jsp pages. Gabor - 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: applet, module, Class.forName() - ClassNotFoundException
It doesn't work. A few classes are in the jar, the others are beside the jar in the proper directories (as they are in the packages). During the running of the applet every class is loaded by the Class.forName(), ... method. - If I use map:match pattern=**.class the classes which are in the jar cannot be loaded. - If I use map:match pattern=*.class the classes which are beside the jar cannot be loaded. Gabor Vadim Gritsenko wrote: Gabor Bartha wrote: Hi All, I have a java applet in a jar file and there are several class files beside the jar, which files (modules) can be loaded by the applet with the Class.forName() and newInstance() methods. My applet works well as far as it has to load a module, at that time ClassNotFoundException occures. I put the following pipeline into my sitemap.xmap, but it is not working. map:match pattern=*.class If your classes are within some package (not in default package), you will have to match on **.class: map:match pattern=**.class Vadim map:read src={1}.class mime-type=application/java-class/ /map:match Can anybody help me? Gabor - 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]