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
345 Views Asked by Mihajlo Brankovic At
2
There are 2 best solutions below
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
- Redirect inside java interceptor
- Spring RestTemplate passing the type of the response
- spring-integration-dsl-groovy-http return null when i use httpGet method
- Custom Spring annotation for request parameters
- Spring - configure Jboss Intros for xml with java config?
- HTTP Status 404 - Not Found in Spring 3.2.7
- AndroidAnnotations how to use setBearerAuth
- android I/O error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
- Show login dialog when not authenticated yet
- Spring Data Rest supporting json and xml
- @Value annotation not resolved in a class that belongs to dependency jar
- Remove nested _embedded fields while using projections
- How to send Rest GET request that contains "#" value in url parameters?
- How to inject spring bean into Validator(hibernate)
- How to keep a variable in the URL when using Spring LocaleChangeInterceptor
Related Questions in TOMCAT
- Best way to pass an environment variable to several config files
- Openshift context path
- KeyStore file is not found in jar, although present in jar
- phpseclib of how to get PID and kill
- Unable to connect database of lamp instance from servlet running on tomcat instance of google cloud
- Spring and Tomcat: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- How can I get a custom header from the client in Tomcat?
- why lost Mysql connection pool after a period?
- Eclipse Java EE + Bitnami Tomcat Stack
- Service not starting using Spring-boot during integration tests
- Image not loading in web page and says 404 error
- Maven Tomcat plugin - 404 WebServlet not found
- How to deploy a spring boot MVC application in traditional tomcat webapps folder?
- Tomcat Manager is not accessible in multi-domain configuration
- JSP return Jasper Exceptions on my friend's pc's when it works on mine
Related Questions in SPLIT
- Powershell Split a file name
- Split the strings into two parts Python
- SPLIT using " " delimiter in Google Sheets won't always preserve period following number
- How to parse/split a string?
- Return splitted value
- split() Error:list index out of range
- Powershell For Loop, Replace, Split, Regex Matches
- Spliting a row into columns using a delimiter in R
- Split string with comma delimiter but not if it is a currency value using C#
- How to split string on multiple delimiters keeping some delimiters?
- Split input files into multiple file using perl
- Group MySQL results into blocks of A-Z in PHP
- PHP split or explode string on <img> tag
- How to split a table in 4 groups?
- Function returning list is showing False python
Related Questions in JSP-TAGS
- return error code from jsp custom tag's doStartTag() or doEndTag()
- Passing Variable from child popup window to parent popup window
- how to create pop up after user has registered successfully without servlet
- How open a new tab using servlet response?
- How to copy java Array into javascript Array?
- Compare and set the selected value in drop down list?
- Display elements in jsp lists if servlet exists
- How to get System Date without using Java code?
- Call javascript from c:foreach
- How to get return value from javascript through JSP?
- How can i delete selected data from database using jsp?
- Custom tag in JSP not working with Spring Session filter
- In jsp: String cannot be resolved to a type
- Use tag attributes in java code in jsp tag file
- How to perform Java bean validation with error messages? *in JSP not JSF
Related Questions in CODE-REUSE
- Reusing a UITableViewCell's IBOutlets with two different UITableViewControllers
- Efficient way to share the same interface implementation between two or more classes
- AngularJS How can i load template width controller and reuse it?
- How to have default behaviour on a derived class instead of redefining constructor
- Laravel eloquent Query Reuse extra condition
- angularjs 1.5 override templateUrl
- EJBs in libraries - Reusing EJBs
- Reusing a List View in iOS using MVVM
- Why is this call not passing the information from my xml file to the winForm?
- Use function inside included javascript using require()
- Reusing custom JSP tags
- Reuse scenarios by using mocha
- Avoid repeating code in NSManagedObject categories
- Android How can i generalize a Class for reuse
- javascript BEST PRACTICE - managing scripts / code reuse
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)
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?
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