c:set标签中的var 与value的关联问题!!!

本文探讨了在JSP页面中使用<c:set>标签时遇到的一个常见错误:当尝试将一个字符串类型的值应用到List或数组上时引发的异常。通过具体的代码实例,分析了错误产生的原因,并强调了正确的<c:set>使用方法。
.jsp加入代码:
<c:set scope="session" value="${page.result}" var="page"></c:set>
<c:set value="${page1.result}" var="page1" scope="session"></c:set>
<c:set value="${page2.result}" var="page2" scope="session"></c:set>
报错:
avax.servlet.jsp.el.ELException: The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer.
可见这种<c:set>的用法是错误的!!!!!!

data class Contact( var keys: ContactKeys? = null, var displayName: String? = null, var givenName: String? = null, var middleName: String? = null, var familyName: String? = null, var prefix: String? = null, var suffix: String? = null, var company: String? = null, var jobTitle: String? = null, var lastModified: Date? = null, var note: String? = null, val emails: MutableList<Item> = mutableListOf(), val groups: MutableSet<String> = linkedSetOf(), val phones: MutableList<Item> = mutableListOf(), val socialProfiles: MutableList<Item> = mutableListOf(), val urls: MutableList<Item> = mutableListOf(), val dates: MutableList<ContactDate> = mutableListOf(), val postalAddresses: MutableList<PostalAddress> = mutableListOf(), /// read-only val linkedContactIds: MutableList<String> = mutableListOf(), var avatar: ByteArray? = null ) { constructor(mode: ContactMode, identifier: String) : this( keys = ContactKeys( mode = mode, identifier = identifier.toLong())) var identifier: Long? get() = keys?.identifier set(value) { keys = keys!!.withIdentifier(value) } var unifiedContactId: Long? get() = keys?.unifiedContactId set(value) { keys = keys!!.copy(unifiedContactId = value) } var singleContactId: Long? get() = keys?.singleContactId set(value) { if (value != null && keys?.mode == UNIFIED) { if ("$value" !in linkedContactIds) { linkedContactIds += "$value" } } keys = keys!!.copy(singleContactId = value) } var lookupKey: String? get() = keys?.lookupKey set(value) { keys = keys!!.copy(lookupKey = value) } companion object } 用ArkTS
10-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值