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 "java". 1,588 entries found.

You can also try this same search on Google.

Prettying up JSPWiki's URLs

Recently, AppFuse user Charlse Li sent me an e-mail with a "PostfixURLConstructor" class designed to pretty up JSPWiki's URL. With the patch he sent, I was able to change URLs from /wiki/Wiki.jsp?page=AppFuse to /wiki/AppFuse.html. Applying the patch was quite easy, but maintaining backwards compatibility and security required a little more work. Below are the steps I went through to get everything working properly:

  • Download postfixurlconstructor.zip and extract to your hard-drive. Copy the "com" directory to your wiki/WEB-INF/classes directory.
  • Change the <url-pattern> of the WikiServlet in web.xml from /wiki/* to *.html.
  • Add the following two lines to your WEB-INF/jspwiki.properties file:

    jspwiki.urlConstructor = PostfixURLConstructor
    jspwiki.PostfixURLConstructor.postfix = .html

This is all you need to do to change the default URL schema. However, if you're like me and you've had a JSPWiki instance setup for awhile, you'll need to maintain backwards-compatibility. I wanted to make sure the old URLs mapped to the new ones. In addition, the "edit URL" changed from Edit.jsp?page=PageName to pageName.html?do=Edit. Since web.xml and <security-constraint> can't contain regular expressions, I used the ultra-cool UrlRewriteFilter to solve both issues. Here's the steps I went through to configure it properly:

  • Download UrlRewriteFilter 2.5.1 and extract the JAR to your WEB-INF/lib directory.
  • Change your web.xml to use a 2.3 DTD instead of a 2.2 DTD and add the filter and filter-mapping to web.xml.
  • Create a WEB-INF/urlrewrite.xml file with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<!DOCENGINE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 2.5//EN"
    "http://tuckey.org/res/dtds/urlrewrite2.5.dtd">

<urlrewrite>
    <rule>
        <from>^/Wiki.jsp\?page=(.*)$</from>
        <to type="redirect">$1.html</to>
    </rule>

    <rule>
        <from>^/(.*).html\?do=Edit$</from>
        <to type="redirect">Edit.jsp?page=$1</to>
    </rule>
</urlrewrite>

That's it - restart your server and you should be good to go. Thanks for the patch and instructions Charlse!

Update: There does seem to be a couple of issues. The 1st is that none of the attachments are resolving correctly (example). The 2nd that when I try to edit a page, it always shows up with the Main page's text. I'm not going to back out the change just yet, but I will if I can't fix it in the next several hours.

Update 2: I ended up backing out this change, but left in a forward from *.html to Wiki.jsp?page=$1 so all URLs in this post should still work. The "not being able to edit" was the major reason I rolled back to the old URL schema. The attachment issue seems to be related to my browser's cache. Clearing it fixed the problem.

Posted in Java at Aug 21 2005, 03:01:59 PM MDT 1 Comment

Wicket is the most widely used Java Web Framework

According to this post, Wicket is the most widely used Java web framework. While I believe his statements are true, IMO it's only true in the context of this guy's post. My guess is that most of the folks that read his post were Wicket users, or somehow the Wicket Team got wind of this and told users to e-mail this guy. The main reason I don't believe that Wicket is the most popular is because it's so new. I do think it's an up and coming framework that may become the most popular, but I don't think it's there yet.

So, to answer this question, I believe that claiming Wicket to be the most widely is Just Good Guerilla PR. To put some numbers behind that, here's some graphs showing mailing list traffic for the various Java web frameworks.

Web Framework Mailing List Traffic - May/July 2005

Granted, these are just indicators of the number of users - but I believe they are a good indicator. One interesting note about these stats is that Wicket's mailing list traffic has increased significantly in the past few months. Ironically, here's what one of the Wicket developers had to say about this statistic about a month ago:

... who says having a lists that has a lot of traffic is a good thing? It might just as well be an indication of a too-hard-to-understand framework having insufficient documention.

In the past couple of months, I've spoke in front of 25+ Java developers on 4 different occasions to talk about web frameworks. I've asked those developers which frameworks they've used, or plan on using. Struts is still the most widely used, with WebWork and Tapestry the least used. Surprisingly, JSF seemed to be getting no traction among the the audiences I spoke to. Even more surprising (to me at least) was that the most popular web framework continues to be the in-house framework. The overwhelming majority of the developers I've talked to aren't even using open-source web frameworks.

Posted in Java at Aug 18 2005, 12:13:11 PM MDT 2 Comments

Integrating Lucene with Hibernate

The code_poet has an interesting post on using a Hibernate interceptor to index objects for Lucene searching. I've been thinking about integrating Lucene into AppFuse (or at least providing a tutorial) for quite some time. Hopefully this post will serve as a starting point when I do. I wonder how much the Lucene code can be simplified by the Spring support in the Spring Modules project?

Posted in Java at Aug 17 2005, 10:19:09 PM MDT 17 Comments

Equinox on Resin 3.0.14

Yesterday I moved demo.raibledesigns.com from Kattare to Contegix. The main reason I moved is because Contegix is much more responsive when I have issues, as well as Kattare's server was incredibly slow to startup Tomcat. The move went pretty smoothly, but I did run into a couple issues - caused by moving from Tomcat 5.0.28 to Resin 3.0.14. The issues were only in one application - the MyFaces version of Equinox.

The first issue was that the corejsf-validator.jar that I'm using (for client-side validation) contained an invalid TLD file. It was easy enough to fix as it was missing a <short-name> element. This is the 2nd issue I've found with this library - obtained from David Geary's Core JSF book. The first issue is that Spring's Ant-style patch matching doesn't work when this JAR is in the classpath. Anyone out there using a better (less buggy) library for client-side validation in JSF?

The 2nd issue was that MyFaces depends on commons-el.jar, which is shipped with Tomcat. Not so with Resin. Adding this JAR to my WEB-INF/lib directory solved the problem. I've committed both changes to CVS.

Below is a full listing of the sample apps I have installed on this server. The one app that I didn't move is Struts Resume. I'll be moving that one to appfuse.org today.

I'm open to adding more, so let me know if you have one you'd like hosted. Of course, I reserve the right to refuse suggestions based on my interest in the functionality they're demonstrating. ;-)

Posted in Java at Aug 16 2005, 08:50:27 AM MDT 4 Comments

First Magazine Article: Challenges in the J2EE Web Tier

It's official - I've written (and published) my first article in a magazine. If you received the July issue of Java Developer's Journal, you'll see my article titled Challenges in the J2EE Web Tier.

Over the course of its life, the J2EE Web Tier has faced many challenges in easing Web application development. While it's a scalable, enterprise-ready platform, it isn't exactly developer-friendly. Particular challenges to Web developers include the need for a standard Web framework, compatible expression languages, and availability of components. Several Web frameworks have been developed to resolve these issues, each with its own strengths and weaknesses. This article discusses the unique challenges of the J2EE Web Tier and how various technologies have attempted resolve them. By learning from and competing with each other, these Web technologies play an important role in pushing the limits of excellence to produce ever-higher standards of Web application development.

Enjoy!

Posted in Java at Aug 10 2005, 04:30:22 PM MDT 11 Comments

Failed upgrade to Struts 1.2.7

Yesterday I made an attempt to upgrade AppFuse to use Struts 1.2.7 instead of 1.2.4. Everything seemed to go smoothly until I started running my Canoo WebTests with JavaScript enabled. It turns out there's a major bug (IMO) in Struts 1.2.7 where the JavaScript rendered by Commons Validator can't handle the Struts' <form> tag in XHTML mode. I tried a nightly build (20050809), but it's not fixed there either, so I backed out the upgrade.

The interesting thing about Struts 1.2.7 is SpikeSource has certified this release. Are they not testing JavaScript as part of their certification test?

Another thing I attempted to upgrade yesterday was Canoo WebTest from build574 to build976. No dice - mainly because of issues with Prototype (I think). The worst part is everything works fine in a browser. Even worse is I still have a problem with build574, but it doesn't cause the tests to fail. Times like this make me wish Selenium was more polished and ready to use. I talked with some ThoughtWorkers last week and they said the Java driver is ready for a 1.0 release, but one of the committers wanted to make sure all language drivers were ready first (at least that's what I remember).

Posted in Java at Aug 10 2005, 11:17:35 AM MDT 9 Comments

Things I learned from OSCON

While at OSCON last week, I learned quite a few things. Many of these are my own opinions, so feel free to disagree with them.

Ruby is very cool

The main reason (for me) that Ruby is cool is because it's new. I don't have to know any of its history to know what makes it tick. It's easy to learn and has powerful language features that make it easy to use. I think the primary reason people, particularly Java developers, are excited about it is because it releases them from all the shackles they're accustomed to with Java. I have absolutely no plan to ditching Java and jumping to Ruby, but I do want to learn it so I can use it when it's a better fit than Java.

How to learn Ruby and retain that knowledge is the hard part. My current plan is to buy Programming Ruby and Agile Development with Rails. Unfortunately, I realize that I probably won't be able to finish these b/c I'll get bored and both will likely serve as more of a reference than a knowledge creator. I haven't been able to read a technology book cover-to-cover in several years. I couldn't even finish The Pragmatic Programmer for crying out loud. I realize that the best way to learn is to do, but the best way to do is to get paid to do. To facilitate this, I hope to develop some apps we can use at Virtuas. Of course, I'll try to find good open-source solutions first.

Rails has a lot of great ideas

The interesting thing about Rails is many of its good ideas are from Ruby. The built-in Webbrick web server is part of the language. The only way to come close in the Java world is to embed Jetty or something like that. I'll definitely be looking into embedding Jetty into AppFuse in the near future. The other thing I really like about Rails, and that I've been doing in AppFuse a bit is convention over configuration. As part of AppFuse, I'm already making a lot of decisions for users. The next step seems to be making all decisions for users, but allow them to override. It'd be cool to write some code that sweeps through all classes at startup and auto-configures them, w/o the need for any XML. If nothing else, the XML could be generated using reflection.

The biggest thing I learned from Rails is I need to provide 1) an easier upgrade path and 2) better Ajax support. Because I'm supporting so many different web frameworks, solving #2 might be a bit tricky - but could be done by writing tag libraries or components. Hopefully the framework developers will beat me to it and I won't have to do anything. As far as #1, I'm hoping I can move to a single appfuse.jar that contains all the base classes. Hopefully I can use a little JSP pre-compile action to re-use the existing JSPs for user management/etc. If not, I can always use something like FreeMarker to store the default view files in a JAR.

Creating Passionate Users is all about inspiring emotion

Kathy Sierra's talk about inspiring emotions among your users to make them transparently excited about your product/company was a real eye-opener. I can totally see what she's talking about and I'm happy to say I'm already doing some of it. This blog seems to attract lots of readers, some more passionate than others, just by talking about web technologies and Java. This does translate into more business for Raible Designs, whether it's the title image or URL, it doesn't really matter. Folks do figure out that I have a company and I do work with the technologies I talk about.

To apply these concepts to AppFuse and Virtuas is a little more difficult. For AppFuse, I can probably teach people how to better use Hibernate, Spring and Ajax - and then show how AppFuse can simplify things. Building in easy-to-use Ajax support is probably essential to really get this going. For Virtuas, we could re-vamp our site to provide education about open source and its history - providing users with a way to become open source experts. It would also be cool to do real-time reporting of how we helped a company adopt open-source.

Ideas, ideas, I have lots of ideas after last week.

Posted in Java at Aug 08 2005, 03:40:38 PM MDT 4 Comments

Struts Ti

I heard about Struts Ti at OSCON, and after googling a bit today, I've discovered a bit more. Here's a bit about the project from Don Brown's proposal on the Struts Developers Mailing List.

Struts Ti is a simplified Model 2 framework for developing webapps which allows the developer better access to the underlying servlet/portlet environment. It serves a niche of web applications that don't want the additional complexity of server-side components and verbose configuration, yet want the structure and controller features of a modern web framework. Struts Ti builds on the directions of Struts 1.x, yet re-implements the framework to provide a clean slate for the next generation of Struts Ti. It aims to combine the simplicity of Ruby on Rails and NanoWeb, the refinement of WebWork 2, the tool-friendly authoring and Page Flow of Beehive, and the lessons learned from Struts 1.x.

The key word for Struts Ti is simplicity. Ideally, Struts Ti should approach Ruby on Rails levels of easy of use, yet scale up to large applications providing a smooth transition to JSF/Shale if desired.

More information can be found at https://www.twdata.org/projects/struts-ti.

Posted in Java at Aug 08 2005, 01:14:53 PM MDT Add a Comment

[OSCON] Spring MVC vs. WebWork Smackdown

Matthew Porter and I's Spring MVC vs. WebWork Smackdown presentation was a lot of fun this morning. We had a boxing bell (that I got off eBay) and had a good time ragging on the two frameworks. The only surprise was that Matthew actually ran some metrics on the Spring MVC vs. WebWork code in AppFuse and pointed out that the WebWork version required 25% less code than the Spring version. Oh well. The hard part about this presentation for me was trying to defend Spring MVC and saying it's better than WebWork. Matthew obviously felt strongly that WebWork was the better framework, whereas I like them both.

Posted in Java at Aug 03 2005, 05:15:43 PM MDT 7 Comments

Fixing your java.net project's homepage

If you're hosting your open source project at java.net, you might be annoyed by the fact that you can't disable the forums or issue tracker. The forums pretty much suck, mainly because there's no "remember me" on the site and it's a pain to click 3 times just to answer someone's question. They also don't have the ability to quote a previous message. In addition to the less-than-adequate forums, the issue tracker doesn't hold a candle to JIRA.

For the longest time, I've been wanting to remove both the "Discussion forums" and "Project issues" links from the AppFuse homepage. I asked the java.net folks, and they didn't have a solution. Finally, I thought of one on my own.

In case you didn't know - you can create a project_tools.html file in your project's www directory - which allows you to append items to the menu on the left site. Add a little JavaScript action and you can manipulate or remove items as well. Here's what I'm using to remove the link for the Discussion forums, as well as change the Project issues to point to JIRA. If you find any issues with this script, please let me know.

<script type="text/javascript">

function replaceLinks() {
    try {
        var tools = document.getElementById("projecttools");
        var links = tools.getElementsByTagName("a");
        for (i=0; i < links.length; i++) {
            if (links[i].getAttribute("href").indexOf("ProjectIssues") > -1) {
                links[i].setAttribute("href", "http://issues.appfuse.org/browse/APF");
                links[i].innerHTML="JIRA Issue Tracker";
            }

            if (links[i].getAttribute("href").indexOf("ProjectForumView") > -1) {
                links[i].parentNode.style.display = "none";
            }
        }
    } catch (e) {}
}

window.onload=replaceLinks;
</script>

Related: AppFuse and Equinox get some FishEye lovin'.

Posted in Java at Jul 29 2005, 02:39:36 PM MDT Add a Comment