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

You can also try this same search on Google.

Deadlines and Opportunities

I turned in my 1st draft of the Security Chapter on Monday and I'm sending my example app to go along with it as we speak. That means I'm 3 days late on my first deadline - doh! And my second deadline is Sunday - for the Struts Chapter - fat chance of hitting that one. To make matters more convoluted, I have had more calls this week about new opportunities than all year!! As you might now, I don't have a full time gig right now - so opportunities are most important right (especially with a little one and wife to support). So I will be staying up until the wee hours of the morning, acting like a keyboard monkey, until sometime next week. I can't wait to get this over with. The writing part is cool - but I can't concentrate on writing - I get too caught up in the sample app and waste hours trying to tweak stuff. Damn, I can't wait to get rid of this stress.

Posted in General at Dec 11 2002, 09:39:04 AM MST Add a Comment

The TVC Framework

Here's an interesting new extension for Struts:

The TVC Framework uses the Struts framework to create HTML tables with functionality that includes paging, sorting, filtering of data, and data validation.

This joins the ranks of Ed's <display:*> tag library and Yuriy's html table tag library. I've always like the display tag library as it's easy to setup and use - just pass it an ArrayList of beans and you're off! The TVC Framework seems to offer some cool functionality, but you have to pay $995 for the good stuff :(. Of course, if you're trying to code similar functionality on your own, you'd probably save your self some money if you bought it.

Posted in Java at Dec 11 2002, 04:20:36 AM MST 3 Comments

IDEA vs. Eclipse

I've been switching back and forth between IDEA and Eclipse for the past couple nights. I DO like IDEA, but as I only have 3 days left on my evaluation, I'll sadly have to let it go. My favorite feature is it's ability to recognize that you haven't imported a class, and then allows you to hit Alt+Enter to add the import. Also, it grays out imports that aren't being used, both very slick features. As for generating getters and setters, it does a poor job in my opinion. It puts them above your variable declaration and doesn't add any javadoc comments. Eclipse puts them at the bottom of your class and adds javadoc comments - so Eclipse wins here. Also, Eclipse does a much better job of adding and recognizing javadoc comments. IDEA wins on indentation, it always seems to know where you want to be. If I get a full time gig here soon, I might have to buy IDEA. I think it's best when you can use multiple tools to make your development life easier. I say screw these debates on Eclipse vs. IDEA or Struts vs. Webwork - use them all! (I need to examine Webwork as it gets lots of good comments from it's developers.) Of course, it's easier to use both when you have a dual-monitor setup! I highly recommend this... it's awesome!

Later: The other thing that IDEA wins on is that it can actually run my Ant script without puking. Eclipse doesn't let me run it - maybe it's cause it has Ant 1.4.1. Hmmm, wonder if I can upgrade it to 1.5.1. IDEA has better XML editing, and even seems to detect errors in build.xml.

As I'm editing this post with the Later paragraph, I received the following from Cédric (who seems to work for BEA from his e-mail address).

You didn't say if you already knew this about Eclipse, so I thought I would tell you anyway:

- To fix a missing import, just press Ctrl-1 (Quick Fix) on the class with squiggly lines. Ctrl-1 does a lot of incredible things, like it sometimes reads your mind. I much prefer this approach to having specific actions and shortcuts to remember. Another interesting one is Ctrl-Shift-O (Organize Imports), when you have a lot of imports to fix. Eclipse will analyze your whole source and add them all for you (and possibly prompt your when there are ambiguities).

- The latest builds underline the unused imports with yellow squiggly lines.

-- Cédric http://beust.com/weblog

Sweet! Must be time to download a nightly build!

Posted in General at Dec 10 2002, 10:35:41 AM MST 4 Comments

XML Encryption/Decryption

Erik gives us the heads up on a new W3C Proposal: an XML Encryption, Decription Standards. Just after I finished my first draft of my chapter on Security!! Arghh! Oh well, I'm sure there will be a 2nd and 3rd draft. I'll have to read this article and see if it's relevant. The first draft was due Sunday, I turned it in yesterday. It is supposed to include a sample application, and I'm still working on it.

I was up until 5 a.m. this morning working on it. I got Hibernate working nicely, and I can generate my Hibernate persistence layer and my Struts (validator) forms using xdoclet. Cool stuff, I did have to write the business tier to talk to hibernate, and I did have to write a Hibernate class (DAO) to talk to the persistence layer. Not as easy and clean as I'd hoped for, but now that the groundwork is laid, it'll probably be easier to move forward. It's pretty sweet that I can add a getter/setter to my POJO (actually it's an entity bean since that's the only way to generate struts forms using xdoclet) and I get a new column in the database and in both my VO (hibernate uses this) and my Form.

