I would like to split my Spring/JSP/Maven/Tomcat webapp project to few different ones. So, each of them will act as a stand alone web application. Now, I want to use the same custom JSP tags in all the projects, but I don't want to copy the WEB-INF/tag folder everywhare. How can I have it defined in a shared project and reuse it in all dependent projects?
Reusing custom JSP tags
347 views Asked by Mihajlo Brankovic At
2
There are 2 answers
0
Stijn Geukens
On
I did this by putting the tld in the src/main/java/META-INF folder of the common project.
e.g. common.tld
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>Custom common Tag Library</shortname>
<uri>http://www.mysite.be/tags/common</uri>
...
Then it the JSP's in the project (that include the shared project):
<%@ taglib prefix="common" uri="http://www.mysite.be/tags/common" %>
Disclaimer: it's been a very long time ago since I did this so I hope I did not forget anything and not sure if this is (still) the best option.
Related Questions in SPRING
- HTTPS configuration in Spring Boot, server returning timeout
- Multi Tenancy in Spring - Partitioned Data Approach
- How to create beans of the same class for multiple template parameters in Spring
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Springboot: How to get an entity optional property and check null?
- How do I propagate the current SecurityContext to my @RabbitListener in Spring Boot?
- Spring's XML based bean configuration for Object Mapper's Case Insensitive property
- Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. I'm using Postgresql
- springboot class org.hibernate.mapping.Bag cannot be cast to class org.hibernate.mapping.SimpleValue
- Issue while deploying JDK 17 and Spring 6 application in Tomcat 10.1.20
- Spring JPA Data Auditing - How to design it?
- Springframework test: Async not started
- Error: Cannot invoke "jakarta.servlet.http.HttpSession.getAttribute(String)" because "session" is null
- How does spring-retry determine which methods to retry when @Retryable is placed at the class level?
- problem with edge server registration in Eureka
Related Questions in TOMCAT
- Unable to compile the class for JSP in tomcat 8.5.95
- detect catalina.out log path from a running tomcat on non-Windows
- Tomcat 9.0.80 with Open JDK (JRE only) v16.0.2 crashing/unresponsive several times a day with load: Thread Count hits Max and All Threads are Busy
- JAX-RS webapp deployed to Tomcat returns HTTP 404 error while it works fine in Eclipse
- Illegal access: this web application instance has been stopped already. Could not load [org.apache.logging.log4j.message.SimpleMessage]
- File Upload Handling: Inconsistent HTTP Response Codes for Different File Sizes with Exception in Tomcat
- Don't get any public folder when deployment in svelte kit app
- Accessing solr web interface behind reverse proxy returns "Content Encoding Error"
- java.lang.UnsatisfiedLinkError: org.apache.tomcat.jni.SSL.renegotiatePending(J)I
- Cannot decrypt the password in application.yml properly if war file in the tomcat/webapps
- how to deploy mock json data api's(json-server) and angular 17 application in apache tomcat server 9 version
- version compatibility issue between spring boot, struts2-core and tomcat-embed-jasper in web application
- Is there any possibility to use JTA with Spring Framework 6 and Tomcat or Payara?
- Eclipse issue with publishing to Tomcat server
- null in Camunda variables
Related Questions in SPLIT
- Golang bufio.Scanner: token too long
- How to convert a split string into floats but ignore objects in Python?
- how to split delimited space and trim in vb.net
- how to import dat files into datagridview with VB.NET
- Using .split() on an ArrayList of strings
- Splitting a CSV file of coordinates into longitude and latitude ArrayLists
- Conditionally separating a string in R or alternative Regex expressions
- filtering data from a dataframe column
- Trying to slice a large css file Trying to slice a large css file (1,952,726 rows) to chances using Python
- VB.NET how to get session id out of JSON string
- Count and group equal values in the same cell in Google Sheets
- Helm pod deployment loop
- Organising list() of a calculated function by descending day order within patients in R
- Split string based on delimiter into specific substrings in python stored in multiple columns
- What's a straightforward way to split a string on 'top level' only, regarding quotes and parentheses?
Related Questions in JSP-TAGS
- Can JSTL or Custom Tag Libraries be Called from Thymeleaf?
- JSP: "object cannot be resolved to a variable" when used in nested tag
- what this signifies <%@ taglib prefix="c" uri="jakarta.tags.core" %> in jsp file under src root folder src/webapp/WEB-INF/jsp/home.jsp?
- Servet and JSP tag have different results from request.getRequestURI()
- Cannot be resolved to a variable, expression tag is giving me an error
- Get value of display:column property JSP page in JS
- Request resource is not available in servlet
- Access a Java method from JSP file placed on Tomcat server
- Imported jsp project giving error SEVERE: A child container failed during start
- Use Json Object as Spring MVC view model directly without converting it to Java object
- Why my custom tag is appearing multiple times in jsp?
- spring boot webpage with gradle dependencies not opening jsp files
- Any taglib to read a text from the txt file with Markdown and render it into a jsp in Liferay
- How to use JSP page templates in my custom tag library
- How to pass all URL parameters through a <jsp:include> tag?
Related Questions in CODE-REUSE
- Kotlin updating different values with a single function
- How to make a global "addEventListener" function that is re-usable to both clicks and keyboard events - Javascript
- Reusing snowflake connection object in multiple python scripts
- Creating a truly reusable react input component using the value attribute
- How to use react GitHub repository code in my my react application?
- How to design a navbar for an spa in react?
- perform calculation based on the operator passed as method parameter
- How to reuse code in GoLang in the absence of interfaces or function overriding?
- How to write reusable date in date-fns?
- PHP - pattern to reuse same behavior across class methods
- Is there a way in Dart to reuse method implementation in multiple Enums?
- How to reuse Nginx configuration among blocks?
- How to make an input text field reusable multiple times in the same page in flutter?
- How to modularize an web page using HTML?
- How can I avoid boilerplate code in Rust?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Further to the previous answer and assuming you are using Maven then your Common taglib project should look like:
where the contents of your taglib.tld look like:
and then you can just reference the taglib in dependant projects in the normal way.
See documentation for further guidance:
http://docs.oracle.com/javaee/5/tutorial/doc/bnamu.html#bnana