Quick-fire question can a JSP output a different content type
such as Comma Separated Value file ``application/vnd.ms-excel' ?

I got a bean like O'Reilly Command SQL Bean and want to give
a surfer at choice at form-input time?

first JSP to output HTML table from DB

second JSP to output CSV table with content Type
(straight into Excel Spreadsheet)?



<jsp:useBean id="sqlBean"
        class="com.db.gdd3.emis.sql.ExpressoSQLCommandBean" >
    <jsp:setProperty name="sqlBean" property="connection"
        value="<%= conx %>" />
    <jsp:setProperty name="sqlBean" property="sqlValue"
        value="SELECT * FROM product_detail WHERE pd_name='Swaptions' " />
</jsp:useBean>



<%
        Vector rowsetData = sqlBean.executeQuery();
        request.setAttribute( "rowsetData", rowsetData );
%>

<table border="1" cellpadding="2" cellspacing="1" >
    <tr bgcolor="#0000CC" >
    <ora:loop name="sqlBean" property="columnNameList"
        loopId="columnName" className="java.lang.String" >
        <th>
        <font color="#FFFFFF" >
        <%= columnName %>
        </font>
        </th>
    </ora:loop>
    </tr>

<ora:loop name="rowsetData" loopId="row" className="Row" >
    <tr>
    <ora:loop name="row" property="columns"
        loopId="col" className="Column" >
        <td>
        <jsp:getProperty name="col" property="string" />
        </td>
    </ora:loop>
    </tr>
</ora:loop>
</table>



--
Peter Pilgrim
G.O.A.T
                    "the Greatest Of All Time"



--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to