<?xml version=
<taglib>
<tlib
<jsp
<tag>
<name>display</name>
<tagclass>com
<bodycontent>empty</bodycontent>
<attribute>
<name>page</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>
package com
import java
import javax
import javax
import javax
import javax
import com
public class DisplayTag extends TagSupport {
/**
*
*/
private static final long serialVersionUID =
private String name =
private String page;
public String getName() {
return name;
}
public void setName(String name) {
this
}
public String getPage() {
return page;
}
public void setPage(String page) {
this
}
private String test;
public String getTest() {
return test;
}
public void setTest(String test) {
this
}
@Override
public int doStartTag() throws JspException {
return SKIP_BODY;
}
public int doEndTag() throws JspException {
boolean valid = false;
HttpSession session = pageContext
if (session != null && session
valid = true;
} else {
try {
pageContext
} catch (Exception e) {
// TODO: handle exception
throw new JspException(e
}
}
JspWriter out = pageContext
try {
List users = (List) session
if (valid) {
out
out
out
out
out
out
for (int i =
User user = (User) users
out
out
out
out
}
out
} else {
out
}
} catch (Exception e) {
// TODO Auto
throw new JspTagException(
}
return SKIP_PAGE;
}
@Override
public void release() {
// TODO Auto
super
this
this
}
}
package com
import java
import javax
import javax
import org
import org
import org
import org
import org
import com
public class LoginAction extends Action {
private UserDAO userDao;
public UserDAO getUserDao() {
return userDao;
}
public void setUserDao(UserDAO userDao) {
this
}
public ActionForward execute(ActionMapping mapping
DynaValidatorForm loginForm = (DynaValidatorForm) form;
String username = loginForm
String password = loginForm
if (userDao
List users = userDao
request
request
return mapping
} else {
return mapping
}
}
}
<%@ taglib uri=
<app:display page=
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28512.html