急急!!!!!为什么struts显示空白页
我做SSH做的网上书城可以登陆,注册,添加书籍了。而且添加的书籍也到数据库里面了。但插入的结果就是不能在页面中显示。调试了一整天了!!!
从库里就调不出数据来
怎么回事啊
要晕死了
各个页面关键代码如下:
POJO类
public abstract class AbstractBookcatalog implements java.io.Serializable {
private Integer bookcatalogsid;
private String bookcatalogname;
private Set books = new HashSet(0);
....set与get方法....
public class Bookcatalog extends AbstractBookcatalog implements java.io.Serializable {
// Constructors
/** default constructor */
public Bookcatalog() {
}
/** minimal constructor */
public Bookcatalog(String bookcatalogname) {
super(bookcatalogname);
}
/** full constructor */
public Bookcatalog(String bookcatalogname, Set books) {
super(bookcatalogname, books);
}
}
DAO类
BookDAOImlp.java
//查询图书类型
public List listBookcatalog(
{
return getHibernateTemplate().find("from Bookcatalog as b");
}
Service类
BookServiceImlp.java
public List listBookcatalog()
{
return this.bookdao.listBookcatalog();
}
Action类
//这里通过查询图书类型,加入到session里了
public class CatalogAction extends Action {
private IBookService service;
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,HttpServletResponseresponse) {
request.getSession().setAttribute("log",this.service.listBookcatalog());
return mapping.findForward("catalogs");
}
public IBookService getService() {
return service;
}
public void setService(IBookService service) {
this.service = service;
}
}
页面代码:
login_suc.jsp
<center>
欢迎你!!<bean:write name="user" property="username"/><br />
<a href="catalog.do">浏览图书分类</a>
</center>
/user/browseCatalog.jsp
<html:form action="/browseBook" method="post">
<Table border="1">
<logic:present name="log">
<logic:iterate id="cata" name="log" scope="request" type="cn.ling.bookstore.vo.Bookcatalog">
<tr>
<td><bean:writename="cata"property="bookcatalogname"/></td>
</tr>
</logic:iterate>
</logic:present>
<tr><td align="center"><html:submit value="查询图书"/></td></tr>
</Table>
</html:form>
以下是struts-config.xml的配置:
//我没用到form类,采用直接跳转
<action
path="/catalog"
type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="catalogs" path="/user/browseCatalog.jsp"></forward>
</action>
applicationContext.xml配置
//注入
<bean name="/catalog"
class="cn.ling.bookstore.struts.action.CatalogAction"
abstract="false" singleton="false" lazy-init="default"
autowire="default" dependency-check="default">
<property name="service">
<ref bean="bookservice" />
</property>
</bean>