I want a combo box in a jsp file to display a arraylist pass by a servlet but right now it is displaying the whole arraylist in one line of the combo box. the servlet code
ArrayList<String> list = new ArrayList<String>();
list.add("A");
list.add("B");
list.add("C");
response.setIntHeader("default", 5);
request.setAttribute("name",":Motorola Solutions TC55");
request.setAttribute("item",list);
request.getServletContext().getRequestDispatcher("/default.jsp").forward(request, response);
the jsp code
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Include Manufacture name</title>
</head>
<body >
<p id ="L1">Name :- <%=request.getAttribute("name")%></p>
<select>
<c:forEach items="${item}" var="temp">
<option value='${temp}'>${temp}</option>
</c:forEach>
</select>
<button type="button" >Change Content</button>
</body>
</html>
i added <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> now t The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
jstl
jar to your buildpath . – Santhosh