單擊按鈕添加組織時,表單將顯示參數ID
和NAME
。在用戶點擊提交按鈕後輸入ID
和NAME
後,給定的條目應該被存儲,並且當在主頁中查看組織的主表時,它應該具有由用戶輸入的值。你可以使用任何東西MVC
JSP
JAVA
或任何東西。如何將動態輸入的值以jsp格式保存到arraylist中?
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title> Organization List</title>
</head>
<body>
<table border= '1' class="floatedTable">
<thead>
<tr>
<th>Organization ID</th>
<th>Organization Name</th>
</tr>
</thead>
<tr>
<td>1</td>
<td>Tieto</td>
</tr>
<tr>
<td>2</td>
<td>Microsoft</td>
</tr>
<tr>
<td>3</td>
<td>Google</td>
</tr>
<tr>
<td>4</td>
<td>Chevron</td>
</tr>
</table>
<br>
<table border= '1' class="floatedTable">
<thead>
<tr>
<th>Employee ID</th>
<th>Employee Name</th>
<th>Employee Address</th>
<th>Employee Works in</th>
</tr>
</thead>
<tr>
<td>1</td>
<td>Dheeraj Kumar</td>
<td>Pune</td>
<td>Tieto</td>
</tr>
<tr>
<td>2</td>
<td>Revan</td>
<td>Wagholi</td>
<td>Microsoft</td>
</tr>
<tr>
<td>3</td>
<td>Deepali</td>
<td>karvenagar</td>
<td>Google</td>
</tr>
<tr>
<td>4</td>
<td>Amol</td>
<td>Bavdan</td>
<td>Chevron</td>
</tr>
</table>
<br>
<button type="button" onclick="location = 'AddOrganisation.jsp'">ADD Organization</button>
<button type="button" onclick="location = 'AddEmployee.jsp'">ADD Employee</button>
</body>
</html>
我沒有看到問題,只有一個要求。你有什麼嘗試,這裏有一個靜態表,你將在哪裏存儲值(數據庫,文件,緩存,cookie,會話...)。然後,JSP或JSTL在哪裏生成具有這些值的表。你只有一個HTML模板,但沒有什麼功能,這是一個短暫的尋求幫助,你應該搜索教程(我建議你一個很好的JSP/JSTL教程) – AxelH