如何在JSP中通过单击输入按钮在HTML输入文本框中显示java变量值
这是我的JSP代码如何在JSP中通过单击输入按钮在HTML输入文本框中显示java变量值,java,html,jsp,servlets,Java,Html,Jsp,Servlets,这是我的JSP代码 <%@page import="PresentationPkg.TestCls"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type&q
<%@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>
JSP页面
我想通过单击按钮“提交视图”在“resultCode”文本框中显示变量“newTestResultCode”值这应该可以:
<input type="text" id="resultCode" name="resultCode" value=<%=newTestResultCode%>>
尝试下面的代码。不要忘记添加jquery js