Posted in Java at Dec 10 2002, 09:14:51 AM MST Add a Comment

Caching for Struts

An interesting new extension came through the struts-dev mailing list today. It's called the "neteye actioncache" and is an extension that provides a simple but powerful caching facility for struts. It's features as are:

  • Caching of binary and character data
  • Support for URL based session tracking
  • Allows to use multiple actions on a single page
  • LRU caching policy
  • Persistence

Pretty cool - don't know if I'll ever need it, but nice to know it exists. More information can be found at http://actioncache.neteye.de.

Posted in Java at Dec 10 2002, 08:40:04 AM MST Add a Comment

Struts Menu - Improved!

Well after working until 4 in the morning last night and most of the day today - I'm happy to say that I've completed my desired changes on Struts Menu. I've been talking with the inventor, Scott Sayles, and hopefully I can get these changes committed in the next day or so. The biggest improvements I made were adding new Displayers - one for CoolMenus (CoolMenu4) and one for DHTML Lists (ListMenu). I also added support for a roles attribute (comma-delimited) that will hide menus when users are not in that role. Of course, you will have to use container-managed security for that to work, but it's easy - right? I'm thinking we should probably add a denyRoles attribute as well, as its a pain to add 5 roles just to exclude 1.

The problems I ran into with CoolMenus4 seem to be CSS related, and the Dropdown DHTML List is a little funky when you have too many nested items. Please feel free to dig in and fix these -> should be easy using good ol' view-source copying some files locally if you like. I can also post the source if you'd like, but I think you're more interested in just a demo.

Click here for a demo (expires on 12-15-02), or download the source.

The coolest thing about this bad-ass menuing system is that you can choose a new type of menu just by changing your JSP. Of course, a little magic and you can do it based on request variables or something of the sort. Check out the permissions page for an example.

The sweetest improvement I can think of is to now make the menu-config.xml file editable through a browser - and it'll save the results for you. Even sweeter - if you're really nuts - have this UI talk to struts-config and allow you to select forwards for locations! I could dig in and work on this thing for a week - but alas, I have a chapter to write! Too bad I'm only halfway done and it's due tomorrow :-( Oh well, at least the chapter will demonstrate some good code!

Posted in Java at Dec 07 2002, 10:28:21 AM MST 2 Comments

Down on Struts?

This post on Why are people so down on Struts probably deserves an immediate rebuttle, but I'm too tired and have better things to do. The best reason I can say that I like it - it's paying the bills. Show me a better framework and a contract that wants to use it, and I'll be all over it like a monkey f**in' a football. ;-)

So you ask, what "better things" do you have to do. Well, there are many things better than pounding on this keyboard (i.e. playing with Abbie, loving my wife), however, I'm a sad sob and I'll be here all night. I'm planning on digging into struts-menu and 1) upgrading it to CoolMenus4 and 2) configuring it to allow lists for DHTML menus. Then I have to make sure both methods allow for permission checking, since I want to use struts-menu to display url-hiding security in my chapter. Wish me luck - and feel free to help if you want to get your hands dirty!

Posted in Java at Dec 06 2002, 01:40:17 PM MST 1 Comment

Webapp Configuration

Jeff Duska has a post tonight on how he handles app-specific configuration settings. His method sounds pretty neat, and hopefully we can combine our methods to come up with a better solution. Here's how I've been doing it.

  1. I have a StartupServlet that reads in an XML file and, using Castor, populates a JavaBean with the XML file's values. Sidenote - I recommend having a StartupServlet in webapps to populate drop-down choices from the database and stuff ArrayLists (of beans) into the ServletContext - works real slick in Struts using the LabelValueBean.
  2. Stuff the JavaBean into the servlet context and get values as needed while running the app.

Jeff's method seems make it easier to retrieve the values, but not to set them. I have a getConfiguration() method in my BaseAction class that I use to get my configuration data:

/**
 * Get the Configuration object from the servlet context
 */
public Configuration getConfiguration(){
    return (Configuration) servlet.getServletContext().getAttribute(
                   Constants.CONFIGURATION);
}

The obvious problem with this is that only subclasses of BaseAction can get the configuration information - therefore, I like Jeff's idea better. However, I'm curious to know how he populates his Registry class. Castor makes it pretty damn easy. Here's the method I use in StartupServlet, where obj is my JavaBean, and xmlFilePath is configured as "/WEB-INF/app-config.xml" in one of StartupServlet's init-parameters.

