Ups forget about my mail - I just figured it out :-)
 
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Jens Andersen
Sent: 30. december 1999 16:13
To: [EMAIL PROTECTED]
Subject: Output to a XUL/XML file

Hi JSP'ers,
 
I think my question is very trivial but I have to ask i anyway!! I would like the JSP page to get a resultset from a database and format the output so it look like a XUL file (Mozilla interface file)!! I have made the following code which you see below but I have a problem with the quote char. How do I make the following:
 
out.println("<menu item="New"/>")
 
And I can't use single quote because then the output will fail (Mozilla will fail)!!!! How do I it possible to output the <menu item="New"/> with double quotes???

Regrads,
J. Andersen

 
Server Configuration:
JRun 2.3.3 build 155
Microsoft Internet Information 4

<!-- jsp code -->
<%@ page import="java.sql.*,java.lang.*,com.sybase.jdbc.*,"%>
<%@ page contentType="text/xml; charset=ISO-8859-1" %>
<%
String port ="2638";
String servicename = "Eportal";
String dburl = "jdbc:sybase:Tds:10.42.1.1:" + port + "?ServiceName=" + servicename;
String username = "dba";
String password = "sql";
String jdbcdriver = "com.sybase.jdbc.SybDriver";
Connection con;
out.println ("<?xml-stylesheet href='chrome://global/skin/' type='text/css'?>");
out.println ("<!DOCTYPE window>");
out.println ("<html:title>JSP and XUL</html:title>");
out.println ("<window align=vertical xmlns:html=http://www.w3.org/TR/REC-html40 xmlns=http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul>");
out.println ("<box align=vertical flex=1 style=background: silver>");
out.println ("<menubar><menu value=File><menupopup>");

String query = "execute web_mainmenu";
        try{
            Class.forName("" + jdbcdriver + "");
        }catch(java.lang.ClassNotFoundException e){
  
  out.println ("<menuitem value="+ e.getMessage() +"/>");
        }
        try{
            con = DriverManager.getConnection(dburl, username, password);
            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery(query);
   while (rs.next()){
    String menu_id = rs.getString ("menu_id");
    String description = rs.getString ("description");
    String url = rs.getString ("url");
   out.println ("<menuitem value=" + description + "/>");
   }
            stmt.close();
            con.close();
        } catch(SQLException ex){
  out.println ("<menuitem value=" + ex.getMessage() + "/>");  
  }

out.println ("</menupopup></menu></menubar>");
out.println ("<splitter style=border: 1px;/>");
out.println ("<box flex=1 style=background: white;>");
out.println ("</box></box></window>");
%>

Reply via email to