简体   繁体   English

如何从jsp中的bean中获取值,该jsp存储在map.Map中正确返回bean对象

[英]How to get values from bean in jsp which is stored in map.Map returning bean object properly

The following is Map objects which contains bean object. 以下是包含bean对象的Map对象。

hasMap = customerData.getCustomerDetailsMap(); 

I stored 'customer Details Bean' inside Map,and Now i am setting this map to request parameter in servlet and passing to jsp 我将“客户详细信息Bean”存储在Map中,现在我将此地图设置为在servlet中请求参数并传递给jsp

request.setAttribute("customerDataMap", hasMap); 

retrieving the hashmap in jsp by following code. 通过以下代码检索jsp中的哈希图。

${customerDataMap[param.value]}

using param.value as key i am getting the customer Details object(I am printing the object.i am getting the bean object.).Now i want to retrieve the values from bean in jsp .How can i achieve this in jsp only . 使用param.value作为键,我正在获取客户Details对象(我正在打印对象。我正在获取bean对象。)现在我想从jsp中的bean中检索值。我如何仅在jsp中实现此目的。

I don't want to send bean object directly to jsp. 我不想直接将bean对象发送到jsp。

have you tried ${customerDataMap[param.value].objectProperty} ? 您是否尝试过${customerDataMap[param.value].objectProperty}

For example ${customerDataMap[param.value].name} 例如${customerDataMap[param.value].name}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM