You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tuncay Baskan <tb...@superonline.com> on 2002/06/15 15:24:18 UTC

Any database tag for simple selects?

Struts still is somewhat cumbersome for me. It needs time to master it
perhaps, and probably I have some way to go.

My first question: Is there any tag library that are used only for
presenting some database data on JSPs?
A conceptual tag library like the following would be helpful, IMHO. 

  <db:select id="attr" query="SELECT name,description FROM mytable">
    <mylogic:iterate name="attr">
       name=<mylogic:write col="1">,
       description=<mylogic:write col="2"><br>
    </anotherlogic:iterate>
  </db:select>

Instead of developing beans, one may quicly create a JSP do display some
data from a data source.

Second question is related with the first one. I don't have a long timed
background with Application Servers, Tomcat or struts. Isn't there any
impact on performance by using beans everywhere? I mean for a simple
"select" on database and show in a JSP I need a Collection that contains
all my rows as beans and later use with logic:iterate. I have a very
long background on web development with PHP, Tcl (Aolserver) Perl etc.
It's OK to seperate view from application logic, but isn't it very
cumbersome?

I downloaded artimus to learn something from. It was a waste of time. 
Developing a system like artimus seems too much work. Is it that hard?
Framework over framework? I mean the "scaffold" thing.

I agree "design" is the most period of a development process. A small
system with only a few pages seems to take days or weeks. But there
aren't there time-to-market restrictions? 

Please don't get me wrong, there is no offence. I just want to
understant the picture better. Again please don't get me wrong.

/tb.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Any database tag for simple selects?

Posted by Ted Husted <hu...@apache.org>.
Tuncay Baskan wrote:
> Please don't get me wrong, there is no offence. I just want to
> understand the picture better. Again please don't get me wrong.

These links might help:

http://www.servlets.com/soapbox/problems-jsp.html

http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html


-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


printing string with CRLF

Posted by Keith Chew <ke...@jungledrum.co.nz>.
Hi

I have:

private String = "This is a test.\n This is the second line";

When I use a <bean:write>, I loose the new line. Is there something I can
specify to make the tag output a <br> for a newline?

Keith


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Encrypting/hiding querystring

Posted by Don Saxton <ds...@pacbell.net>.
could just SSL the page.

----- Original Message -----
From: "rayaku" <ya...@nous.soft.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>;
<te...@husted.com>
Sent: Friday, May 10, 2002 9:51 AM
Subject: Encrypting/hiding querystring


> Hi,
> Does struts 1.0.2 support encrypting/hiding the querystring that is with
<a
> href=""> element.
> There are several html:link elements in struts which almost do the same
job
> of html <a href>,
> So is there any way to encrypt querystring information by html:link tags
or
> any other way to deal this.
>
> I have several <a href="">  elements in jsp page and user can see what is
> attached
> to request and with this user can make application instable by filling up
> some dummy data or deleting the query string, At server side when an
Action
> class is trying
> to read this by using request.getParameter() it will get invalid
information
> that looks
> nasty.
>
> TIA
> rayaku
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Encrypting/hiding querystring

Posted by Andrew Hill <an...@gridnode.com>.
I could be wrong, but I dont think there is much you can do about the query
string showing in the browser bar when you use a GET request (as results
from <a href="... ).

Now one thing you could do, but will probably prove impractical is to use a
POST request.

(Im presenting this idea more for your interest than as a practical
suggestion to implement. Its rather troublesome and doesnt get you very much
further in terms of the problem your having, but the info may be useful for
other things you do)

This would require the query parameters in hidden input fields on the form
(or more likely a seperate form on the same jsp or html page). The href for
your <a> now calls a javascript method.
I have a lot of forms with this script:

function submitWithMethod(sMethod)
{
	document.XXX.elements['method'].value=sMethod;
	document.XXX.submit();
}

where XXX is the name of the form.
The form has a hidden field 'method' (in your case the hidden fields
correspond to your own query parameters.)

My <a> tags look something like:
<a id="cancel" href="javascript:submitWithMethod('cancel');">Cancel</a>

And when submitted the query will be posted to the URL identified in that
forms action attribute.

Of course a user could always write up their own html page that submits to
that url and pass garbage parameters so you have only made it less
convienient to them to do so, and added a lot of work for yourself (I do
this stuff in my forms for other reasons - mostly related to my use of
DispatchActions).

Really any url a user can type in is fair game and your application must be
prepared to handle such input, however, if the user is going to start typing
in garbage urls then you dont have any obligation to provide them nice
handling of such garbage. Feel free to give them big nasty exception
messages as its their fault for trying to hack the system instead of using
the links provided;-)

regards
Andrew

-----Original Message-----
From: rayaku [mailto:yamank@nous.soft.net]
Sent: Saturday, May 11, 2002 00:51
To: Struts Users Mailing List; ted@husted.com
Subject: Encrypting/hiding querystring


Hi,
Does struts 1.0.2 support encrypting/hiding the querystring that is with <a
href=""> element.
There are several html:link elements in struts which almost do the same job
of html <a href>,
So is there any way to encrypt querystring information by html:link tags or
any other way to deal this.

I have several <a href="">  elements in jsp page and user can see what is
attached
to request and with this user can make application instable by filling up
some dummy data or deleting the query string, At server side when an Action
class is trying
to read this by using request.getParameter() it will get invalid information
that looks
nasty.

TIA
rayaku


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Encrypting/hiding querystring

Posted by rayaku <ya...@nous.soft.net>.
Hi,
Does struts 1.0.2 support encrypting/hiding the querystring that is with <a
href=""> element.
There are several html:link elements in struts which almost do the same job
of html <a href>,
So is there any way to encrypt querystring information by html:link tags or
any other way to deal this.

