Action里:request.setAttribute("list",list);JSP里:
<select name="example">
<logic:iterate id="list" name="list">
<option value='<bean:write name="list" property="id"/><bean:write name="list" property="value"/></option>
</logic:iterate>
</select>
<select name="example">
<logic:iterate id="list" name="list">
<option value='<bean:write name="list" property="id"/><bean:write name="list" property="value"/></option>
</logic:iterate>
</select>
解决方案 »
- jsp与XML交互问题???
- ResultSet.nest()问题
- 求助啊。各位大侠,高手,牛人,帮我看看到底是什么问题啊。我都快要崩溃咯
- struts和hibernate简单问题
- eclipse j2ee+tomcat7.0怎么配置jndi
- struts初学,试着编了一个最简单的代码(hello world)但无法显示,请struts高手不吝赐教(如果写得不对请指出谢谢)
- 关于RPC(远程过程调用) 减少延迟的问题!
- 请问各位现在你们在项目中ejb的访问模式是如何的??(讨论)
- spring ehcache手动或定时刷新缓存,如何实现?
- 求 j2ee 的java.lang.NullPointerException问题快要发疯了
- 请问我的Tomcat怎么装不上,
- 关于resin中struts的问题(有源代码可以下载)
运行效果演示:http://www.raibledesigns.com/struts-menu/下载后,struts-menu.war中包括了上述运行效果的所有源程序,COPY到服务器相应目录下就可用,好好分析一下就明白如何实现了。做法很简单:
To build this project, perform the following steps:1. Download and install Maven (http://maven.apache.org).
2. Create a MAVEN_HOME environment variable that points to where
you installed Maven. Then add $MAVEN_HOME/bin to your PATH.
3. Navigate to the directory you've expanded the source to and
execute "maven jar" to create target/struts-menu-2.0.jar.To deploy the struts-menu example application, do the following:1. Download and install Tomcat (http://jakarta.apache.org/tomcat).
2. Create a CATALINA_HOME environment variable that points to
where you installed Tomcat.
3. Execute "maven deploy" to deploy the app to Tomcat.
4. Open http://localhost:8080/struts-menu in your favorite browser.To integrate struts-menu into your webapp, do the following:1. Place struts-menu-2.0.jar into your app's WEB-INF/lib directory.
2. Add the plug-in settings to your struts-config.xml file.
<plug-in className="net.sf.navigator.menu.MenuPlugIn">
<set-property property="menuConfig"
value="/WEB-INF/menu-config.xml"/>
</plug-in>
3. Create a menu-config.xml file in your app's WEB-INF directory.
Look in web/WEB-INF for the sample app's menu-config file
and trim it down to fit your needs. For a complete list of
possible attributes, see the MenuBase class's javadocs at
http://tinyurl.com/x5zt.
4. Add a taglib declaration to the top of your JSP:
<%@ taglib uri="http://struts-menu.sf.net/tag" prefix="menu" %>
5. Add code to render your menu in your JSP:
<menu:useMenuDisplayer name="TabbedMenu"
bundle="org.apache.struts.action.MESSAGE">
<menu:displayMenu name="Home"/>
<menu:displayMenu name="About"/>
</menu:useMenuDisplayer>
《Struts下拉框的实现 》[扩展部分]另外,可通过做一个自定义标签加载数据。
谢谢你!!
Action里:request.setAttribute("list",list);JSP里:
<select name="example">
<logic:iterate id="list" name="list">
<option value='<bean:write name="list" property="id"/><bean:write name="list" property="value"/></option>
</logic:iterate>
</select>我的现在做法和你的差不多,就是每次都要查询数据库,很慢,怎么可以提高速度,比如用缓存?不会~~
还有是不是应该用session.setAttribute,要不然如果从其他地方转到这个页面的话,下拉框里恐怕没东东了吧
你的菜单框是一个全局公用的还是每个用户自己的?
我是菜菜,请指教!
如果确定用户经常会访问,可以做一个cache,来缓存数据,以后
就不从数据库取得,不过注意同步问题...
是属于同一个request的...
在这些Action里无论哪个request.setAttribute在到达的那个
jsp都能拿到
....