<------------ DisplayTag.java -------------->
public final class DisplayTag extends TagSupport { private Log log =
LogFactory.getLog(this.getClass().getName());
public int doEndTag() throws JspException
{
JspWriter out = pageContext.getOut();
HttpSession session = pageContext.getSession();
try
{ String strSql=(String)session.getAttribute(Constants.SQLSTMT_KEY);
Vector addressBookBeans=AddressBooBean.search(strSql); out.println("<table border=\"2\" cellspacing=\"0\" cellpadding=\"0\">");
out.println("<tr>");
out.println("<th BGCOLOR=\"#00FF00\"><b>Name</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>Phone<b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>Address</b></th>");
out.println("</tr>"); for(int i=0;i<addressBookBeans.size();i++)
{
AddressBookBean bean=(AddressBookBean)addressBookBeans.elementAt(i);
out.println("<tr>");
out.println("<td>"+ bean.getName() + "</td>");
out.println("<td>" +bean.getPhone() + "</td>");
out.println("<td>"+bean.getAddress()+"</td>");
} out.println("</table>");
}catch (Exception ex)
{
throw new JspTagException("IOException:" + ex.toString());
}
return super.doEndTag();
}
}<---------------- app.tld -------------->
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>Application Tag Library</shortname>
<uri>http://jakarta.apache.org/taglibs/struts-example-1.0</uri>
<info>
This tag library contains functionality for the Addressbook Struts
Sample Application. With small modifications, they can be used
as generic tags.
</info> <tag>
<name>validateSession</name>
<tagclass>addressbook.tags.ValidateSessionTag</tagclass>
<bodycontent>empty</bodycontent>
<info>
Validate that there is a currently logged on user, by checking for
the existence of a session-scope bean under the specified name.
If there is no such bean, forward control to the specified page,
which will typically be a logon form. Attributes:
name - Name of the session-scope bean to check for
page - Context-relative path to the logon page
</info>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>page</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>display</name>
<tagclass>addressbook.tags.DisplayTag</tagclass>
<bodycontent>empty</bodycontent>
<info>
Displays all the records from the database that match a given criteria
</info>
</tag>
</taglib><-------------- displaycontent.jsp ----------------->
<%@ include file="taglibs.jsp" %><app:validateSession/>
<jsp:useBean id="user" scope="session" type="addressbook.model.UserBean"/>
<center>
<h2>Displaying all the Addresses found...</h2>
<app:display/> -------------------这个地方我不知道加对没有<html:link forward="mainMenu"><bean:message key="goto.mainMenu"/></html:link>
<html:link forward="search"><bean:message key="goto.search"/></html:link>
</center>描述:对数据库可以进行插入操作,但不能查询,点及"查询"时
无法显示网页
您要访问的网页有问题,无法显示。 --------------------------------------------------------------------------------请尝试以下操作:打开 127.0.0.1:8080 主页,然后查找指向您感兴趣信息的链接。
单击刷新按钮,或以后再试。单击搜索,寻找 Internet 上的信息。
也可查看相关站点列表。
HTTP 500 - 内部服务器错误
Internet Explorer 是咋会事啊,,,,,,我快疯啦
public final class DisplayTag extends TagSupport { private Log log =
LogFactory.getLog(this.getClass().getName());
public int doEndTag() throws JspException
{
JspWriter out = pageContext.getOut();
HttpSession session = pageContext.getSession();
try
{ String strSql=(String)session.getAttribute(Constants.SQLSTMT_KEY);
Vector addressBookBeans=AddressBooBean.search(strSql); out.println("<table border=\"2\" cellspacing=\"0\" cellpadding=\"0\">");
out.println("<tr>");
out.println("<th BGCOLOR=\"#00FF00\"><b>Name</b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>Phone<b></th>");
out.println("<th BGCOLOR=\"#00FF00\"><b>Address</b></th>");
out.println("</tr>"); for(int i=0;i<addressBookBeans.size();i++)
{
AddressBookBean bean=(AddressBookBean)addressBookBeans.elementAt(i);
out.println("<tr>");
out.println("<td>"+ bean.getName() + "</td>");
out.println("<td>" +bean.getPhone() + "</td>");
out.println("<td>"+bean.getAddress()+"</td>");
} out.println("</table>");
}catch (Exception ex)
{
throw new JspTagException("IOException:" + ex.toString());
}
return super.doEndTag();
}
}<---------------- app.tld -------------->
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>Application Tag Library</shortname>
<uri>http://jakarta.apache.org/taglibs/struts-example-1.0</uri>
<info>
This tag library contains functionality for the Addressbook Struts
Sample Application. With small modifications, they can be used
as generic tags.
</info> <tag>
<name>validateSession</name>
<tagclass>addressbook.tags.ValidateSessionTag</tagclass>
<bodycontent>empty</bodycontent>
<info>
Validate that there is a currently logged on user, by checking for
the existence of a session-scope bean under the specified name.
If there is no such bean, forward control to the specified page,
which will typically be a logon form. Attributes:
name - Name of the session-scope bean to check for
page - Context-relative path to the logon page
</info>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>page</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>display</name>
<tagclass>addressbook.tags.DisplayTag</tagclass>
<bodycontent>empty</bodycontent>
<info>
Displays all the records from the database that match a given criteria
</info>
</tag>
</taglib><-------------- displaycontent.jsp ----------------->
<%@ include file="taglibs.jsp" %><app:validateSession/>
<jsp:useBean id="user" scope="session" type="addressbook.model.UserBean"/>
<center>
<h2>Displaying all the Addresses found...</h2>
<app:display/> -------------------这个地方我不知道加对没有<html:link forward="mainMenu"><bean:message key="goto.mainMenu"/></html:link>
<html:link forward="search"><bean:message key="goto.search"/></html:link>
</center>描述:对数据库可以进行插入操作,但不能查询,点及"查询"时
无法显示网页
您要访问的网页有问题,无法显示。 --------------------------------------------------------------------------------请尝试以下操作:打开 127.0.0.1:8080 主页,然后查找指向您感兴趣信息的链接。
单击刷新按钮,或以后再试。单击搜索,寻找 Internet 上的信息。
也可查看相关站点列表。
HTTP 500 - 内部服务器错误
Internet Explorer 是咋会事啊,,,,,,我快疯啦
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货