jsp-tags

JSP.13.8 Example Simple Tag Handler Scenario doesn't work?

This test was prompted by reading a question on the Sun java forums and thought I would try it out. The JSP2.0 specification section JSP.13.8 contains an "Example Simple Tag Handler Scenario". I copy and pasted the code fragments and attempted to run it. Environment: Apache Tomcat version 5.5.26 and 6.0.14 (tested on both) Java: 1.5 ...

Forcing Compile of .tag files

How can I force Websphere to compile my .tag files? Cleaning the project, publishing, restarting the server, adding and removing projects all don't help - the .class file for the tag file is not being recompiled. If I delete the .class files, I get an error that the class is missing, but it does not recompile ...

Tag library?

What is the purpose of having tag library? Though we have the basic tags available which makes our work very simple, what is the reason to have a struts-html.tld. Though we can call and use the bean easily through usebean, setProperty and getProperty tags why we have struts-bean.tld. I am a newbie, so kindly clarify my doubts.. Thanks i...

Custom rendering in JSP based on type of class without instanceof

How would you properly render a list of objects in jsp with differing types? Say, for example, I have to render these different objects in a specified order. One way could be to use a common type variable or instanceof but that means having a big switch/if statement to manage them all: <c:forEach var="o" items="${bigListofObjects}" >...

JSP Tag files: checking for nesting

I am writing some nested custom tags using JSP. I understand there are two ways to do this: 1) to write tag handler that extends BodyTagSupport, 2) to write a tag file. In the 1st method, code is ugly. And I couldn't find a way to incorporate current struts tags.If I write the following using a JspWriter, I get this string in final HTM...

Spring MVC form:select Tag, multiple selections not binding correctly?

I am trying to create a form to edit an existing database row. I am using the Spring MVC form tag to auto bind the html to a form backing object. The row has a many to many relationship with another table, which I am trying to represent with a multiple select box using the form:select tag; <form:select path="rules"> <form:options items...

Difference between Custom Tag and Java Bean?

Difference between Custom Tag and Java Bean? ...

Difference between JSP1.2 and JSP2.0

Difference between JSP1.2 and JSP2.0 ...

How do I access the root of a WAR?

I need to determine if an image exists in a JSP tag so I can display a default if it doesn't exist. What is the best way to access the War root so that I can check to see if the image exists? Or is there a better solution? ...

Evaluate variable before passing to JSP Tag Handler

When trying to use a custom JSP tag library, I have a variable defined in JSP that I would like to be evaluated before being passed to the tag library. However, I cannot seem to get it to work. Here's a simplified version of my JSP: <% int index = 8; %> <foo:myTag myAttribute="something_<%= index %>"/> The doStartTag() method of my T...

Is there a DTD or Schema file for jsp tag files?

I am writing some JSP 2.x tag files. I have searched for a few hours now, but I was not able to find doctype/schema definitions/dtds for jsp based tag files. Does anybody knows if there are dtd/schema files to ease the pain of writing those tag files? It's pretty painful to not have auto completion and so on in eclipse. I have to check ...

Problem with HTML output in JSP

Hi, I have code which generates some HTML, but when I try to output this content in a jsp all '<' are replaced with '&lt;' and all '>' with '&gt;'. Here is the piece which renders the result: <c:out value="${data}"/> Can someone please explain what causes the character replacement, and how it can be avoided? PS: I've tried escapeXml...

problem with JSF h:commandButton

Hello everybody. I really need help on this one. I am having a simple login form in jsp file, and i try to use JSF and managed beans with it. When i first fire page it is displaying it content, however when push the submit button (h:commandButton) i am getting an error. Can somebody tell me what is wrong with my code ? error: javax.s...

How to solve this problem with JSP tag extension?

Hi, Begining with JSP and servlet development, I have some problems with a bodyless custom tag to be inserted in a JSP page. Steps done: Wrote and compiled successfully a CustomTag.java (extending TagSupport) in WEB-INF/classes directory; Defined the TLD file, with a very simple example, including <body-content> with an empty value f...

Why Can't JSP 2.0 Tag Files Have Body-Content of "JSP"?

The "new" JSP 2.0 tag file tags are incredibly useful, and for most cases (at least that I've seen) they provide a far more readable format than a Java class. However, while tag files can do almost everything a Java class tag can do, there is one giant thing they can't do: have "scripting" body content (ie. "<%" stuff between the start ...

Restricting the scope of a model in JSP

If i put an object named "foo" into model in Spring controller, and want to limit its scope, how can I do this. Let's say I have a page which uses a jsp tag that takes as a parameter "foo". If I call the tag inside jsp, like <tag foo="${bar}" />, it seems to me that the model "foo" is interfering with the "bar". Or even if not, if I j...

displaytag export options banner - place at top of table

Dear Lazyweb, I'm using the displaytag tag library, and it's worked amazingly so far. However, i don't see a simple option or way to put the export banner at the top of the table instead of the bottom. How can this be accomplished? Thanks, Roy ...

displaytag external paging/sorting and getting true row number

I'm using external paging/sorting with a custom TableDecorator and the following DisplayTag table in a JSP: <display:table id="ixnlist" name="pageScope.itemList" sort="external" decorator="org.mdibl.ctd.pwa.displaytag.decorator.IxnTableWrapper"> <display:column title="Row" property="rowNum" /> ...more columns... </display:tabl...

Why do I get an error in my JSP local functions '<%!'?

We have a couple of utility functions declared on class level in jsp. Using <%!. I get the following error in the line containing only <%!: Invalid character constant Code: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="java.sql.*"%> <%@page import="java.util.V...

Hooking into Display Tag pagination events

Does the Display tag JSP tag provide a way to hook into pagination events, so that you can execute your own code when the user pages the data? I couldn't work out how to do it from the docs. Thanks in advance. ...