Matt RaibleMatt Raible is a writer with a passion for software. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.
You searched this site for "form". 326 entries found.

You can also try this same search on Google.

JSF: Allows WebWork style Actions

Am I working too late or does JSF allow a WebWork style Action? According to this post, you can have your properties and your logic in the same class (like WebWork). Also, no more worrying about BeanUtils.copyProperties()?

Struts encourages you to use Strings for field values that might need conversion, in order to redisplay correctly in case of conversion errors. You don't need to worry about that with JavaServer Faces, because the redisplay is handled by the components themselves. You will generally use the native data types for your field properties.

Regardless of what the WW Developers say, I think I'm gonna dig Java Server Faces.

Posted in Java at Sep 17 2003, 07:03:34 PM MDT 5 Comments

Persistence Options with existing SQL

At my new gig, it's not an option to use Hibernate. Their data model is too complex, and they've already written a bunch of code and it's corresponding SQL to get the information they need (think lots of inner joins, stored procedures and selects in where clauses). It was my task last week to port all the JDBC from one project to a more general framework to be used by all the websites we're building. The existing code is in the following form:

PreparedStatement pstmt = 
    conn.prepareStatement("select * from table where id=?");
pstmt.setInt(1, id);
ResultSet rs = pstmt.executeQuery();
MyBean bean = new MyBean();
if (rs.next) {
    bean.set(...);
    ...
    bean.set(...);
}

After doing all my persistence with Hibernate for the last year, it made me cringe to have to resort to this archaic (though tried and true) way of populating my objects. So I pinged the struts-user mailing list and asked what my options where for populating an object from a ResultSet. Basically, I was looking for a 1-2 line solution that didn't affect performance too much. After jossling back and forth for a while, I came up with 2 options:

I did some performance testing and the ResultSetUtils class had the same performance numbers as rs.next() { set, set, set }, so it was definitely a viable solution. The downside? You have to name your resultset columns the same as your object's properties - and it's case sensitive. iBATIS was also a slick solution - as soon as I added <settings useBeansMetaClasses="false"/> to my sql-map-config.xml file, the performance was comparable to the ResultSet options (I turn it on when deploying, off for unit tests).

My Point: We're using iBATIS for our Persistence framework, and I dig it. It allows us to keep the complex SQL (externalized in XML files) that has already been written and it took me about a 1/2 hour to setup. I'd recommend Hibernate if you're starting a DB from scratch, but iBATIS seems to be a great solution when the SQL is already in place.

Will I add an iBATIS option to any of projects? Naahhh, then I'd have to work with Hibernate to export the SQL for each call, and I'd have to update my XML file's SQL everytime I change something in the DDL (currenly Hibernate and XDoclet perform this magic).

Posted in Java at Sep 15 2003, 07:17:30 AM MDT 1 Comment

PHP vs. Java - which is better?

I have a former client that has a customer. This customer asked them - "so when are you migrating from Java to PHP?" So evidently this person has the impression that the next wave of web applications will be written in PHP. My former client has asked me to provide an answer for their customer. If I translate it, I think they mean to ask "what is different between Java and PHP and why should we use Java over PHP." Here are my opinions - please add yours as you see fit. I must admit I don't know a whole lot about PHP, except that it's widely popular among the Linux/Apache/MySQL crowd and that it's similar to ASP in it's lack of a MVC architecture (yes, I know about the PHP MVC project).

  • I think Java is more of an industry standard, whereas PHP seems to be popular among hackers and hobbyists.
  • Java provides better separation of layers - key for testability. PHP has all the code embedded in the page, so you have to run it through a browser to test if database connections work (for instance).
  • Java is more scalable.
  • More folks know Java and it's easier to qualify someone's Java skills. How do you test someone knows PHP? Is there a certification?
  • More for-profit organizations use it.

If you're a Java or a PHP-lover, I'd love to hear your opionions (facts are always better). I'm going to point my client to this post, so keep it clean.

Posted in Java at Aug 22 2003, 03:52:33 PM MDT 98 Comments

Building high-content web applications

I've recently been tasked with rebuilding a JSP-based site using a Struts architecture. One of the issues (that I see) in the current architecture is that there are a number of JSPs with the text for the pages hard-coded in them. After re-writing this app, we plan on deploying it to 25+ customers - and we certainly don't want to have 25 different JSPs (with text) for each customer. I've proposed a database, but that might be a little resource intensive - so I'm wondering how folks have done this in the past (I'm sure it's been done before)?

Options I see are:

  • A Database table with the following columns (page_id, title, content, section_id).
  • Text files that are imported using <c:import url=""/>

