易截截图软件、单文件、免安装、纯绿色、仅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乱码初级解决方案

最基本的乱码问题
这个乱码问题是最简单的乱码问题。一般新会出现。就是页面编码不一致导致的乱码。
Html代码:
<%@ page language="java" pageEncoding="UTF-8"%> 
<%@ page contentType="text/html;charset=iso8859-1"%> 
<html> 
<head> 
<title ......

在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乱码问题的解决办法

一,纯粹的jsp页面中文乱码
   原因:对jsp代码的编写,默认的字符集事“ISO-8859-1”,如果代码中存在中文,则会出现乱码!
   解决办法:在page中加上contentType="text/html;charset=gb2312",采用国标来翻译页面中的代码!
二,post方式提交表单出现乱码
   原因: ......

JSP自定义标签(Tag)

实现JSP自定义标签的一种方法:
1.写一个类继承TagSupport或其他Tag的实现类。
public class AllTag extends TagSupport {

@Override
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
try {
out.append("Hello World.");
} catch (IOException e) {
e.pri ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号