Matt RaibleMatt Raible is a Web Developer and Java Champion. 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.

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
Comments:

We don't need no stinkin' version 4 browsers!

Even Jacob Nielson says there isn't a lot of need to support version 4 browsers - "As of February 2003, the marketshare for Netscape 4 was 1.1% and IE 4.0 was at 0.9%. In total, 2% of Web users were still on v.4 browsers...as of early 2003, most sites can [stop supporting version 4 browsers]"

It's at http://useit.mondosearch.com/cgi-bin/MsmGo.exe?grab_id=5386838&EXTRA_ARG=&host_id=2&page_id=261&query=browser+version&hiword=BROWSER+VERSION+VERSIONS+BROWSERS+BROWSING+BROWSE+BROWSED+VERSIONING+BROWSABLE+

Scroll to the bottom where it says Update 2003

Posted by Will Gayther on September 24, 2003 at 09:29 PM MDT #

Good stuff - thanks Will!

Posted by Matt Raible on September 24, 2003 at 09:46 PM MDT #

If you use a Tiles Controller, it should be easy to manipulate any of the attributes in your definition. More information on Tiles Controllers can be found at Tiles 201.

Posted by Matt Raible on March 05, 2004 at 01:18 AM MST #

Hey Matt! Do you use this feature extensively? I would like to update 1. folder name of the CSS, 2. folder name of the graphics, and, 3. sometime the layout file Any insights that you could share ?

Posted by Kunal H. Parikh on January 22, 2015 at 03:27 PM MST #

Post a Comment:
  • HTML Syntax: Allowed