1

有人可以发布一个示例代码,请使用 struts2/tiles 显示手风琴菜单。我正在努力按照带有注释的展示示例来获取手风琴列表...谢谢

菜单.jsp

<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<link href="<s:url value="/pages/stylesheets/skins/blue.css"/>" rel="stylesheet" type="text/css" />
  <head>
    <sj:head jqueryui="true"/>
  </head>
  <body>
    <s:url id="urlecho" action="echo"/>
    <sj:accordion 
        list="accordion" 
        paramKeys="echo" 
        paramValues="content" 
        href="%{urlecho}" 
        active="false" 
        autoHeight="false" 
        clearStyle="true" 
        listKey="title" 
        listValue="content"/>  
</body>

struts.xml

<action name="echo" class="com.accel.prjmgt.action.MenuAction">
    <result name="success" type="json">/pages/Menu.jsp</result>
</action>

MenuAction.java

public class MenuAction extends ActionSupport
{
    private List<AccordionDO> accordion;

    public String execute() throws Exception 
    {
        accordion = new LinkedList<AccordionDO>();
        accordion.add(new AccordionDO("My Title 1", "Content One"));
        accordion.add(new AccordionDO("My Title 2", "Content Two"));
        accordion.add(new AccordionDO("My Title 3", "Content Three"));
        accordion.add(new AccordionDO("My Title 4", "Content Four"));
        accordion.add(new AccordionDO("My Title 5", "Content Five"));

        return SUCCESS;
    }

    public List<AccordionDO> getAccordion() {
        return accordion;
    }
}

提前致谢。也许我在问一个愚蠢的问题,但我是一个试图学习 S2 / tile / JQuery 的初学者,所以希望你们理解和帮助。

问候

尤瓦

4

1 回答 1

0

将您的操作配置更改为:

<action name="echo" class="com.accel.prjmgt.action.MenuAction">
    <result name="success" type="json"></result>
</action>
于 2013-01-29T15:34:39.740 回答