Forums Register Login

problem in displaying dropdown menu items in jsp with jstl

+Pie Number of slices to send: Send
see my controller code


protected Map referenceData(HttpServletRequest request){
Map refDataMap=new HashMap();
IEmsDelegator delegator = (IEmsDelegator) getDelegator(BeanConstants.EMS_DELEGATOR);
List expenseTypeList=delegator.getExpenseTypes();
refDataMap.put(EmsConstants.EXPENSE_TYPES_LIST,expenseTypeList);
return refDataMap;
}



where
EmsConstants.EXPENSE_TYPES_LIST is
public static final String EXPENSE_TYPES_LIST="expTypes";


and part of jsp relevent to this topic is

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="spring" uri="/spring"%>
<HTML>

.
.
.
.
..

<SELECTsize="1" >
<OPTION value="-1">
SELECT...
</OPTION>
<c:forEach items="${expTypes}" var="expenseType">
<option value="${expenseType.expenseTypeId}">${expenseType.expenseTypeName}</option> </c:forEach>
</SELECT>



part of tld file

<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 http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">

<description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>;


my problem
when i want to render the jsp page my page does not render actual o/p

but gives ${expenseType.expenseTypeName}


please help to solve this problem
+Pie Number of slices to send: Send
If EL expressions are not being evaluated, you may have a set up problem. See the JSP FAQ for information on properly setting up a JSP 2.0 web application.
+Pie Number of slices to send: Send
Thanks Bear Bibeault

i face roblem only in displaying dropdown menu

but my normal

<inputtype="text"
name="<c ut value="${status.expression}"/>"
value="<c ut value="${status.value}"/>"

tag works fine and does not have any problem

i face only problem in dropdoown menu
+Pie Number of slices to send: Send
Please help meto solve this problem
+Pie Number of slices to send: Send
What container and version? What is the declaration at the top of your web.xml?
+Pie Number of slices to send: Send
Did you check to see if your list is getting populated? And also is the forEach getting executed? I mean if you give something like this, is it working?

<c:forEach items="${expTypes}" var="expenseType">
Hello
</c:forEach>
+Pie Number of slices to send: Send
Thanks for taking time for me



first reply to Bear Bibeault

i am testing this application on both

jboss-4.0.2 and Apache Tomcat 5.0


declaration at the top of my web.xml is

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<!--##################taglibs used in the application#######################-->
<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/tld/spring.tld</taglib-location>
</taglib>

<taglib>
<!-- <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>-->;
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>;
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>




part of my c.tld file is

<?xml version="1.0" encoding="UTF-8" ?>

<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 http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">

<description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>;






now reply to sushma sree

my List contains 4 record of Expense Type

as u said i tried
and it gives me 4 hello printed on my jsp page

it will be great help to me if anyone solve this issue
[ April 04, 2006: Message edited by: ganesh pol ]
+Pie Number of slices to send: Send
Your web.xml declaration is wrong. In order to enable the EL outside of the JSTL tags (like <c:out>) you must declare your web.xml using the Servets 2.4 XML Schema.

See the JSP FAQ for details.
+Pie Number of slices to send: Send
bear is right
you have to use

<web-app 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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
+Pie Number of slices to send: Send
one more thing

is map is set as attribute

pageContext.setAttribute("map", yourmap);

see The JSTL Expression Language > Common Mistakes
http://www.phptr.com/articles/article.asp?p=30946&seqNum=10&rl=1
+Pie Number of slices to send: Send
Thanks
Bear Bibeault and srilatha kareddy

i follow as u said and now it works fine and it displays correct values
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2352 times.
Similar Threads
problem with tld file
getting "No tag "forEach" defined in tag library imported with prefix "c" "
The absolute uri problem
Problems making Struts/JSTL 1.2 site work with JSTL 2.0
Versions of JSTL and EL on a legacy project
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:57:39.