易截截图软件、单文件、免安装、纯绿色、仅160KB

SSH 项目中,action获取jsp页面传过来的select值

项目框架S2SH,jsp页面如下,select列表设为multiple。为了能在action里取到前台界面select列表的多选值,瞎搞了两天,今天终于成功。其实后台action取前台jsp页面的值很简单,废话不多说,先贴代码:
<body>
<form action="sendMsg.action?senderId=${users.id }&username=${users.username}" method="post"
id="form" name="form" onsubmit="getIdValue()">
<input type="hidden" value="" name="" id="ids" />
<table width="500" height="220" border="1" align="center">
<tr>
<td colspan="2">
【欢迎使用】
</td>
</tr>
<tr>
<td width="88">
标题:
</td>
<td width="396">
<input type="text" name="title" id="title" />
</td>
</tr>
<tr>
<td>
内容:
</td>
<td>
<textarea name="content" id="content" cols="45" rows="5">




接收者:





${t}








 
action代码:
...
//定义一个与jsp页面相同的变量
private String userId; //setter getter方法略
...
public String sendMsg() throws Exception{
String username = ServletActionContext.getRequest().getParameter("username"); //获取用户名
String t[] = ServletActionContext.getRequest().getParameterValues("userId"); //这里获取时,变量名就直接写jsp页面的就行。
System.out.println(t[0]); //测试输出成功
System.out.println(t[1]);


相关文档:

在JSP中配置FCKeditor 2.6.4

1.FCKeditor 介绍
FCKeditor 这个开源的HTML 文本编辑器可以让web 程序拥有如MS Word 这样强大的编辑功能,.FCKeditor 支持当前流行的浏览器。
2.准备工作:
环境:winddows XP、tomcat6.0、JDK1.6
下载:
1):FCKeditor_2.6.4.zip
地址:http://nchc.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.6.4.zip ......

JSP中直接调用Spring接管的JAVABEAN

<%
    ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
    List stafflist = ((StaffDAO)ctx.getBean("StaffDAO")).findAll();
    request.setAttribute("stafflist",stafflist);
%> ......

目前最好的JSP分页技术

前言
在使用数据库的过程中,不可避免的需要使用到分页的功能,可是JDBC的规范对此却没有很好的解决。对于这个需求很多朋友都有自己的解决方案,比如使用Vector等集合类先保存取出的数据再分页。但这种方法的可用性很差,与JDBC本身的接口完全不同,对不同类型的字段的支持也不好。这里提供了一种与JDBC兼容性非常好的方案 ......

JSP中自定义标签属性配置说明


required 是是否为必选属性
rtexprvalue的全称是 Run-time Expression Value, 它用于表示是否可以使用JSP表达式.
当在<attribute>标签里指定<rtexprvalue>true</rtexprvalue>时, 表示该自定义标签的某属性的值可以直接指定或者通过动态计算指定, example as follow:
<sql:query var="result" & ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号