我有一个数组:
<%@include file = "globalFunctions.jsp" %>
<% Boolean submitted = Boolean.parseBoolean(request.getParameter("isSubmitted"));
double we = 0, he = 0;
if(submitted){
weight = Double.parseDouble(request.getParameter("w"));
height = Double.parseDouble(request.getParameter("h"));
}
%>
<h3>BMI Calculator</h3>
<form action = "index.jsp" method = "post">
<input type ="hidden" name = "isSubmitted" value = "true">
Weight: <input type = "text" name = "w"> <br> <br>
Height: <input type = "text" name = "h"> <br> <br>
<input type = "submit" value = "Compute"> <br> <br>
BMI: <%= calcBMI(we, he) %> <br> <br>
Classification: <%= classification %>
</form>
我指定为用于字段创建的[
0 => 'translate.label1',
1 => 'translate.label2',
2 => 'translate.label1'
]
参数。
现在,是否可以通过已翻译的标签对这些选项进行排序?例如,choices
已翻译的值零,label1
- 某些内容,label2
- abracadabra 。当然,我希望选择的选项是:
我想使用这种方法:https://stackoverflow.com/a/21586886/2324004
但它是否涉及视图内的第二个翻译摘要?有任何想法吗?我宁愿使用更灵活的东西,因为我的表单基于非固定的选择计数,它会执行递归的东西......