Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Customizing Spring Roo tagx

DZone's Guide to

Customizing Spring Roo tagx

I use everyday Spring Roo project to develop Java applications and it offers you the possibility of customizing the code that it generates with the purpose of extending its functioning. I’m going to explain how to do it.

· Java Zone ·
Free Resource

Verify, standardize, and correct the Big 4 + more– name, email, phone and global addresses – try our Data Quality APIs now at Melissa Developer Portal!

Do You Know How to Customize Spring Roo tagx? 

Spring Roo offers you the possibility of customizing the code that it generates with the purpose of extending its functioning. Sometimes you need to apply modifications over the tagx files defined by Spring Roo, because you need some operations that currently these tagx don’t accomplish. This is the main subject of this article: how can you customize tagx files?

To explain how to do it, I will use an example based on Spring Roo project. You will need:

  • IDE Eclipse STS.
  • An application generated from Spring Roo, for example, a project created using the clinic.roo script.

Spring Roo Console

The reason that I will use it to change a tagx file is that I want to set a default value in inputs and currently this action isn’t supported by the input defined on the Spring Roo project.

Structure

Taking into account the possibility of the version of Spring Roo changing while the project is developing, I recommend making a copy of the tagx that you want to modify. When a Spring Roo version in a project is changed, usually you will open the Roo console and you will execute a command to update all the tagx because these could have changed due to improvements developed in the new version. If you don’t have your own copy of the modified tagx, you will lose all your changes.

Update tags

I suggest you place your new tagx file into a folder located in the same level of the originals and give the folder a name similar to the project name. I strongly recommend this name because it is an easy way to identify your own tagx.

New structure

Finally, you need to indicate in your jspx files that you want to use your tagx file instead of the original one. To do that, you have to include the XML namespace with the route where your new tagx is defined. The last change that you will have to make is to modify the reference of the input inside the content of the jspx by the new XML namespace defined.

Use new tag

Hope you enjoy this post and you learn more about Spring technologies.

If you have some comments or questions, feel free to make it, you’ll also find @disid_corp on Twitter.

See you soon!

Developers! Quickly and easily gain access to the tools and information you need! Explore, test and combine our data quality APIs at Melissa Developer Portal – home to tools that save time and boost revenue. Our APIs verify, standardize, and correct the Big 4 + more – name, email, phone and global addresses – to ensure accurate delivery, prevent blacklisting and identify risks in real-time.

Topics:
spring ,springroo ,java ,opensource

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}