You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eric Everman <ev...@precedadesign.com> on 2004/09/09 20:25:07 UTC

OFF TOPIC - Choosing a Scripting Language

Hi All-

This question is way off topic, but I think those involved in Tapestry 
might have a good shot at helping me:

I am building dynamic SQL select statements based on parameter values 
held in Java classes.  I wanted a way to easily create templates for 
the queries and fill-in the values, so I used JSP pages that generates 
SQL instead of HTML.  When the server needs a particular SQL statement, 
it generates an internal http request with the appropriate parameter 
values and gets back the resulting SQL from the JSP page.

This has worked rather well, except it has resulted in a lot of 
dependancies:  I have to be in a web container, the page and the code 
requesting the page have to agree on parameter names, templates have to 
be placed in a web-servable location.

So, I'm wondering if anyone has a suggestion on a better approach.  
Ideally, I'd like to create a template similar to a Tapestry page that 
could use OGNL (or something like it) to directly access a set of Java 
classes.  Ideally, the template would be just that - a template in 
which non-code text is simply 'returned', and code is evaluated.  Is 
there some type of OGNL (or other) container that would let me do 
something like this:


String query = evaluate("/com/mycom/templates/raw.txt", myContext);

================= /com/mycom/templates/raw.txt   ================
SELECT * FROM MYTABLE WHERE col1=<% context.values.value('col1') %> AND 
[some other really complex stuff using IF THEN ELSE logic]
================= end raw text file ================

Thanks in advance,
Eric Everman


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: OFF TOPIC - Choosing a Scripting Language

Posted by Harish Krishnaswamy <ha...@gmail.com>.
iBATIS is the way to go for this. I have done quite a bit of dynamic
sql myself using iBATIS and I can certainly vouch for it.

-Harish

On Thu, 9 Sep 2004 13:25:07 -0500, Eric Everman
<ev...@precedadesign.com> wrote:
> Hi All-
> 
> This question is way off topic, but I think those involved in Tapestry
> might have a good shot at helping me:
> 
> I am building dynamic SQL select statements based on parameter values
> held in Java classes.  I wanted a way to easily create templates for
> the queries and fill-in the values, so I used JSP pages that generates
> SQL instead of HTML.  When the server needs a particular SQL statement,
> it generates an internal http request with the appropriate parameter
> values and gets back the resulting SQL from the JSP page.
> 
> This has worked rather well, except it has resulted in a lot of
> dependancies:  I have to be in a web container, the page and the code
> requesting the page have to agree on parameter names, templates have to
> be placed in a web-servable location.
> 
> So, I'm wondering if anyone has a suggestion on a better approach.
> Ideally, I'd like to create a template similar to a Tapestry page that
> could use OGNL (or something like it) to directly access a set of Java
> classes.  Ideally, the template would be just that - a template in
> which non-code text is simply 'returned', and code is evaluated.  Is
> there some type of OGNL (or other) container that would let me do
> something like this:
> 
> String query = evaluate("/com/mycom/templates/raw.txt", myContext);
> 
> ================= /com/mycom/templates/raw.txt   ================
> SELECT * FROM MYTABLE WHERE col1=<% context.values.value('col1') %> AND
> [some other really complex stuff using IF THEN ELSE logic]
> ================= end raw text file ================
> 
> Thanks in advance,
> Eric Everman
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: OFF TOPIC - Choosing a Scripting Language

