Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to access my custom jsp taglib in STS 4.3?
    primarykey
    data
    text
    <p>I have a Spring MVC web app whic I'm developing using the STS 4.3 as my IDE.</p> <p>I decided to try my hand on custom JSP tag libraries.</p> <p>These are the tutorial I'm following: <a href="http://www.tutorialspoint.com/jsp/jsp_custom_tags.htm" rel="nofollow">http://www.tutorialspoint.com/jsp/jsp_custom_tags.htm</a> and <a href="http://www.noppanit.com/how-to-create-a-custom-function-for-jstl/" rel="nofollow">http://www.noppanit.com/how-to-create-a-custom-function-for-jstl/</a> and <a href="http://blog.denevell.org/tomcat7-el-custom-function.html" rel="nofollow">http://blog.denevell.org/tomcat7-el-custom-function.html</a> and many other links (too many to list but similar in content). </p> <p>I have configured Tomcat7 as my testing server from with STS 4.3</p> <p>I have created a new project in STS and called it "MyCustomUtilities".</p> <p><strong>folder structure of MyCustomUtilities project</strong>: <a href="http://i.imgur.com/9nEuPYW.jpg" rel="nofollow">http://i.imgur.com/9nEuPYW.jpg</a></p> <p><strong>source code for MyCustomUtilities.java</strong></p> <pre><code>package org.flinders.mycustomutilities; import java.lang.StringBuilder; public class MyCustomUtilities { public static String StringToHTML(String inputString) { StringBuilder returnString = new StringBuilder(); char[] inputChar = inputString.toCharArray(); for (char c: inputChar) { returnString.append("&amp;#").append((int) c).append(";"); } return returnString.toString(); } } </code></pre> <p><strong>JSP snippet</strong> (I've also tried &lt;%@ taglib uri="WEB-INF/MyCustomUtilities.tld" prefix="mine" %> but still getting error)</p> <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;%@ taglib uri="http://localhost:8080/MyCustomUtilities.tld" prefix="mine" %&gt; </code></pre> <p>Tomcat folder structure: <a href="http://i.imgur.com/oT3Ndhp.jpg" rel="nofollow">http://i.imgur.com/oT3Ndhp.jpg</a></p> <p>I have created a system variable called "CLASSPATH" and it's pointing to the ROOT/WEB-INF (full path of course. just shorten it here).</p> <p>here's my TLD file (unsure on what to put on the uri portion but I'm accessing my web app on localhost:8080 on my browser)</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt; &lt;taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.1"&gt; &lt;tlib-version&gt;2.0&lt;/tlib-version&gt; &lt;uri&gt;localhost:8080/MyCustomUtilities&lt;/uri&gt; &lt;function&gt; &lt;name&gt;StringToHTML&lt;/name&gt; &lt;function-class&gt;org.flinders.mycustomutilties.MyCustomUtilities&lt;/function-class&gt; &lt;function-signature&gt;java.lang.String StringToHTML(java.lang.String)&lt;/function-signature&gt; &lt;/function&gt; &lt;/taglib&gt; </code></pre> <p>Any ideas on how can I setup/configured tomcat/STS so it can see my custom tag library? As I said above, I'm looked at various examples but they don't seem complete. thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload