Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write tagx (JSPX tag libraries without java)

I can't find good documentation on how to write modern tag libraries without Java in JSPX?

Spring Roo provides lots of examples (and seems to be only project that uses tagx extensively).

I may make this another question but every time I want to not repeat myself in JSPX (DRY) I feel like have to sacrifice valuable time and go create a tag library because there are no inline macros.

I feel like I must be missing something in JSP/X.

like image 836
Adam Gent Avatar asked Apr 22 '11 15:04

Adam Gent


People also ask

Can we write JSP code in script tag?

No, you cannot use JSP tags in JavaScript in the browser. JSP is a server-side technology, which means that processing must be done on the server.

What is the need for a tag library in JSP?

A tag library defines a collection of custom actions. The tags can be used directly by developers in manually coding a JSP page, or automatically by Java development tools. A tag library must be portable between different JSP container implementations.

What are the components that make up a tag library in JSP?

In order to use custom JSP tags, you need to define three separate components: the tag handler class that defines the tag's behavior, the tag library descriptor file that maps the XML element names to the tag implementations, and the JSP file that uses the tag library.


2 Answers

The best resource I could find on JSP Tag libraries is from the horses mouth: http://download.oracle.com/javaee/5/tutorial/doc/bnalj.html

You have to mentally convert the JSP code to JSPX.

like image 110
Adam Gent Avatar answered Sep 28 '22 07:09

Adam Gent


I'm trying the same technology now. I've found this tutorial which explains the question using an understandable example: Spring MVC: from JSP and Tiles to Thymeleaf

Hope this helps :)

like image 45
wceo Avatar answered Sep 28 '22 07:09

wceo