将数组从 JSP 传递到 Javascript(如何在 javascript 中创建矩阵)
我从我的java代码中得到一个列表,我想从这个列表中创建一个矩阵。 在我的jsp中,我有一个选择,我想在表中显示我的矩阵值与我的选择选择中的值的关系,
我的java中的列表
<html:select property="immeuble.zone" size="1" styleId="zone" styleClass="saisie">
<html:optionsCollection property="optionsZone" label="libelle" value="code"/>
</html:select>
,我的jsp中的lsit,
List optionsZone = new ArrayList(3);
optionsZone.add(new CodeLibelleBean("1","1"));
optionsZone.add(new CodeLibelleBean("2","2"));
optionsZone.add(new CodeLibelleBean("3","3"));
我想要显示的列表
HashMap Tarif = new HashMap();
Tarif.put("1","100");
Tarif.put("1","150");
Tarif.put("1","180");
Tarif.put("2","200");
Tarif.put("2","250");
Tarif.put("2","290");
Tarif.put("3","300");
Tarif.put("3","350");
Tarif.put("3","360");
i get a list from my java code and I would like to create a matrix from this list.
In my jsp I have a select and I would like to display in a table the values of my matrix in relation to value in my select choice
my list in my java
<html:select property="immeuble.zone" size="1" styleId="zone" styleClass="saisie">
<html:optionsCollection property="optionsZone" label="libelle" value="code"/>
</html:select>
my lsit in my jsp
List optionsZone = new ArrayList(3);
optionsZone.add(new CodeLibelleBean("1","1"));
optionsZone.add(new CodeLibelleBean("2","2"));
optionsZone.add(new CodeLibelleBean("3","3"));
my list in want display
HashMap Tarif = new HashMap();
Tarif.put("1","100");
Tarif.put("1","150");
Tarif.put("1","180");
Tarif.put("2","200");
Tarif.put("2","250");
Tarif.put("2","290");
Tarif.put("3","300");
Tarif.put("3","350");
Tarif.put("3","360");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否理解你的问题,但你可能想将数组传递给 Javascript 并在那里对它们进行一些操作。如果是这种情况,您将需要使用一些 Java JSON 转换器。
这是一个起点: https://stackoverflow.com/questions/338586/a-更好的java-json-库
I'm not sure I understood your question, but probably you want to pass your arrays to Javascript and do some operations with them there. If this is the case, you will need to use some Java JSON converter.
Here is a starting point for that: https://stackoverflow.com/questions/338586/a-better-java-json-library