質問

私はJSPタグで次のことを達成しようとしています:

select.tag

<%@ attribute name="id" required="true" %>
<%@ attribute name="path" required="true" %>
<%@ attribute name="items" required="true" %>
<%@ attribute name="itemLabel" required="false" %>
<%@ attribute name="itemValue" required="false" %>

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<form:select path="${path}" id="${id}">
    <form:options items="${items}" itemLabel="${itemLabel}" itemValue="${itemValue}"/>
</form:select>
.

使用法:( MyCollectionAttributeは@ModelAttribute( "MyCollectionAttribute"))で定義されています。

<tags:select items="${mycollectionattribute}" id="id" path="mybean.selectvalue" itemLabel="label" itemValue="id"/>
.

しかし、呼び出しページからこのタグの項目のコレクションを正しくマッピングする方法を理解することはできません。ELは評価されていないようで文字列として送信され、次のエラーが発生します。

javax.servlet.ServletException: Type [java.lang.String] is not valid for option items
.

私はJSTLのかわいい古いバージョンを使用しています。EL式が正確に評価されたときに、Markupで直接$ {x}が正確に評価されていない場合は、特別なタグでのみ機能します。アップグレードがこの問題を解決するかもしれませんか?もしそうなら、JBossにバンドルされたものの代わりにあなた自身のJSTL libをどれほど難しいか?

役に立ちましたか?

解決

Solved.

Was using mismatching servlet versions (2.5 specified, but JBoss 4 uses 2.4), both as dependency and in in web.xml. So EL wasn't working like it should.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top