[英]Variable property name in html:text tag
我正在使用struts-1,並想在HTML:text標記中使用帶修飾符的字符串作為屬性名稱。 該字符串由一個靜態String和一個jsp:include標記給出的參數組成。
包含部分
<jsp:include page="test.jsp">
<jsp:param name="language" value="DE" />
</jsp:include>
html:text
Param: ${param.language}
<html:text property="propertyDE" name="bean" />
無法正常工作的html:text代碼
Param: ${param.language}
<html:text property="<%="property" + param.language%>" name="bean" />
有沒有辦法在html:text的property屬性中使用動態值? 我該如何實現?
更簡單的方法是按以下方式使用它:
<html:text property="property${param.language}" name="bean" />
您可以使用:
<c:set var="language" value="DE" />
導入<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
然后將該變量用作${language}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.