review JSP/Servlet

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

<%

out.println(“Hello World.”);

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

session.setAttribute(“username”, Object);

session.removeAttribute(“username”);

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

ServletContext application = getServletContext();

application.setAtribute(“username”, Object);

application.removeAttribute(“username”);

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

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

//GET, POST

request.getMethod();

%>

<%@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:include>

<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:

WordPress.com Logo

You are commenting using your WordPress.com 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