Re: paging for web application

2001-02-14 Thread Matthew Harrison

Hi, 
we've been using the pager tags for a while on a prototype, and I'd like to
extend them with a "first" and "last" tag. We're also doing queries which bring
back many thousands of results. We'll be tuning our SQL later, but it works
fine. Did you put your results in a session attribute?

Also, I'm sure you can nest tags, but I think they have to be written to allow
the jsp compiler to interpret the body rather than just copy it. I need
desperately to get into writing tags to clean up our pages, and the pager taglib
fiddling might just be the intro I need.

As for putting the index above the results, maybe you could have an empty loop
to count the results, show the index, use the pager properties pagerOffset and
pagerMaxItems to display the just results for the current page in a second loop,
and then have a second index below. It does kind of defeat some of the logic
built into the pager tags, though, and it's a bit inefficient.
It's designed for arbitrary iterations, but it would be nice though to be able
to tell it how many things you're display without having to loop through it all,
but it seems fast enough for now. 

Matthew.

 > --
 > Date: Mon, 12 Feb 2001 15:36:05 -0700 (MST)
 > To: [EMAIL PROTECTED]
 > From: Steve A Drake <[EMAIL PROTECTED]>
 > Subject: Re: paging for web application
 > Message-ID: <[EMAIL PROTECTED]>
 > 
 > On Wed, 31 Jan 2001, Peter Alfors wrote:
 > 
 > > check out the pager taglib:  http://jsptags.com/tags/navigation/pager/
 > 
 >  Actually, I can run the example that comes with the distribution but am
 > having some problems using this pager taglib in Struts. The links created
 > by the pager aren't working.
 > 
 >  The example I'm working on has a JSP with an embedded form that, upon
 > submission, invokes a database query and reads back the results stored in
 > request scope beans (to the same JSP). The pager creates the correct
 > number of links to result pages. For example, one link created is:
 > 
 > http://localhost/project/simpleQuery.jsp?pager.offset=1
 > 
 > But when I click on this link I only get my simple query form and the
 > pager output of:
 > 
 > Result Pages [< 
 > but no other results. I've also tried typing in the URL:
 > 
 > http://localhost/project/simpleQuery.do?pager.offset=1
 > 
 > with the same result (or lack there-of).
 > 
 >  Ideas? Any help is appreciated!
 >  Sorry if this is off-topic for Struts.
 > 
 > --
 > 
 > Date: Mon, 12 Feb 2001 17:25:18 -0700 (MST)
 > To: [EMAIL PROTECTED]
 > From: Steve A Drake <[EMAIL PROTECTED]>
 > Subject: Re: paging for web application
 > Message-ID: <[EMAIL PROTECTED]>
 > 
 > On Mon, 12 Feb 2001, Steve A Drake wrote:
 > 
 > > On Wed, 31 Jan 2001, Peter Alfors wrote:
 > > 
 > > > check out the pager taglib:  http://jsptags.com/tags/navigation/pager/
 > > 
 > >  Actually, I can run the example that comes with the distribution but am
 > > having some problems using this pager taglib in Struts. The links created
 > > by the pager aren't working.
 > 
 >  Well, I did get this working but with a couple of major caveats. 
 > 
 > 1) In order to define a given , I had to use scriptlets for all
 > the code between the start and end tag. I assume this is because - from
 > what someone enlightened me earlier with - you can't nest tags. I hope
 > I'm wrong about this because it significantly clutters up the JSP and 
 > renders all the bean tags unusable. =:|
 > 
 > 2) I needed to locate the hypertext index at the bottom of the document
 > because the index dimensions are determined as the results are iterated. I
 > assume this could be fixed by buffering the output to a StringBuffer or
 > somesuch but havn't tried that yet.
 > 
 > If anyone has some usage suggestions for this pager taglib, I'd
 > appreciate your input.
 > 



Emacs and JSP

2001-02-12 Thread Matthew Harrison

 > - Original Message -
 > From: "Mike Campbell" <[EMAIL PROTECTED]>
 > To: <[EMAIL PROTECTED]>
 > Sent: Friday, February 09, 2001 2:02 PM
 > Subject: Re: Ted's FAQ "What Web sites are already Powered by Struts?"
 > 
 > > Not to start any sort of editor Jihad, but emacs does all the above
 > > mentioned stuff (plus tons more) and it's free.  (Works on NT, too.)
 > >
 > 
 > I've tried on three different occasions to learn emacs, but it works so
 > darned different from everything else on MS Windows that it just never
 > clicked.

Well, I'm happy enough with Emacs in general, but I've not yet managed to get a
nice JSP editing mode going. I've tried without success to get the multi-mode
thing going, are there any other suggestions (I develop on Linux - the Java
based editors are still a bit slow for me on Linux)?

cheers,

Matthew Harrison.



Re: Bad Multi-Threading Performances

2000-12-18 Thread Matthew Harrison

 > 
 > 
 > > > Since read access still predominates, I'm interested in code design patterns
 > > > that do not require locks for reads, but still deal with writes safely.  Anyone
 > > > have any good pointers?
 > 
 > >One approach is to use a readers/writers scheme where
 > >the readers are preferred, allowing multiple threads
 > >to read at the same time.  Synchronization is still
 > >required but only for short periods of time for
 > >checking sentinel values.  One would code like:
 > >
 > >// read method
 > >public Object someMethod() {
 > >  try {
 > >_lock.startReading(); // acquires and releases
 > >monitor
 > >// do some reading
 > >  } finally {
 > >_lock.stopReading();
 > >  }
 > >}
 > 

Have a look at the source for the javax.swing.text package. 
 The AbstractDocument class has a similar scheme: readLock()/readUnlock()
 writeLock()/writeUnlock()
 
 Or look at Doug Lea's Concurrent Programming in Java. Here's the online
 supplement with links to source code.
 
 http://gee.cs.oswego.edu/dl/cpj/
 
 
 Matthew Harrison.
 



1.0 taglibs

2000-12-04 Thread Matthew Harrison


Apologies if this has been answered before:

Am I right in thinking that classes that appear both in taglibs and taglibs.
packages are migrating to the taglibs. packages and will be deprecated in
taglibs? Or is there a conscious design decision to have them in both places?

thanks in advance,

Harry.



Re: Stable 1.0 and deployment ....

2000-12-04 Thread Matthew Harrison

Sorry to be picky, but when you say "current", I assume you mean
current development (1.0)? I have the same concerns as Allton.

cheers,

Matthew Harrison.


[EMAIL PROTECTED] writes:
 > 
 > Date: Thu, 30 Nov 2000 11:50:18 -0800
 > To: [EMAIL PROTECTED]
 > From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
 > Subject: Re: Stable 1.0 and deployment 
 > Message-ID: <[EMAIL PROTECTED]>
 > 
 > Allton Paul wrote:
 > 
 > > Sorry to bug, but is there a planned release date for a milestone 1.0
 > > release?
 > >
 > > Just made the decision to go with Struts and I've been playing with v0.5.
 > > I'm looking to use it in a production environment so I'm not keen on using
 > > unstable releases ... but I also dont want to use 0.5 if there are going to
 > > be major changes 
 > >
 > > In a nutshell should I deploy with 0.5 now, or is 1.0 immenient?
 > >
 > 
 > It is relatively imminent ... but I had to spend a very large amount of November
 > picking up the pieces and getting Tomcat 3.2 out the door (final release was
 > last night).  :-(
 > 
 > There have been very substantial changes between 0.5 and the current code base.
 > I would expect relatively few incompatible changes from the current code to
 > final release, although there will probably need to be some as we implement the
 > remaining suggestions and features.
 > 
 > Personally, I would base new development on the current code.