Posted by Michael Henderson <mh...@mac.com>.
Hi,
    never used it but iBatis might work for you (search on google to 
find it.

Mike


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: OFF TOPIC - Choosing a Scripting Language

Posted by Eric Everman <ev...@precedadesign.com>.
Omar-

I am aware.  The data coming in from the context classes is heavily 
checked and the login we use is read-only.  This is a concern, but we 
simply cannot do what we need to do using prepared statements - nice 
though it sounds.

--ee


On 9 Sep 2004, at 13:32, Omar Valerio wrote:

> ¿Have you ever heard about sql injection? Looks like you are querying
> your database without previously validating your input.
>
> Omar V.M.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: OFF TOPIC - Choosing a Scripting Language

Posted by Omar Valerio <om...@gmail.com>.
¿Have you ever heard about sql injection? Looks like you are querying
your database without previously validating your input.

Omar V.M.

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: OFF TOPIC - Choosing a Scripting Language

Posted by David Solis <h....@gmail.com>.
There are other alternatives to iBatis SqlMap.
Cayenne has a powerful feature named named SQLTemplate for dynamic SQL
generation using Velocity for query customization. Hibernate 3 has a
similar feature.
Both provide iBatis like functionality.

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: OFF TOPIC - Choosing a Scripting Language

Posted by Jeff Emminger <ma...@jeffemminger.com>.
are you looking for something like hibernate (http://www.hibernate.org/) 
or cayenne (http://objectstyle.org/cayenne/)?


Eric Everman wrote:
> Hi All-
> 
> This question is way off topic, but I think those involved in Tapestry 
> might have a good shot at helping me:
> 
> I am building dynamic SQL select statements based on parameter values 
> held in Java classes.  I wanted a way to easily create templates for the 
> queries and fill-in the values, so I used JSP pages that generates SQL 
> instead of HTML.  When the server needs a particular SQL statement, it 
> generates an internal http request with the appropriate parameter values 
> and gets back the resulting SQL from the JSP page.
> 
> This has worked rather well, except it has resulted in a lot of 
> dependancies:  I have to be in a web container, the page and the code 
> requesting the page have to agree on parameter names, templates have to 
> be placed in a web-servable location.
> 
> So, I'm wondering if anyone has a suggestion on a better approach.  
> Ideally, I'd like to create a template similar to a Tapestry page that 
> could use OGNL (or something like it) to directly access a set of Java 
> classes.  Ideally, the template would be just that - a template in which 
> non-code text is simply 'returned', and code is evaluated.  Is there 
> some type of OGNL (or other) container that would let me do something 
> like this:
> 
> 
> String query = evaluate("/com/mycom/templates/raw.txt", myContext);
> 
> ================= /com/mycom/templates/raw.txt   ================
> SELECT * FROM MYTABLE WHERE col1=<% context.values.value('col1') %> AND 
> [some other really complex stuff using IF THEN ELSE logic]
> ================= end raw text file ================
> 
> Thanks in advance,
> Eric Everman
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: OFF TOPIC - Choosing a Scripting Language

Posted by Nicholas Lesiecki <nl...@vmsinfo.com>.
Without reading your email too closely, OGNL looks perfect for this. I've
done simple email templates with OGNL and it worked great.

Cheers,
nick

-----Original Message-----
From: Eric Everman [mailto:everman@precedadesign.com] 
Sent: Thursday, September 09, 2004 11:25 AM
To: Tapestry users
Subject: OFF TOPIC - Choosing a Scripting Language

Hi All-

This question is way off topic, but I think those involved in Tapestry 
might have a good shot at helping me:

I am building dynamic SQL select statements based on parameter values 
held in Java classes.  I wanted a way to easily create templates for 
the queries and fill-in the values, so I used JSP pages that generates 
SQL instead of HTML.  When the server needs a particular SQL statement, 
it generates an internal http request with the appropriate parameter 
values and gets back the resulting SQL from the JSP page.

This has worked rather well, except it has resulted in a lot of 
dependancies:  I have to be in a web container, the page and the code 
requesting the page have to agree on parameter names, templates have to 
be placed in a web-servable location.

So, I'm wondering if anyone has a suggestion on a better approach.  
Ideally, I'd like to create a template similar to a Tapestry page that 
could use OGNL (or something like it) to directly access a set of Java 
classes.  Ideally, the template would be just that - a template in 
which non-code text is simply 'returned', and code is evaluated.  Is 
there some type of OGNL (or other) container that would let me do 
something like this:


String query = evaluate("/com/mycom/templates/raw.txt", myContext);

================= /com/mycom/templates/raw.txt   ================
SELECT * FROM MYTABLE WHERE col1=<% context.values.value('col1') %> AND 
[some other really complex stuff using IF THEN ELSE logic]
================= end raw text file ================

Thanks in advance,
Eric Everman


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org