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 "matt". 663 entries found.

You can also try this same search on Google.

WebWork and JDD

I attended the Boulder Frameworks meeting tonight on WebWork, followed by the Boulder JUG meeting. The WebWork (a.k.a. WW) presentation had a mere 5 attendees, but Kris gave a very good overview of WW and showed how simple it was. Here are some of the strengths of WW according to Kris:

  • It's not dependent on J2EE. Many method signatures are empty and it uses interfaces everywhere, rather than parent classes. Sounds cool. Kris likes it because "it gives you a warm fuzzy feeling you're not tied to WW."
  • It's not Jakarta. "Jakarta is like a Ketchup bottle - you have to beat it to get anything out of it." I don't know that the WW team produces software much faster than Jakarta though...
  • Instead of using the HttpServletRequest, WW uses a Stack, which is essentially the same thing (sans J2EE).
  • WebWork has Interceptors. They're like Filters, but WW comes with built-in Interceptors that can be applied declaratively. Kris mentioned there's little documentation on the built-in Interceptors - a wiki page would be nice.
  • Action packaging - you can turn a portion of your WW application into a jar and it can be added to another WW application. It sounds good, but I can't think of a use for it right now. Sounds like modules in Struts.

Kris's biggest reasons for liking WW was Interceptors and Inversion of Control. However, Struts has those too. Good presentation. I plan to learn WW and give up this whole my framework is better than yours stance. In fact, I hope to do this with many of the technologies I use everyday. I'm going to start using Orion and Resin so I know if Tomcat really is better, or better yet - when should I use one appserver or the other. I'm learning IDEA so I know when to use Eclipse and when to use IDEA. Today I discovered how IDEA warns me about invalid Javadocs (very nice feature). Eclipse continues to rule the CVS integration world, and I see no reason to quit using it and bitch about IDEA's lack of CVS integration.

After WW, I walked across the hall to listen to James Duncan Davidson talk about "James Driven Development" (my phrase) - also known as Objective Object Orientation. Rather than bore you with the details, here are the highlights:

  • Don't abstract too much - just enough to fit your needs. Examples of too much abstraction can be found in Apache's Repositories (James's words - he didn't specify any projects).
  • Don't extend, instead create objects do something, then you don't need to know the interworkings of the object.
  • Dynamically typed languages rock (i.e. Smalltalk, Ruby, Python). They're much easier to develop with, especially when backed my TDD. You can accomplish similar things in Java using lots of casting.
  • He can't wait until something comes along and kills Ant and Tomcat - he never thought they'd make it this far - especially considering he wrote them when he was a Junior Programmer for Sun. He gave Tomcat its name because he thought it'd be good animal on the book cover of an O'Reilly book. He never thought it would happen, and now that it does have a book, he said he's disappointed it's not an actual Tomcat (apparently it's a snow leopard?).

His point about Ant and Tomcat is that 1) something better than Ant will rock, so we should all be happy when something better comes along and 2) Tomcat was never designed (or tested) to be used in the environments its being used in (i.e. Nuclear Facilities). Good stuff - brain is full.

Posted in Java at Oct 09 2003, 11:29:22 PM MDT 7 Comments

Monitor Connections in SQL Server

Does anyone know how to monitor the number of Connections in SQL Server? In MySQL, I use "mysqladmin processlist", but there doesn't seem to be such a utility for SQL Server. I need to make sure that my connections are getting closed properly.

Posted in Java at Oct 06 2003, 04:54:46 PM MDT 4 Comments

Dynamic Queries with Hibernate

I have a client that wants the ability to search on all columns in all tables in their database. So far, I've been able to get all the columns, and their friendly labels by getting all the *Form.* keys in my ApplicationResources.properties file. I still need to sort them alphabetically, but that's another issue. Now I have the following UI pretty much done:

I'm happy with the UI, but I'm struggling with getting Hibernate to return my desired results. I'm able to dynamically select the table/column to search on because of values in my "tables/columns" drop-down. However, many of these tables have Id fields - for status fields, type fields, etc. (basically drop-downs). When searching, this is a pain because users are likely to search on "Active" rather than "1". Because of this, my first issue is how do I make the status field's friendly name a part of my POJO (with Hibernate)?

