Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 是否有任何方法将输入标记的名称与递增的整数变量连接起来_Html_Jsp - Fatal编程技术网

Html 是否有任何方法将输入标记的名称与递增的整数变量连接起来

Html 是否有任何方法将输入标记的名称与递增的整数变量连接起来,html,jsp,Html,Jsp,我已经在while循环中包含了输入标记,所以我需要通过在循环中增加int变量来连接name来更改循环中输入标记的名称 我试着使用$mark,但它对我不起作用 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body>

我已经在while循环中包含了输入标记,所以我需要通过在循环中增加int变量来连接name来更改循环中输入标记的名称

我试着使用$mark,但它对我不起作用

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
</head>
<body>
    <% int a= 0;
        while(a<b){ 
            //out.println(ss);
            //out.println("Emp No"+a);
    %>
    Task Id: <input type="number" name="task_id${a}" value="<%=id%>">
    Emp Id: <input type="text" name="emp_id"><br>
    <% 
        a++;
    }%>

JSP页面
Emp Id:
我需要将此名称命名为name1、name2、name3…..

使用与获取id类似的名称:

<input type="number" name="task_id<%=a%>" value="<%=id%>">
使用与获取id类似的方法:

<input type="number" name="task_id<%=a%>" value="<%=id%>">
这对我有用

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
</head>
<body>
    <% int a= 0;
        while(a<b){ 
            int c= a+1;
    %>
    Task Id: <input type="number" name="task_id<%=c%>" value="<%=id%>">
    Emp Id: <input type="text" name="emp_id"><br>
    <% 
        a++;
    }%>

JSP页面
Emp Id:
这对我很有用

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
</head>
<body>
    <% int a= 0;
        while(a<b){ 
            int c= a+1;
    %>
    Task Id: <input type="number" name="task_id<%=c%>" value="<%=id%>">
    Emp Id: <input type="text" name="emp_id"><br>
    <% 
        a++;
    }%>

JSP页面
Emp Id: