如何在不使用jsp的情况下将参数从Javaservlet传递到html表单

如何在不使用jsp的情况下将参数从Javaservlet传递到html表单,java,servlets,parameters,forms,Java,Servlets,Parameters,Forms,我想将一些参数从Javaservlet传递到要显示的html表单。我已经阅读了一些关于jsp的内容,但我想知道是否可以直接使用以下内容: <script> var temp = "${param['CookieServlet0.First_Name']}"; </script> <input type = "text" name = "First_Name" id = "First_Name" value = "temp" > <br> form

我想将一些参数从Javaservlet传递到要显示的html表单。我已经阅读了一些关于jsp的内容,但我想知道是否可以直接使用以下内容:

<script> var temp = "${param['CookieServlet0.First_Name']}"; </script>
<input type = "text" name = "First_Name" id = "First_Name" value = "temp" > <br>
formB.jsp

<%@ 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>Insert title here</title>
</head>
<body>
<label for = "First Name"> First Name </label>
<input type = "text" name = "First_Name" id = "First1_Name" value = "${First_Name}" 
"> <br>
</body>
</html>

在此处插入标题
名字

不,除非编写自己的解析器/注入器,否则不能直接执行。 然而,使用bean可以让您尽可能接近它。只需使用
并用bean属性的值替换html即可

快速的谷歌搜索产生了这个网站,其中包含关于如何使用bean和jsp的示例:

如Luiggi所述,如果您想使用JSTL,这里有一个很好的网站:

尝试使用:

RequestDispatcher dispatcher = request.getRequestDispatcher(strViewPage);
而不是:

RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(strViewPage);

如何在不使用JSP的情况下呈现HTML表单?您只有一个静态HTML文件和不相关的servlet?@dimony您甚至可以使用普通HTML将数据发送到servlet。JSP更像是显示和呈现从Servlet检索到的数据的视图技术。或者更好:使用表达式语言和JSTL而不是
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(strViewPage);