import com.lanou.model.beans.User;
public class loginServlet extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { User wubaoxue=new User(); User wangwenyu=new User(); wubaoxue.setUsername("pc"); wubaoxue.setPwd("123"); User zhongxin=new User(); zhongxin.setUsername("zhongxin"); zhongxin.setPwd("123"); wangwenyu.setUsername("wangwenyu"); wangwenyu.setPwd("123"); List<User> list=new ArrayList<>(); list.add(wangwenyu); list.add(zhongxin); list.add(wubaoxue); Map<String, String> card=new HashMap<>(); card.put("ICBC", "678637824619673219"); card.put("ABC","333333782487492"); wubaoxue.setCard(card); wubaoxue.setClassmate(list); int [] age={25,27,28}; wubaoxue.setAge(age); req.setAttribute("li",wubaoxue); req.getRequestDispatcher("/jsp/suceess.jsp").forward(req, resp); }
<%="======="%>
<%=request.getAttribute("username")%> <%session.setAttribute("li", "pc");%><%-- ${sessionScope.li} --%>
${li.age[0]}; <%!int i=0;%> <%for(int i=0;i<2;i++){ request.setAttribute("i", i); %> ${li.classmate[i].username}; <% } %>taglib------>标签集合
url----->standart(1).jar
perfix:头
<c:if var="a" test="${23==23}">
<div>you are ture ${a}</div> </c:if> <c:choose> <c:when test="${23==3}"> <div>you are turn</div> </c:when> <c:when test="${23==2}"> <div>you are also turn</div> </c:when> <c:otherwise> <div>you are false</div> </c:otherwise> </c:choose>