我在struts中将显示标签应用于我的jsp但无法做到,请查看
1.strutsconfig
<form-beans><form-bean name="DailysheetForm" type="com.myapp.struts.DailysheetForm"/>
</formbean>
<action input="/" path="/DailysheetList" name="DailysheetForm" scope="request" type="com.myapp.struts.DialysheetListAction">
<forward name="success" path="/DailysheetList.jsp"/>
</action>
2.表格
public class DailysheetForm extends ActionForm
{
// some getter and setter methods i used like receiptno
protected ArrayList arraylist;
public ArrayList getArraylist()
{
return arraylist;
}
public void setArraylist(ArrayList arraylist) {
this.arraylist = arraylist;
}
3.动作类
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ArrayList dailysheetdata;
DailysheetForm dailyform = (DailysheetForm) form;
Class.forName("com.mysql.jdbc.Driver");
Connection connect = DriverManager.getConnection("jdbc:mysql://localhost/Stonecrusher?"
+ "user=Stonecrusher&password=xxxxxx");
System.out.println("Connection"+connect);
dailysheetdata = StoneCrusherData.getDailysheetData(connect);
dailyform.setArraylist(dailysheetdata) ;
return mapping.findForward(SUCCESS);
}
JSP
<display:table id="data" name="requestScope.DailysheetForm.arraylist"requestURI="/DailysheetList" pagesize="10" >
<display:column property="receiptno" title="RECEIPTNO" sortable="true"/>
<display:column property="cutomername" title="CUSTOMER NAME" sortable="true"/>
</display:table>
<display:table id="data" name="requestScope.DailysheetForm.arraylist" requestURI="/DailysheetList" pagesize="10" >
<display:column property="receiptno" title="RECEIPTNO" sortable="true"/>
<display:column property="cutomername" title="CUSTOMER NAME" sortable="true"/>
</display:table>
它不起作用,基本上我正在将数据获取到 dailysheetdate,它是我的 Action 类中的数组列表,我想在带有分页的 jsp 中显示它。我知道我错了,请帮助我怎么做。