Java 在JSTL中输出表单数据(仅一条记录)

Java 在JSTL中输出表单数据(仅一条记录),java,jstl,cout,Java,Jstl,Cout,我需要做的是只输出一个客户,而不是客户列表。foreach将适用于输入的每个客户,但我只需要刚刚输入的客户。我是否与某个东西一起使用以获得价值,或者如何实现这一点 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional/

我需要做的是只输出一个客户,而不是客户列表。foreach将适用于输入的每个客户,但我只需要刚刚输入的客户。我是否与某个东西一起使用以获得价值,或者如何实现这一点

<%@ 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">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<c:forEach items="${requestScope.customers}" var="customer">
<c:out value="${customer.firstName }"/>
</c:forEach>

</body>
</html>

在此处插入标题

如果只想显示一个对象,则不需要
。 您可以在请求范围内设置对象,并使用

<c:out value="${customer.firstName}"/>
request.setAttribute("customer", customerObject);