以下这是错误提示
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /welcome.jsp at line 31
28: <%
29: List<Newstb> lst=(List<Newstb>)request.getAttribute("newlist");
30: for(Newstb news:lst){%>
31: <a href=""><%=news.getTitle()%></a>----><%=news.getType().getName() 【这里如果我用的是getId()就没有任何问题】%><br />
32: <% }%>
33: </body>
34: </html>
以下是首页跳转的struts2的那个Action
package com.news.struts2.action;
import java.util.List;
import org.apache.struts2.ServletActionContext;
import com.news.dao.news.NewsDao;
import com.news.entity.news.Newstb;
import com.news.splitpage.SplitPage;
import com.opensymphony.xwork2.ActionSupport;
public class IndexAction extends ActionSupport {
private NewsDao newsDao;
public void setNewsDao(NewsDao newsDao) {
this.newsDao = newsDao;
}
@Override
public String execute() throws Exception {
SplitPage sp = newsDao.splitpage(0,10);
List<Newstb> lst = (List<Newstb>) sp.getLst();
ServletActionContext.getContext().put("newlist",lst);
return SUCCESS;
}
}
以下是struts2的配置文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
" http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.objectFactory" value="spring" />
<package name="page" extends="struts-default">
<action name="welcome" class="indexAction">
<result name="success">/welcome.jsp</result>
<result name="input">/welcome.jsp</result>
</action>
<action name="randNum" class="utilAction" method="validNumGenerate">
<result name="success" type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">inputStream</param>
</result>
</action>
</package>
<package name="manager" namespace="/m" extends="struts-default">
<action name="mlogin" class="managerAction" method="login">
<result name="success">/send.jsp</result>
<result name="input">/m/mlogin.jsp</result>
<result name="error">/m/mlogin.jsp</result>
</action>
<action name="loginout" class="managerAction" method="out">
<result name="success">/send.jsp</result>
<result name="input">/send.jsp</result>
<result name="error">/send.jsp</result>
</action>
</package>
</struts>
以下是映射的实体类
package com.news.entity.news;
import java.util.List;
public class NewsTypetb {
private int id;
private String name;
private List<Newstb> news;
public List<Newstb> getNews() {return news;}
public void setNews(List<Newstb> news) {this.news = news;}
public int getId() {return id;}
public void setId(int id) {this.id = id; }
public String getName() { return name;}
public void setName(String name) {this.name = name;}
}
有字数限制,我写不到了,可以加我QQ351984592,非常感谢,没分了这是所有分
y