I have several <a href="">  elements in jsp page and user can see what is
attached
to request and with this user can make application instable by filling up
some dummy data or deleting the query string, At server side when an Action
class is trying
to read this by using request.getParameter() it will get invalid information
that looks
nasty.

TIA
rayaku


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Any database tag for simple selects?

Posted by Ted Husted <hu...@apache.org>.
Scaffold is a reusable package, like the Validator or Tiles. The only
part that needs to be developed for Artimus is what is under the Artimus
package. The rest is reusable, like the Struts framework itself. After
this development phase, the two will be split back out again.

The nice things about Struts is that simple things can be simple. If you
don't want to go whole-hog on the Model/MVC thing, you can still use
Model 1 strategies (like those used by PHP, ASP, and ColdFusion) where
you like, and Model 2 where you need it. 

Later, if the application outgrows Model 1 (and most of us have been
there), you'd still be in a good position to refactor your application
to use a Model 2/MVC artitechture. The real justification of Model 2/MVC
is not time-to-market, it's the time-after-market, where 80% of most
budgets are spent. The prime consumer of Struts seem to be intranet
installations where they not only have to ship the code, but maintain
and improve it over the longterm.

Incidentally, the Struts generic connection pool does play well with
tag-based systems. The datasource is stored in the servlet context
under, where many tags can get at it. The default token is
"org.apache.struts.action.DATA_SOURCE", but you can also configure it
for a shorter name if you like. Besides the JSTL, there is also the
dbTags library 

	http://jakarta.apache.org/taglibs/doc/dbtags-doc/intro.html

For database centric applications, another interesting framework is 

	http://www.dbforms.org/

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Any database tag for simple selects?

Posted by Tuncay Baskan <tb...@superonline.com>.
Great thanks!

On Sat, 2002-06-15 at 16:50, James Holmes wrote:
> Take a look at the JSTL:
> 
> http://jakarta.apache.org/taglibs/index.html
> 
> -james
> james@jamesholmes.com
> http://www.jamesholmes.com/struts/
> 
> 
> --- Tuncay Baskan <tb...@superonline.com> wrote:
> > Struts still is somewhat cumbersome for me. It needs
> > time to master it
> > perhaps, and probably I have some way to go.
> > 
> > My first question: Is there any tag library that are
> > used only for
> > presenting some database data on JSPs?
> > A conceptual tag library like the following would be
> > helpful, IMHO. 
> > 
> >   <db:select id="attr" query="SELECT
> > name,description FROM mytable">
> >     <mylogic:iterate name="attr">
> >        name=<mylogic:write col="1">,
> >        description=<mylogic:write col="2"><br>
> >     </anotherlogic:iterate>
> >   </db:select>
> > 
> > Instead of developing beans, one may quicly create a
> > JSP do display some
> > data from a data source.
> > 
> > Second question is related with the first one. I
> > don't have a long timed
> > background with Application Servers, Tomcat or
> > struts. Isn't there any
> > impact on performance by using beans everywhere? I
> > mean for a simple
> > "select" on database and show in a JSP I need a
> > Collection that contains
> > all my rows as beans and later use with
> > logic:iterate. I have a very
> > long background on web development with PHP, Tcl
> > (Aolserver) Perl etc.
> > It's OK to seperate view from application logic, but
> > isn't it very
> > cumbersome?
> > 
> > I downloaded artimus to learn something from. It was
> > a waste of time. 
> > Developing a system like artimus seems too much
> > work. Is it that hard?
> > Framework over framework? I mean the "scaffold"
> > thing.
> > 
> > I agree "design" is the most period of a development
> > process. A small
> > system with only a few pages seems to take days or
> > weeks. But there
> > aren't there time-to-market restrictions? 
> > 
> > Please don't get me wrong, there is no offence. I
> > just want to
> > understant the picture better. Again please don't
> > get me wrong.
> > 
> > /tb.
> > 
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Any database tag for simple selects?

Posted by James Holmes <jh...@yahoo.com>.
Take a look at the JSTL:

http://jakarta.apache.org/taglibs/index.html

-james
james@jamesholmes.com
http://www.jamesholmes.com/struts/


--- Tuncay Baskan <tb...@superonline.com> wrote:
> Struts still is somewhat cumbersome for me. It needs
> time to master it
> perhaps, and probably I have some way to go.
> 
> My first question: Is there any tag library that are
> used only for
> presenting some database data on JSPs?
> A conceptual tag library like the following would be
> helpful, IMHO. 
> 
>   <db:select id="attr" query="SELECT
> name,description FROM mytable">
>     <mylogic:iterate name="attr">
>        name=<mylogic:write col="1">,
>        description=<mylogic:write col="2"><br>
>     </anotherlogic:iterate>
>   </db:select>
> 
> Instead of developing beans, one may quicly create a
> JSP do display some
> data from a data source.
> 
> Second question is related with the first one. I
> don't have a long timed
> background with Application Servers, Tomcat or
> struts. Isn't there any
> impact on performance by using beans everywhere? I
> mean for a simple
> "select" on database and show in a JSP I need a
> Collection that contains
> all my rows as beans and later use with
> logic:iterate. I have a very
> long background on web development with PHP, Tcl
> (Aolserver) Perl etc.
> It's OK to seperate view from application logic, but
> isn't it very
> cumbersome?
> 
> I downloaded artimus to learn something from. It was
> a waste of time. 
> Developing a system like artimus seems too much
> work. Is it that hard?
> Framework over framework? I mean the "scaffold"
> thing.
> 
> I agree "design" is the most period of a development
> process. A small
> system with only a few pages seems to take days or
> weeks. But there
> aren't there time-to-market restrictions? 
> 
> Please don't get me wrong, there is no offence. I
> just want to
> understant the picture better. Again please don't
> get me wrong.
> 
> /tb.
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>