Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSTL form-object handling

843836Sep 15 2003 — edited Sep 16 2003
Hi!

I have a jsp-page which includes a bunch of other jsp-pages. Each of the included jsp-pages are drop-down menus which also depend on choices from the other drop-down menus. The whole form is database-driven. Some of the drop-down menus are of "multiple choice"-character. My problem is that when the user chooses more than one value, only the first is kept selected. This means that I cannot process all the values. I post my code here for one of those jsp-pages and pray for some help!

***** Form jsp-page snippet *********

<form name="EgenDefTableForm" method="get">
<table width="324" border="1" align="center" cellpadding="7" cellspacing="7">
...
<td>
<jsp:include page="GetKlass1List.jsp">
<jsp:param name="variable1" value="Variabel" />
<jsp:param name="klass1" value="Klass" />
<jsp:param name="selVariable1" value='<%= pageContext.getAttribute("selVariable1") %>' />
</jsp:include>
</td>
...
</table>

********* Included page - GetKlass1List *************

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@taglib uri="/WEB-INF/tld/x.tld" prefix="x" %>
<%@taglib uri="/WEB-INF/tld/sql.tld" prefix="sql" %>

<select name="selKlass1" size="5" multiple onChange="submit()">
<option value="-1">-------- V?lj klass 1 --------</option>
<c:forEach var="selKlasses1" items="${paramValues.klass1}">
<sql:query var="result"
sql="SELECT ${param.klass1}ID as id, ${param.klass1}Namn as name, TaxbasValue as tbVal1
FROM ${param.klass1}
WHERE ${param.variable1}ID = ${param.selVariable1}"
/>
<c:forEach items="${result.rows}" var="row">
<c:choose>
<c:when test="${param.selKlass1 == row.id}"> >
<c:set var="kls1Name" value="${row.name}" scope="request"/>
<c:set var="kls1ID" value="${row.id}" scope="request"/>
<c:set var="taxbValue1" value="${row.tbVal1}" scope="request"/>
<option value="<c:out value='${row.id}'/>" selected>
<c:out value="${row.name}"/>
</option>
</c:when>
<c:otherwise>
<option value="<c:out value='${row.id}'/>" >
<c:out value="${row.name}"/>
</option>
</c:otherwise>
</c:choose>
</c:forEach>
</c:forEach>
</select>


PS. I do not want to use javascript for this if it isnt really necessary.

Regards,

Maggie
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 14 2003
Added on Sep 15 2003
9 comments
393 views