jsp-tags

Struts Tags and Expression Language

I am having a problem using expression language and struts tags together in a struts2 project. The following code snippet from a jsp file illustrates my problem. The fruits object is passed by a servlet. I know that the error is not from the servlet because when I comment out the form code, it correctly prints out each fruit. <c:forEach...

Netbeans does not see custom *.tagx in my Maven war dependency

I have this scenarion in my project: Maven2 for dependency management One project 'common-web' (war) contains all images, css files, js files, layout files etc. It also contains custom tags (*.tagx files) that we use in our project. They are located in WEB-INF\tags direcotry. Second project (also war) has dependency on common-web, we u...

Custom taglib - .tag files recompiled on every request. Is this normal?

I'm creating a custom taglib with .tag files. Everything works great, except when I load 2 pages at the same time. It seems the .tag files are re-compiled on every request and the concurrency causes the compilation to fail. Is this normal behavior for .tag files? I would have expected them to be compiled only once. Is there some way t...

How to Properly Escape Triply Nested Quotes in JSP

We just upgraded Tomcat and the newer Tomcat doesn't like nested quotes in the tag, so we have to alternate between single and double quotes. For example, We used to have, <form id="search" action="<fmt:message key="search.url"/>"> Now we can change it to, <form id="search" action="<fmt:message key='search.url'/>"> What should I d...

How to inject spring beans into a jsp 2.0 SimpleTag ?

Currently my jsp 2.0 tags that need spring beans use this code: ac = WebApplicationContextUtils.getWebApplicationContext( servletContext); ac.getBeansOfType(MyRequestedClass.class); The I just get the first matching bean. This code works fine, but has the undesired drawback that I spend about half my page rendering time looking up sp...

How to invoke a custom tag in servlet or inside another tag?

Hello all I want to call dynamic tag in my custom tag . for example <mytag:taga attribute="showtag" value="helo"> </mytag> showtag is another custom tag. the main idea is call another tag by name inside my tag Any idea? Thanks in advance. ...

Spring MVC <form:errors/> tag doesn't find error messages

I work with a front-end developer who writes JSP files. We have a form that is working correctly, except validation/binding/processing errors can't seem to be displayed with Spring's <form:errors/> tag. I've confirmed that the error is being set, and what is apparently the correct path for the errors. Supposedly <form:errors path="*" /...

How to test JSP TagExtraInfo ?

I consistently have troubles getting my TagExtraInfo implementations to work properly. I have one implementation that works, and one that doesn't and I unable to see the difference between the two. And all the IDE's seem to have have "bugs/features" regarding this, which makes it hard to see where the problem actually is. The relationsh...

Writing a custom JSF Tag

Hi all, I am trying to write a custom tag. I can write attributes; however, I'm having difficulty writing the innerHTML part: <span class="required">*</span> I can write: writer.startElement("span", component); writer.writeAttribute("class", "required", "class"); writer.endElement("span"); How do I write the *? http://developers...

JavaBean Introspection in Servlets [Tomcat]

What is the equivalent "servlet code" for this: <jsp:useBean id="user" class="beans.UserBean" scope="session"/> <jsp:setProperty name="user" property="*"/> Tomcat translates this to: beans.UserBean user = null; synchronized (session) { user = (beans.UserBean) _jspx_page_context.getAttribute("user", PageContext.SESSION_SCOPE); ...

Creating a List in EL

Suppose I have a custom tag that takes a List of Strings: <%@ attribute name="thelist" type="java.util.List&lt;java.lang.String&gt;" required="true" %> How can I create this attribute in the jsp that calls the tag? I could use a scriptlet <tags:list thelist='<%= java.util.Arrays.asList("blah","blah2") %>' /> but is there any wa...

Jsp tags outside WEB-INF/tags

Is there any way to hold tag files out of /WEB-INF/tags folder? Maybe by using tld somehow and calling them with uri instead of tagdir? Reason for this request is that we are trying to run several sites from one codebase and we would like to have it like WEB-INF/site1/templates, tags, ... so if this is wrong idea to begin with, feel fr...

What is the use of TAG Libraries in JSP and why we are using it?

I am new to JSP and i've come accross Tag libraries, Please give me some detail explaination of tag libraries, where and what type of application we should use that? Thanks in advancve ...

Custom JSTL tags with body

Hi, We are going to use JSTL and custom JSTL-tags for some sort of template-engine in our JSP/spring-project. Is there a way to create a tag that looks similar like this: <div id="site"> <div id="header">Some title</div> <div id="navigation"> SOME DYNAMIC CONTENT HERE </div> <div id="content"> ${content} </div> <div id...

JSTL if-statement inside HTML-attribute

Hi, is it possible to do something like this in JSTL: <div class="firstclass<c:if test='true'> someclass</c:if>"> <p>some other stuff...</p> </div> Is there any way to get this to work, or is there a better way to add a class by looking at a JSTL-if-statement? ...

Jsp custom tag issues.

Hi all, I'm getting the following error when I try to run a jsp page with a custom jsp tag. javax.servlet.ServletException: /pages/editBidForm.jsp(43,3) No tag "getName" defined in tag library imported with prefix "custom" org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515) org.apache.struts2.dispatcher....

Accessing method from JSTL

Hi Guys, just was wondering if there is a way to access a method from my class without creating a custom taglib. Example I got a class which provides 4 methods: hasDisplay(), hasCreate(), hasDelete() and hasEdit() - all of them just returning a boolean value. From my jsp I just want to <c:if test="{ar.hasEdit}"></c:if> But this on...

Passing a Java object value in Custom JSP tag

Hi all, I'm trying to pass a java variable from a custom jsp tag(Im using struts2 here to get the variable from the java class). Here is the error I'm getting. javax.servlet.ServletException: /pages/editBidForm.jsp(51,8) According to TLD or attribute directive in tag file, attribute parentId does not accept any expressions org.apa...

question concerning JSP and javascript

I'm a JSP newbie, I understand that there are some kind of taglib files as I understand they are some kind of custom defined JSP tags. Here is a snippet of javascript code which I don't understand : Polygon.viewPoint = function( index ){ window.${ec:safeId('polygon.view')}.Point( Page.ListofPoints.elements[index], index, 100 ); ...

Evaluate dynamically constructed JSP at runtime

I have a requirement where in the JSP page itself is created by the user and stored in the database. When viewing results we need to render this JSP to the client, evaluating all tags inside this JSP. I am aware that it is doable as OpenCMS and Blogger both implement this functionality. But, I just can't find the right way. Any pointer...