review JSP/Servlet

<%@ page language=”java” import=”java.util.*”  %>


out.println(“Hello World.”);

String username = (String)session.getAttribute(“username”);

session.setAttribute(“username”, Object);


String user = (String)application.getAttribute(“username”);

ServletContext application = getServletContext();

application.setAtribute(“username”, Object);


String value = request.getParameter(“value”);

String[] value = request.getParameterValue(“names”);




<%@include file=”common.jsp” %>

<jsp:include page=”header.jsp” flush=”true” />

<jsp:include page=”testParam,jsp” flush=”true”>

<jsp:param name=”greeting” value=”Hello World” />


<jsp:forward page=”pageThree.jsp” />

<% response.sendRedirect(“hello.jsp?username=abc”); %>

// trong file Servlet

HttpSession session = request.getSession(false);     // không yêu cầu tạo mớ


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s