/**
 * Load our application configuration XML file.
 *
 * @exception Exception if any problem occurs while loading
 */
private synchronized Object loadConfig 
    (
    Object obj, 
    String xmlFilePath
    ) 
throws Exception {

    // attempt to extract the filename, using system file separator
    int index = xmlFilePath.lastIndexOf(Constants.FILE_SEP);

    // no system file separator found in configuration setting
    if (index == -1) {
        // check traditional file separator as used in web app URI's
        index = xmlFilePath.lastIndexOf("/");
        // still no separator, maybe they're just specifying the filename
        if (index == -1) {
            index = 0;
        }
    }

    String xmlFileName = 
        xmlFilePath.substring(index + 1, xmlFilePath.length());
    if (logger.isDebugEnabled()) {
        logger.debug("Looking for '" + xmlFileName + "' in "
                 + Constants.USER_HOME);
    }

    // Acquire an input stream to our configuration file
    InputStream is = null;
    try {
        is = new FileInputStream(Constants.USER_HOME + xmlFileName);
    } catch (FileNotFoundException fnf) {
    
        // No file found in user.home
        if (logger.isDebugEnabled()) {
            logger.debug("File not found at " + Constants.USER_HOME
                + xmlFileName + " - looking at specified path in web.xml.");
        }
        
        // Look for config.xml in WEB-INF
        is = getServletContext().getResourceAsStream(xmlFilePath);
        if (is == null) {
            throw new Exception("Configuration file '"
                + xmlFileName + "' not found in '"
                + Constants.USER_HOME + "', nor at '" + xmlFilePath + "'");
        }
    }

    InputStreamReader reader = new InputStreamReader(is);
    
    // Marshal the configuration object
    obj = Unmarshaller.unmarshal(obj.getClass(), reader);

    // close the InputStream, and the reader
    is.close();
    reader.close();
       
    return obj;
}

I like this method because it can load multiple configuration files, and I already have it written - so the hard part is over ;-) It also makes it easy to configure your app outside of WEB-INF, and changes won't be overwritten when a user upgrades their WAR file or whatnot. I suppose I could use Jeff's method and make my JavaBean into a Singleton and not store it in ServletContext - that'll probably work better than my current scenario.

Posted in Java at Dec 06 2002, 01:24:21 PM MST Add a Comment

AppFuse and Resume App

I've decided to rename struts-xdoclet to AppFuse! Why? Because 1) it's easier to say, 2) it's a more descriptive name, and 3) it's the fuse to get your app started! I'll be checking it into SourceForge's Struts project soon, and will post more information then.

I've been thinking about my sample app for the Struts Chapter and I'd like to develop something that's useful. I doubt I'll have the time to pull it off, but I'd like to develop a resume builder/viewer app. I think it'd be a great way to demonstrate CRUD with Struts with skills and such. It could even be an application that would support multiple users, where skills can be shared and selected. I've been thinking about doing something like this for a while. It's a pain to update my resume right now because there's 4 different versions - online JSP, downloadable HTML, Word and Text. I've often thought about just creating an XML version and using JSTL to to XSL transformations into HTML, Text, RTF and PDF. I wonder if this XML resume project at SourceForge could help? I'd love to create an app that allows you to easily update your resume and can publish it in all these different formats. Even better, if it could be resume-standards-compliant (i.e. DTD or XSD) and allow users to select/upload/use different styles. I think this would take much of the headache out of online resume publishing. However, I'd probably spend more time tweaking it than I would just updating the 4 different versions of my resume. It'd kinda like this website, I chose to use Roller as my re-design engine because it was quick and easy - and now I spend a couple hours each day tweaking and updating. I could've redesigned for a lot cheaper! Of course, new content == hits.

The only problems I can foresee with this app (so far) are Old Man Time and that it might be a maintenance nightmare. I would suspect a lot of folks might want import/export to/from existing formats. Thoughts? Comments?

Posted in Java at Dec 06 2002, 09:57:52 AM MST 3 Comments

OS X and Writing/Coding

I've been using my G4 Powerbook all week to write this security chapter. Today I started coding and writing at the same time. This post is meant to vent that this laptop/OS is a DOG! It's so fricken slow! I have Eclipse, Word, Mail, Terminal and Internet Explorer running and I feel like I've lost hours for these apps to respond. The machine is 667Mhz and has a gig of RAM! What the hell?! I'll be coding working on my Windows box for the rest of this project, I'm tired of waiting.

Posted in Mac OS X at Dec 06 2002, 08:01:39 AM MST 6 Comments