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 "struts". 659 entries found.

You can also try this same search on Google.

SSL switching with web.xml

Craig McClanahan explains how to force SSL using settings in your web.xml. Pretty cool stuff, I guess I didn't realize that you could have a <security-constraint> without having an <auth-constraint>. This sure seems a lot more straight forward than using SSLExt or a custom tag library.

Posted in Java at Sep 15 2003, 11:58:55 AM MDT 2 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

[ANNOUNCE] Struts Resume 0.8 Released!

The highlights of this release include rendering a resume with Velocity (demo), a password hint feature, self-registration feature, and a gzip compression filter. See the release notes below for a full list of changes. If you're looking to create a new application based on this architecture, you're best off using AppFuse.

Thanks to Russell Beattie for the Resume's XHTML template and to Mathias Bogaert for the Velocity RTF Templating idea.

Posted in Java at Sep 14 2003, 09:18:52 PM MDT

HowTo: Using XDoclet's StrutsForm and a 41KB j2ee.jar

To generate Struts' ActionForms using XDoclet, you need to have j2ee.jar in your classpath. Did you know you can trim it down to 41 KB and get all the functionality you need? Learn more...

Posted in Java at Sep 09 2003, 04:45:30 PM MDT 2 Comments

[ANNOUNCE] Hibernate 2.1 beta 3 Released

View the Release Notes, or Download. I won't be upgrading struts-resume or appfuse until 2.1 is released. Not much reason for me to upgrade, since I probably won't use any new features in these projects, but what the hell - upgrading is fun (and unit tests make it a breeze).

Update on Sunday: Beta 3b Released. Here's why:

  • removed Hibernate built-in PreparedStatement cache
  • made Hibernate.close() static

Posted in Java at Sep 06 2003, 11:51:29 AM MDT Add a 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

[ANNOUNCE] Struts Menu 1.3 Released!

Maybe I need to pay better attention. I didn't realize that Scott released the next version of Struts Menu 1.3. Feel free to check out my demo and then proceed to download it. I used the Tabbed Menu in my last project and the CoolMenu in the project at Comcast - both have been super easy to use and configure.

Posted in Java at Aug 18 2003, 09:38:32 PM MDT Add a Comment

Loving Java all over again

This past week has been hectic. I'be been pumping out what seemed to be a relatively small and simple application for a client. What was a simple 3-table 3-page application is now 14 tables and even more pages. But it's going awesome. It's the most productive I've ever been on a project - thanks to AppFuse, which is further backed up by the powerful Ant, XDoclet, JUnit, Struts and Hibernate.

The reason I've fell in love with Java all over again is I've re-discovered the power of reflection and inheritance. 8 of the 14 tables are child tables of a main "project table." As I noticed I was doing a lot of copy/paste in my DAOs, Services and Actions - I decided to reflection for all these child tables and now I have 3 methods on my DAOs (get/save/deleteProjectChild). Same goes for my Services and my Actions all share the same delete/edit/save methods in a BaseAction.

The only reason I even have child Actions is for URL beauty and to xdoclet-generate the action-mappings. Backed up by tons of JUnit, StrutsTestCase and WebTest test cases - it's been a breeze to refactor and enhance. I'm in love all over again.

Posted in Java at Aug 16 2003, 11:23:04 AM MDT 1 Comment

Tomcat 5.0.7 Alpha

Since java.blogs has already seen an announcement for Tomcat 5.0.7, there's no reason for me to do it as well. But, there is a very cool enhancement added to this release. From the changelog:

~ Allow putting a /META-INF/context.xml inside any WAR file

This allows much easier deployment IMO. Now you only need to deploy/upload one file, instead of the WAR file and a config (context.xml) file. However, this isn't part of the J2EE 1.4 spec, and other appservers have their own means of configuring - so this is not a portable solution. It would be very cool if there was a common way of doing this for Resin, Orion and Tomcat. I don't know how it would work, but maybe something like META-INF/tomcat-config.xml, META-INF/orion-config.xml, etc.

Posted in Java at Aug 11 2003, 09:11:12 AM MDT 6 Comments