简体   繁体   English

Struts2 - OGNL 参数化名称

[英]Struts2 - OGNL parameterized name

I have a generic jsp which is in charge of printing some values, the values depends on a parameter.我有一个通用的 jsp 负责打印一些值,这些值取决于一个参数。

For example, I have an object car with and attribute color and a object house with the same attribute, I want to use the same jsp receiveng the name of the object as a parameter.例如,我有一个具有和属性颜色的对象汽车和一个具有相同属性的对象房子,我想使用相同的jsp接收对象的名称作为参数。

<jsp:include page="/jsp/prv/generic/PaintColor.jsp" >
    <jsp:param name="element" value="car" />
</jsp:include>  

So, I want to print the value of car color.所以,我想打印汽车颜色的值。 I try to do it like this:我尝试这样做:

<s:set var="propertyName">${param.element}.color<s:set/>

<s:property value="%{#attr.propertyName}" />

It doesnt work, but if I do它不起作用,但如果我这样做

<s:textfield name="%{#attr.propertyName}"/>

it works perfect.它完美无缺。

How can I use the parametrized name in avalue?如何在 avalue 中使用参数化名称?

我终于解决了它访问 java scriptlet 的值

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

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