My 2nd issue is regarding Hibernate's Expression API. I want to be able to pass in the criteria (=, contains, <, >), propertyName and value and get my results. However, it seems that the second half of the comparison must be the same datatype as the field. This means if you're searching on "contract amount", and its a Double, I need to do a Double.valueOf(searchTerm). Basically, I'm looking for an easy way to do this:

  Criteria filter = ses.createCriteria(clazz); 
  
  // determine type of expression - I'd love to figure 
  // out a cleaner way to do this but there's only 
  // 5 possible types, so I don't mind typing the 5
  // if statements
  if (expression.equals("=")) { 
    // How do I convert these to the fields' type at run-time?
    // Sure I could do a bunch of if statements again, but it seems ugly.
    filter.add(Expression.eq(field, Double.valueOf(value))); 
  }
 
  List results = filter.list();

Any advice is appreciated - especially considering I estimated this task to take 4-5 hours and I'm going on 8.

Posted in Java at Oct 05 2003, 10:39:29 AM MDT 11 Comments

Time to hook up the Senior J2EE Developers in Denver

This is nuts - I'm getting at least one call or e-mail per day from recruiters and/or friends in Denver. Rather than posting these positions here (with Rates), if you're a Senior J2EE Developer in Denver, let me know. I'm going to start a list of folks with skills like mine so I can hook some brutha's up! I have 2 right now - both for J2EE/Web stuff.

Here are my requirements to get on my list:

  • Must know Ant, meaning you've written a build.xml file before. Having read Java Development with Ant is a huge plus.
  • Blogging is a plus - it means you're interested in Java and sharing your ideas (implying that you think outside of work).
  • You've used Eclipse or IDEA and use one or the other on a regular basis. This implies that you know a good IDE can improve your productivity.
  • Must know XHTML and CSS. I do, and I said skills like mine.
  • You're able to checkout AppFuse from CVS, build it and run "test-all" with success. README.txt is your friend.

I reserve the right to delete any of your e-mails and resumes, and to hook my friends up over other folks. I don't want to get a flood of e-mails, I'm just trying to hook up good folks with good jobs. If I can get the rates, I'll let you know what they are.

Posted in Java at Oct 03 2003, 12:08:47 PM MDT 9 Comments

Packaging Velocity

I've made a number of changes to struts-menu this week, and it now supports the ability to render menus via Velocity templates. This allows for easy customization and basically allows for you to create any type of navigation system you want (i.e. drop-downs, tabs, plain ol' links) etc. One of the issues I'm wrestling with is how should I package Velocity with the distribution. Usually, to integrate struts-menu into a Struts-based application, you only need to include struts-menu.jar. Now, if you want to use Velocity for your menus, you must include velocity.jar and velocity-tools.jar in your application's WEB-INF/lib. I think most users will accept this.

However, in the example app, there's a velocity.properties file and a couple example templates. This seems like an opportunity for many users to forget to include these - so I'm wondering what's the best way to package these. Should I put velocity.properties in the source tree, and initialize my VelocityMenuDisplayer using that? Should I do a check to see if the user has their own velocity.properites in WEB-INF/classes for an optional override?

Another question is should I put the sample templates (simple.html and coolmenus.html so far) in the source tree, and then use Velocity to load them from the struts-menu.jar file? Or should I package them in a menu-templates.jar file?

Basically, it all boils down to this question: If you have a project (.jar) that depends on Velocity and plugs into web applications - what is the best way to distribute your Velocity settings?

BTW, I hope to make an effort to decouple this library from Struts someday - shouldn't be too hard.

Posted in Java at Oct 02 2003, 03:38:32 PM MDT 3 Comments

Struts tip o' the day ~ using bean:size

A co-worker turned me on to this one today - you can use <bean-el:size collection="${myForm.list}" id="listSize"/> to get the size of a collection and expose it as a pageContext variable. I've been looking for this sucker for years! Usually, I end up putting a getListSize() getter on my form to accomplish this, since none of the other tags (including JSTL) allow you to get the size of a collection.

Posted in Java at Sep 30 2003, 07:25:59 PM MDT 6 Comments

Pro JSP has arrived!

Pro JSP, Third EditionI received my complimentary four copies of Pro JSP tonight - whooo hooo! It sure is cool having your name on the cover of a book. ;-)

Congrats to all the other authors that feel the same way.

Posted in Java at Sep 29 2003, 10:06:35 PM MDT 16 Comments

Java books I'm considering

Because it never hurts to have a good reference book around, I'm in the market to load up my bookshelf again. Don't know if I'll actually read these suckers, but I use these tools all the time, and I'm tired of searching on Google. I've found that just having these types of books are invaluable for a quick reference.

Any other recommendations - or better alternatives to the ones I've listed?

Posted in Java at Sep 26 2003, 10:00:18 AM MDT 15 Comments

Tiles Tips o' the Day

Here's a couple of things I learned today that might be useful to you Struts developers out there. When using Tiles, you'll normally import all the attributes into your baseLayout.jsp, and then your attributes are exposes as beans/scripting variables (you can actually grab them with JSTL tags). Rather than using:

<tiles:importAttribute/>

Use:

<tiles:importAttribute scope="request"/>

And then all your inserted pages can access these attributes. Pretty slick when you got a little JSTL love in the mix. The second tip is how to implement definition path switching. Let's look at the following baseLayout definition as an example:

  <definition name=".baseLayout" path="/layouts/baseLayout.jsp">
    <put name="titleKey"/>
    <put name="header" value="/common/header.jsp"/>
    <put name="sidebar" value=".sidebar"/>
    <put name="footer" value="/common/footer.jsp"/>
  </definition>

You currently cannot change the "path" attribute with a Controller, so you have to do it as the Tiles author recommends - by changing your path to refer to an action. So I changed the path on this particular definition to be:

<definition name=".baseLayout" path="/do/switchLayout">

Where my action-mapping is defined as follows:

 <action path="/switchLayout" 
   type="org.appfuse.webapp.action.SwitchLayoutAction">
   <forward name="printLayout" path="/layouts/printLayout.jsp" />
   <forward name="baseLayout" path="/layouts/baseLayout.jsp" />
 </action>

Then in SwitchLayoutAction.java, I have the following code:

boolean print =
    Boolean.valueOf(request.getParameter("print")).booleanValue();

// see if a print parameter is passed in the request
if (print) {
    log.debug("switching base layout to printing...");

    return mapping.findForward("printLayout");
} else {
    return mapping.findForward("baseLayout");
}

Pretty slick IMO! It's easy to make the printLayout.jsp only contain some simple wrapper stuff and only do <tile:insert attribute="content"/>. Of course, in this particular example, you could just use a print stylesheet (media="print"), but that doesn't work so well on 4.x browsers (man I hate those beotches).

Posted in Java at Sep 24 2003, 03:01:03 PM MDT 4 Comments

Vanity URLs in Struts

I figured out a way to make your Struts' app have URLs like the following:

http://raibledesigns.com/weblog?method=edit
http://raibledesigns.com/weblog.jsp?method=edit
http://raibledesigns.com/weblog.html?method=edit
http://raibledesigns.com/weblog.php?method=edit
http://raibledesigns.com/weblog.asp?method=edit

Might be a nifty little trick to try. Pump out a version of Roller with this feature enabled and you could say you made a .NET version! ;-)

Here's how:

1.  I created a RequestFilter that maps to /*
2.  This filter checks to see if request.getServletPath() matches any of the
action paths in struts-config.xml.  If so, it forwards to the action.
3.  As an added feature, I added a set of allowed extensions to this
filter's init parameters.  So far I have .jsp,.html,.asp,.cfm (using .jsp
ensures no one links to them directly, MVC enforced!) - so marketing can
choose what technology they want to convey ;-)

This seems to work great.  For example, I have an "advancedSearch" action
defined as follows:

    <action path="/advancedSearch"
      type="org.apache.struts.actions.ForwardAction" 
      parameter=".advancedSearch"/>

(ForwardAction will eventually be replaced, if necessary, with a real
action).  This allows all of the following URLs to work:

http://site.com/do/advancedSearch (works with Struts by default)
http://site.com/advancedSearch
http://site.com/advancedSearch.html + all other extensions listed.

More information (including source code) can be found on the struts-user mailing list.

Posted in Java at Sep 19 2003, 06:23:24 PM MDT 2 Comments