Java
[code=Java]
public static Category getItem(int categoryId) {
// System.out.println("pid " + pid);
Category category = null;
if (categoryId != 0)
category = categoryManager.findCategory(categoryId);
return category;
}
[/code]
tld
[code=XML]
<function>
<name>left</name>
<function-class>com.flexoa.web.taglib.functions.MyTaglib</function-class>
<function-signature>com.flexoa.web.model.Category getItem(int)</function-signature>
<example>${my:left(categoryId) }</example>
</function>
[/code]
引用
[code=HTML]
${my:left(categoryId).name}
[/code]
本文介绍了一个Java方法,用于根据给定的类别ID来获取相应的Category对象。此外,还展示了如何在XML配置文件中定义该方法,并在HTML中调用它以显示Category的名称。
1031

被折叠的 条评论
为什么被折叠?



