cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Widdershoven <...@dds.nl>
Subject Re: Generic Table printout for Oracle ORDBMS
Date Sun, 18 Apr 2004 16:04:37 GMT
An example of a fully generic table results thing, without any error 
checking, done with
xsp/esql:

<snip/>
    <xsp:logic>
        String query = <request:get-parameter name="query"/>;
        if ( query == null || query.equals("") ) {
            <b>EMPTY QUERY - EXIT</b>
        } else { // Closing near /body
        </xsp:logic>
       
        <esql:connection>
        <esql:pool>myConnection</esql:pool>
        <esql:execute-query>
          <esql:query>
            <xsp:expr>query</xsp:expr>
          </esql:query>
        <esql:results>
        <table>
            <tr>
            <xsp:logic>
                int count = <esql:get-column-count/>;
                for ( int i=0; i &lt; count; i++ ) {
                    // sql first column is 1
                    String name = <esql:get-metadata/>.getColumnName( i 
+ 1 );
                    <xsp:content>
                    <th><xsp:expr>name</xsp:expr></th>
                    </xsp:content>
                }
            </xsp:logic>
                </tr>
          <esql:row-results>
              <tr>
                <xsp:logic>
                for ( int i=0; i &lt; count; i++ ) {
                    String val = <esql:get-string>
                        <esql:param 
name="column"><xsp:expr>i+1</xsp:expr></esql:param></esql:get-string>;
                    <xsp:content>
                    <td>
                        <xsp:expr>val</xsp:expr>
                    </td>
                    </xsp:content>
                }
                </xsp:logic>

            </tr>
          </esql:row-results>
          </table>
        </esql:results>
<snip/>
    <xsp:logic>
    }
    </xsp:logic>

Leon Widdershoven wrote:

> Hi Frank,
>
> you might want to visit www.w3schools.com. Lot's of simple tutorials 
> there.
>
> If you really need books, consider Safari.oreilly.com. You have access 
> to quite a lot of books
> there. You could at least take the 14 day trial (free) and review the 
> books you want. There
> even is a cocoon book in there! (Search for cocoon).(Cocoon: Building 
> XML Applications)
>
> Hint to Mathew Langham, Carsten Ziegler: Update the book with  a 
> chapter about flowscript:)
>
> Leon
>
>
> Frank Thilo Mueller wrote:
>
>> Thank you both very much.
>>
>> Theres an FAQ/tutorial for such simple questions ?
>>
>> I would not have known which keyword I should have used for searching.
>>
>> Thilo
>>
>> (*start to thing XML, thing XML, THING XML *)
>>
>>  
>>
>>> The key is that the macro needs to determine whether it's a string or a
>>> number to deal with. A string would translate to a column name while a
>>> number would translate to a - well - column number.
>>>   
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>  
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message