gpt4 book ai didi

java - 使用 struts2/tiles/remote data 的 Accordion 菜单

转载 作者:行者123 更新时间:2023-12-01 04:53:22 24 4
gpt4 key购买 nike

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

菜单.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,所以希望你们理解和帮助。

问候

尤瓦

最佳答案

将您的操作配置更改为:

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

关于java - 使用 struts2/tiles/remote data 的 Accordion 菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14583460/

24 4 0