使用struts2 / tiles / remote数据的手风琴菜单

时间:2013-01-29 12:57:05

标签: java struts2 tiles

有人可以请使用struts2 / tiles发布显示acordion菜单的示例代码。我正在努力通过跟随展示示例获得手风琴列表,该示例具有注释...谢谢

引入了menu.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 / tiles / JQuery,所以希望你们理解和帮助。

此致

YUVA

1 个答案:

答案 0 :(得分:0)

将您的操作配置更改为:

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