我正在尝试将 String[] 从 java 类传递给 jsp 文件,我设法传递了一个简单的字符串,但我现在被困在这个字符串上几天了。有人可以帮助我吗,我希望答案更详细,因为我是新手。
Java类:
public class UserArray extends Applet {
public String javaArray [] =
{ "array 1", "array 2" , "array 3" };
public String [] getJavaArray() {
return javaArray;
}
}
JSP
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sb" uri="/struts-bootstrap-tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<jsp:useBean id ="array" class="eu.xyx.ztr.applet.UserArray"/>
</head>
<body>
<h4>
<jsp:getProperty name ="array" property="javaArray"/>
</h4>
</body>
到目前为止,我已经获得了 String[] 的地址。我只想获取 javaArray 的值,如果可以以如下形式获取它们:
<script>
function addrow(tableID){
var numeuser=document.numeuser;
var nume=["adrian","cristi","levi",numeuser];
var prenume=["ric","dre","asd"];
var email=["rew@td","qq@eqwq","ee@ew"];