易截截图软件、单文件、免安装、纯绿色、仅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 ......

Html/Jsp常用的页面跳转方法

第一种:
<script language="javascript" type="text/javascript">
    window.location.href="login.jsp?backurl="+window.location.href;
</script>
第二种:
<script language="javascript">
    alert("返回");
    window.history.back ......

servlet、jsp中获得项目绝对路径

servlet中获得项目绝对路径
String filePath=this.getServletConfig().getServletContext().getRealPath("/");
根目录所对应的绝对路径:request.getServletPath();
文件的绝对路径 :request.getSession().getServletContext().getRealPath(request.getRequestURI())
当前web应用的绝对路径 :servletConfig.getServletCo ......

从jdk安装到jsp连接oracle数据库的相关配置

1.安装jdk(版本6u7);
  2.配置jdk环境变量(安装目录:D:\tools\java\jdk1.6.0_07):
  1). JAVA_HOME = D:\tools\java\jdk1.6.0_07;
  2). Path的最前面追加"D:\tools\java\jdk1.6.0_07\bin;D:\tools\java\jre1.6.0_07\bin";
  3). CLASSPATH = D:\tools\java\jdk1.6.0_07\lib;D:\tools\java\jdk1.6.0_07\lib\too ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号