What options have you used (feel free to add more) - if you've used the database approach - how do you define the page table? Maybe we should use the Roller way and use Velocity and OSCache.

Posted in Java at Aug 19 2003, 06:30:28 PM MDT 18 Comments

Hypersonic vs. Alienware

As I mentioned a couple days ago, I'm looking to purchase a new laptop. Why? Because I might get a contract that requires me to provide my own machine. It's happened before, and on this contract my machine sucked when I started. Sure I could use my slow-as-molasses Powerbook (667 MHz, 1 GB RAM), but I'd rather buy a Windows laptop. Besides, it's not about the machine's productivity as much as my productivity on it. I'm faster on Windows, so I should buy a Windows machine to pack to client sites. Mini-Me (the Powerbook) will be adopted by Julie, where I'm sure it will be in good hands. I still plan on using it a fair amount, but she's been known to tell me "Keep your damn hands off my computer!" ;-)

So, to do some more research on the Alienware Area-51m and the Hibersonic Aviator ZX7, I sent each company an e-mail. The e-mail was pretty simple, and I just switched the order of things for each company:

I'm looking to purchase a new laptop and right now I'm down to making a 
decision between your 51m (http://alienware.com/system_pages/area-51m.aspx) 
and Hypersonic's ZX7 (http://hypersonic-pc.com/ZX7).  Can you tell me why 
I should buy your product over Hypersonic's?

About 10 hours later (a little slow, don't you think), I received the first reply - from Hypersonic.

Fair enough, Hypersonic has a Customer Satisfaction rating of 7.79, but less than 20 reviews in the last 6 months. Alienware, on the other hand, has a 7.78 Customer Satisfaction Rating. So they're very close there. However, on the lifetime rating, Alienware is 7.63 (275 reviews) and Hypersonic is 9.17 (48 reviews). When I first started this comparison, I liked the Alienware machine better because it has 802.11g and because I've heard of the company before. I'd never heard of Hypersonic, but the ZX7 did have built-in bluetooth, a 17" monitor and a (supposedly) kick ass sound system. I don't travel, and if I do, it's usually for pleasure and I can always take Mini-Me.

So I replied to the Hypersonic e-mail above.

And I recieved a reply 6 1/2 hours later:

All good answers to my questions. So I'm feeling pretty good about Hypersonic at this point, and still haven't heard from Alienware. And then I got a response from them, almost 30 hours after I sent my original e-mail. It took about 4 sentences for me to realize they were just sending me a standard form-letter, filled with arrogance.

In the end, both still sound good, but I like the Bluetooth, 17" screen and sound system on the Hypersonic. I decided last night that I should probably buy this now, instead of waiting for a new contract. I want one too bad to pass up the opportunity (and it's a business write-off). At the new house, Raible Designs' HQ will be in the basement, so we'll be relying on our 802.11b network to surf the web, check e-mail, etc. from upstairs. I moved to two computers years ago because Julie and I would fight over one. It's bound to happen again unless we have two wireless laptops. How's that for justification?! I'm saving our marriage! what a good husband

Posted in General at Jul 25 2003, 08:53:20 AM MDT 4 Comments

New Theme for Roller?

I found Rowell Sotto's blog today via David Czarnecki. I immediately fell in love with Rowell's Moveable Type theme, and decided to implement in Roller. It was actually pretty easy. Check it out on my test site at http://raibledesigns.com/page/test. Things to do:

  • Get Rowell's permission to use it, and include it in Roller's default themes
  • Figure out what font the top logo uses and come up with an HTML-friendly equivalent

Good stuff - awesome theme Rowell!

Posted in Roller at Jul 24 2003, 05:16:47 PM MDT 10 Comments

Container Managed Authentication enhancements in Tomcat 5.0.4

When playing around with Tomcat 5.0.4 today, I noticed a couple improvements. I use container-managed security on all my apps, and there were a couple of things that annoyed me about 4.1.x:

  • When the user is routed to the form-login-page, the URL (i.e. "/login.jsp") appears in their browser's address bar. Therefore, when you try to do request.getRequestURL() (to find the URL they originally requested), you're SOL - you get "/login.jsp" instead.
  • I have a 400 (invalid reference to login page) error-page routing to index.jsp (which redirects to /do/mainMenu). This should allow a user to bookmark "/login.jsp" and, once authenticated, they will be routed to the mainMenu. In Tomcat 4.1.x, I get routed back to the login page, and the user has to login again to get to the mainMenu.

I'm happy to report that both of these bugs are fixed in Tomcat 5.0.4. When I'm routed to the login page, the browser's address bar says the URL I requested (/do/mainMenu), rather than "/login.jsp". Also, request.getRequestURL() does return the URL I originally requested, not the login page. This is awesome IMO b/c now users will not bookmark "/login.jsp". And even if they do type it in, my 400 error page routes them to "index.jsp" which goes to the main menu. All of this did not work in 4.1.24 and now it does in 5.0.4. I'm going to start using 5.0.4 for my dev environment. Oh yeah, Roller runs fine on it too. ;0)

Posted in Java at Jul 23 2003, 11:22:50 AM MDT 2 Comments

Upgrading to latest WebTest and Cactus

I attempted (and succeeded) in upgrading to the latest and greatest releases of Canoo's WebTest and Jakarta's Cactus this afternoon. It wasn't too bad. Both have revised their taskdef's to read from a properties file, and Cactus has simplified the process to include cactus-related JARs/mappings in your webapps. Now you can "cactify" your war with a little Ant-lovin:

<cactifywar srcfile="${webapp.dist}/${webapp.war}"
    destfile="${webapp.dist}/${webapp.name}-cactus.war">
    <lib dir="${strutstestcase.dir}" includes="*.jar"/>
    <lib dir="${cactus.dir}">
        <include name="*.jar"/>
    </lib>
</cactifywar>

Pretty slick IMO. Now if I could only figure out how to do form-based authentication with Cactus (I couldn't find it in the docs).

The other issue I've been banging my head against the wall over is running canoo/httpunit tests with a compression filter enabled. Yep, the problems still exist, despite the fact that I patched httpunit. So I've come up with a new fix that satisfies me and eases the pain in my noggin'. In my compression filter, I simply disabled compression when it's an httpunit test:

String userAgent = req.getHeader("User-Agent");
if (!isGzipSupported(req) || userAgent.startsWith("httpunit")) {
    // Invoke resource normally.
    chain.doFilter(req, res);
} else { 
    // gzip it
}

Posted in Java at Jul 15 2003, 07:05:36 PM MDT 2 Comments

Now sporting valid XHTML

Thanks to Will Gayther (no blog that I know of), this site now validates as XHTML 1.0 Transitional. You might recall that I had issues with the onload attribute of an iframe, but it was easily solved. Will suggested I put the onload into the <body> of my iframe's "src" document, but that seemed impossible, as the iframe doesn't have a source document - it's just submitted to. But he did turn me onto the solution. There is a function called when the form is submitted (onSubmitComments()), so I just called the function from there (instead of in the onload):

function onSubmitComments(aEntryId)
{
  gSubmittingComment = aEntryId;
  setTimeout("onCommentSubmitted()", 500); // wait 1/2 second
}

I don't expect you to care about any of this, just wanted to let you know I'm compliant again - or at least right now I am. Oh yeah, and I added this theme (sunsets) to Roller's CVS yesterday.

Posted in Roller at Jul 15 2003, 02:22:13 PM MDT Add a Comment

Search improvements and HowTo set your title

I did some re-factoring to the Google search box for this theme, and also figured out a slick trick to set your weblog's title to be == $lastPost.title. Basically, I refactored my _day template to add the search box when building the page, rather than after the fact.

You ask "why, I thought you loved the DOM?" I do, but it was giving me some strange behavior: in IE, a "entry" bar would show up in the middle of the last post (fixed by scrolling) and in Mozilla Firebird, I was getting a slight "shift-left 10px" behavior of the whole page. So I built it with Velocity, here's how. In my _day template, I changed this:

<div class="entry">
   #showDayPermalink( $day )
   #showEntryDate( $day )
</div>

To this:


<div class="entry">
#if ($velocityCount == 1) 
  <div id="search" style="float: right; margin-top: -2px">
    <form id="searchForm" method="get" onsubmit="return search()"
        action="http://www.google.com/search"
        style="margin: 0; padding: 0">  
        <input type="text" id="q" name="q" size="20" 
            maxlength="255" value="search this site" 
            style="font-size: 11px; border: 1px inset silver; 
                   font-weight: normal; padding-left: 2px"
            onclick="this.value=''" /> 
    </form>
  <script type="text/javascript">
    function search() {
        form = document.getElementById("searchForm");
        if (form.q.value == "search this site" || form.q.value == "") {
            alert("Please enter a search term to continue.");
            form.q.focus();
            return false;
        } else {
            form.q.value = form.q.value + " site:www.raibledesigns.com";
            form.submit();
        }
    }
    document.title="Raible Designs ~ $entries.get(0).title";
  </script>
  </div>
#end
   #showDayPermalink( $day )
   #showEntryDate( $day )
</div>

There's also a hint in there to set your weblog's title to match the title of your last post. Enjoy!

Posted in Roller at Jul 01 2003, 02:46:22 PM MDT Add a Comment