【发布时间】:2021-02-04 03:04:28
【问题描述】:
这是我的 JSP 代码
<%@page import="PresentationPkg.TestCls"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="ex.jsp">
<input type="text" id="resultCode" name="resultCode">
<input type="button" name="viewValue" value="Submit View"/>
<%
String newTestResultCode = TestCls.getMaxTestResultID();
%>
</form>
</body>
</html>
我想通过单击“提交视图”按钮在“resultCode”文本框中显示变量“newTestResultCode”值
【问题讨论】:
-
只需在文本框中使用
value="<%=newTestResultCode %>"。 -
@Swati 这次是红色下划线。错误是找不到符号
-
把那个jsp代码放在你输入变量之前你要获取值的地方。
-
是的。那个问题。现在我纠正了这一点。现在工作正常。谢谢斯瓦蒂