After working the DOM for the past few days, I'm somewhat motivated to make my table row sorting demo support paging. In reality, it doesn't matter which table-sorting code I use, Erik Arvidsson has a nice example too. My logic is that I usually query a database and return all the rows for a particular table anyway, sometimes based on a search. Since I'm retrieving all these rows from the database, why not send them all to the UI. It might take a bit longer for the initial request, but then again, maybe not. I'm sure it's a different story for 10,000 records, but what if I only ever expect to have < 100 rows. Here's how I think I can do it:
1. Retrieve all the rows and put them in a table.
var rows = table.getElementsByTagName("tr")) with a rowIndex > 20 to
rows[i].style.display = "none".
3. When a user clicks on a page number, do the math and set
rows[i].style.display="none" to show/hide particular rows.
BTW, I've added support in my local copy of the
sortTable.js script to do sorting of <input> elements, as well as <select> elements. I can update the demo if anyone needs this functionality. Also, the W3C has a cool utility to check out what level of DOM support your browser has (based on user agent).
NOTE: I tried to manage my time today to be more productive, and succeeded at most things. I woke up at 3:30 this morning and got an hour and a half worth of editing done. I worked 8 1/2 hours at the office, and was home by 3:30. I was planning on working another 1 1/2 on editing, but it was a nice day so Julie, Abbie and I went on a hike at Red Rocks instead. I met a friend at 5:30 for an hour and a half of hoops, and returned home at 7:30. I got on this damn computer at 8:00 to do my evening editing, but instead ended up blogging and reading blogs for the last hour and a half. A month ago, I'd stay up late and still get my editing done. Not now, Abbie is much more fun and editing just doesn't sound interesting at all.
Patrick has published another excellent article on Tiles. This one is titled Tiles 201 and is about using Tiles Controllers. Good stuff to know - especially since I've never used a Tiles Controller (I might now!). I really like the clear and concise way that Patrick writes tutorials. I think we, as open source developers, should do more of this to better explain the technologies we use. So next time you're interested in learning something, I encourage you to write a tutorial on it - I'm willing to bet you'll learn and retain a lot more. If you don't understand something or make mistakes, I'm sure there are many Java Bloggers willing to help you get it right.
Patrick mentions that the Tiles Controller is not discusses in any of the existing Struts books. This sounds like an opportunity for me to include it in my chapter. With Patrick's simple and easily-understood example, this shouldn't take too much effort. Thanks Patrick - great stuff! One question I have - I know that these types of posts take a long time to create/edit and correct. Your blog says "sponsored by browsermedia" - does that mean you get paid to blog in a sense? Meaning - are you writing these articles at work?
If you're a TiVo owner, you've probably seen this upgrade offer in your TiVo messages. It looks awfully tempting:
Between now and March 10th (or while supplies last), we're offering you the one-time opportunity to make the switch to Series2 and transfer your product lifetime service. Ramp up your recording space to 80 hrs and gear up for Home Media Option.
For an additional $100, you can get the "Home Media Option" package and access MP3s, Photos, and schedule programs to record from the web. This is a good time management tool if you're a TV watcher. I grew up without a TV, so I don't really like watching TV and I think it's a waste of time. However, Julie is a TV addict - so much that she has to have it on all night while she sleeps. When I do watch TV, TiVo is a must.
I saw this nugget a few minutes ago on the struts-user mailing list. Maybe I'll even read it... ;-)
For those of you wondering how JSP technologies, including JSP 2.0,
JSTL, Struts and the upcoming JavaServer Faces (JSF) 1.0, can work
together with XML and XSLT, there is a new article at
TheServerSide.com about this subject.
The article presents the natural evolution of server-side Java
programming from basic servlet programming to JSP 2.0 with JSTL and
JSF, shows the limitations of the current JSF rendering architecture
and how XML technologies can solve them.
The article comes with sample code that shows how to hookup an XSLT
transformer with a JSP filter, and includes an experimental XML
renderer for JSF.
I won't be installing Tomcat 4.1.20 Alpha since Tomcat 4.1.18 has been working fine for me, but the changes are insteresting nonetheless.
Tomcat 4.1.20 Alpha is now available for testing.
Changes over Tomcat 4.1.19 include:
- Fix classloading failures when using Tomcat in JNI mode with JK 2
- Upgrade to Xerces 2.3.0
- Admin webapp fixes (including fixes to saving to server.xml)
- Disable recycling of sessions
- Refactoring of session persistence
- Disable socket linger in Coyote HTTP/1.1 (delay when closing a socket), and allow configuring it
- Allow cross context from the root context
- Documentation updates
- Fix memory leak in Jasper when compiling JSP pages
- Fix JspC, which may now be used again for complex webapps precompilation, such as Tomcat's own admin webapp
- Fix isThreadSafe feature in Jasper
- Fix JspWriter recycling after an exception was thrown in a tag's body content
The release notes include the full list of changes.
If you know of others, please comment with links and your experience.