jstl

Rendering a nested list with JSP

I need to render a 3-level deep list of items via JSP. Let's say I have beans with String properties "Country", "City", "Street". I need to build a heirarchy of UL and LI tags to show streets such that they are listed under the appropriate city, and such that each city is listed under the appropriate country. Example: <ul> <li>United S...

problem using jstl in Javascript

Hi all, in my jsp page I have: <form:select path="index" id="sIndex" onchange="showDetails()"> <form:options items="${smth}" itemLabel="name" itemValue="index"/> </form:select> And in my javascript function: *function showDetails() { var sIndex=document.getElementById("sIndex"); var index=sIndex[sIndex.selectedIn...

Spring SimpleFormController - Including Search Form In Success View

UPDATE 1/31/10: Since this thread continues to get a lot of views...I am curious if it has been of help to anyone recently? Feel free to leave comments/feedback, thanks. I have a Spring form where I would like to reuse the search page to include the results under the search form. Currently when I do this I get the following error o...

Regular expression to match empty HTML tags that may contain embedded JSTL?

I'm trying to construct a regular expression to look for empty html tags that may have embedded JSTL. I'm using Perl for my matching. So far I can match any empty html tag that does not contain JSTL with the following? /<\w+\b(?!:)[^<]*?>\s*<\/\w+/si The \b(?!:) will avoid matching an opening JTSL tag but that doesn't address the wh...

How to access bean attribute in JSP?

How can we access the bean attribute in JSP? I tried <core:forEach var="header" items="${command.headerList}" > <td><core:out value="${header.columnName}"/></td> </core:forEach> where headerList is the list of myBean which is having the attribute columnName [ getter / setter are defined in the class ] Expected: it should print the v...

JSP programmatically render

I need programmaticaly render JSP page. As far as I understand JSP should have some compiler. The question is can I use this compiller dirrectly without JspServlet and others? All I need is documentation how to use JSP compiler (Jasper, for example). Some additional information would clarify situation, I think. I can not use standart Js...

Sending & in query String

From first.jsp I am sending some parameters to result.jsp as - <a href="result.jsp?itemId=${itemId}&itemName=${item.itemName}&itemCode=${item.itemCode}')">Show Items</a> Here ${item.itemName} can have values like "food & stationary". When item name contains an "&", I am not able to get whole value on result page, its printing only "fo...

Can i break up a jsp foreach loop with stripes layouts

Say I have the following for each in a stripes layout definition <c:foreach items="${foo}" var="bar" > <s:layout-component name="whatever" /> </c:foreach> Then when I render I do something like this <s:layout-component name="whatever"> //Do something with bar </s:layout-component> The whatever component is rendered before ...

combine x-taglib with c-taglib on <x:set> and <c-foreach>

can is use a x-taglib var in a c-foreach like: <x:set var="logrows" select="$doc/properties/entry[@key='foo.bar']"></x:set> <c:forEach items="${bar.foo}" var="log" begin="0" step="1" varStatus="i" end="${logrows}"> </c:foreach> thx ...

JSTL: core:redirect gives the error "Unknown tag"

I am taking my first steps with Spring and am doing a tutorial. I am supposed to be redirecting to a page that displays some content using < core:redirect url="/portfolio.htm"/> However that page never gets displayed. By navigating directly to the page I can see that it is there and it looks ok. I get the error in Eclipse "Uknow...

JPA and InnoDB, and JSP/JSTL questions

A couple of questions: If I have mapped a Customer with an i-var List<Order> orders with annotation CascadeType.ALL, should I also set the relation in MySQL InnoDB ON DELETE CASCADE? Or will these interfer? Is it necessary to say <%@page contentType="text/html" pageEncoding="UTF-8"%> in every JSP file? Can I set this as a configuration...

Add values to arraylist use JSTL

is it possible to add values to an ArrayList instead of using a HashMap something like: <jsp:useBean id="animalList" class="java.util.ArrayList" /> <c:set target="${animalList}" value="Sylvester"/> <c:set target="${animalList}" value="Goofy"/> <c:set target="${animalList}" value="Mickey"/> <c:forEach items="${animalList}" var="anim...

How can I insert a XML file in a XHTML page <textarea> using JSP?

How can I include a XML file as content in a textarea element in a XHTML document? It will cause validation errors if the special characters are not escaped. Is there an easy way in JSP to escape special characters before they are inserted using the include directive, like using the JSTL? Example code: <div> <textarea name...

jQuery - want to hide row from rich:dataTable

Hi Guys, I have a rich:dataTable. I want to hide a row with this code: <c:if test="#{not empty documents &amp;&amp; documents.size!=0}"> <rich:jQuery selector="#_inboxTable_ tr" query="ready(function() { jQuery.noConflict(); if ( jQuery(this).find('checkboxStatus').attr('checked', true)) { ...

accessing values in a map using c:out tag

hi there, trying to access a value from a map in a c:out tag but the following doesn't appear to be displaying any value. Here's the code: <c:out value=" letterForm.criteria.map['letterForm.criteria.type']" /> anyone have any ideas how to get the value from a map other than using the following code as it seems a bit inefficient as we ...

fetching values from map in jstl

Hi, I have the following code on my jsp page: <c:out value="${items}" /><br /> <c:forEach items="${items}" var="item"> 1. <c:out value="${item.key}" /><br /> 2. <c:out value="${item.key eq 70}" /><br /> 3. <c:out value="${items[70]}" /><br /> 4. <c:out value="${items[item.key]}" /><br /> </c:forEach> And it produc...

How do I determine where a JSTL expression variable (pageContext attribute) originated in IDEA?

We've got an app that makes heavy use of JSTL expressions and custom taglibs, which means our pageContext attributes could have been set just about anywhere. How do I go about determining where they originated? Consider something like: <c:out value="${ myObject['SOME_KEY'] }" /> I need to know where myObject came from -- how did it ma...

tag library descriptor

This is Jsp page taglib : <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> ERROR : HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exc...

keeping track of multiple related input boxes using spring mvc

we have a list of domain objects needing to be edited on an html page. For example, the command & domain objects: class MyCommand { List<Person> persons; } class Person { String fname; String lname; } Then, the HTML I expect to have the Spring MVC tag libraries generate is like this: <form> <input name="persons[0].fn...

Is there an easy way to compare two strings in a jsp?

I am creating a drop down list of all languages, with the language used when creating other info in the page as the default selected in the list: <select> <c:forEach items="${languages}" var="lang"> <c:choose> <c:when test="${lang}.equals(${pageLang})"> <option value="${lang}" selected>${lang}</option> </c:whe...