贴关键部分,提交部分!还有struts-config.xml中相对应的配置部分!
解决方案 »
- jsp中是怎么使用java包的单例的
- 急问题,求高人帮忙
- jstl C:foreach 的使用
- jsp中如何嵌入authorware课件
- Servlet里用JS弹出窗口,在新窗口里获得一表单的值,这些值还能提交给原来的IE窗口吗?
- 高手赐教,我在服务器上可以实现把一个文本文件的内容,逐行存到数据库中,数据库就在服务器上,所以容易实现,但是从客户端如何实现啊
- 我在文本框中输入了几段文字,然后存入数据库,可是当我取出来的时候却变成了一段,这如何解决呢?!请大虾指点!
- 有谁在学asp.net 近来聊聊吧
- jsp可以用什么方法直接获取记录的个数
- 用javamail发信出现如下错误::::::::
- JSP ,Asp ,JAva 有什么发展,有何好书,推荐一下
- 请教~~~这样的论坛该怎么设计?在线等,急~~~
strOptions="";
if ( !bInitialUpdate )
{
arrSelected=request.getParameterValues("subarea");
String arrCitycode=request.getParameter("citycode");
arrCitycode=arrCitycode.substring(0,arrCitycode.length()-1);
String[] arrCode = getToken(arrCitycode);
//把"100,101,102"转化为String数组
String arrCityname=request.getParameter("cityname");
arrCityname = new String(arrCityname.getBytes("ISO8859_1"),"gb2312");
arrCityname=arrCityname.substring(0,arrCityname.length()-1);
String[] arrName = getToken(arrCityname);
//把“北京,上海,天津”转化为数组
if(arrSelected!=null)
for(int i=0;i<arrCode.length;i++)
{
if (isInArr(arrCode[i],arrSelected))
strOptions = strOptions + "<option value=" + arrCode[i] + " Selected>" + arrName[i] + "</option>";
}
}
%> <tr align="left">
<td align=center>地区 </td>
<td colspan=2>
<script language="javascript">
function submitForm(v){
thematic.action="listPlaces.jsp";
thematic.target="iframe2008";
thematic.submit();
}
</script>
<table width="100%" border="0" align=left>
<tr>
<td height=100% width=40% nowrap>
<input type="hidden" name="hiddenP" value="">
<input type="hidden" name="hiddenC" value="">
<input type="hidden" name="hiddenD" value="">
<table border=0 height="100%">
<tr>
<td>
<input type="checkbox" name="checkCityTypeP" id="checkCityTypeP" value="p" onclick="submitForm(this.value);" checked>省市级<br>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="checkCityTypeC" id="checkCityTypeC" value="c" onclick="submitForm(this.value);">地市级<br>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="checkCityTypeD" id="checkCityTypeD" value="d" onclick="submitForm(this.value);">区县级<br>
</td>
</tr>
</table>
</td>
<td width=60%>
<iframe name="iframe2008" id="iframe2008" src="listPlaces.jsp" style="width:120" frameborder="no"></iframe>
</td>
</tr>
</table>
</td>
<td align="center">
<input type="button" name ="mych1" value="选择" onclick="choiseCity('0')"><br><br><br>
<input type="button" name = "mych2" value="不选" onclick="choiseCity('1')">
</td>
<td class="12">
<select style="width:120" size=11 name="subarea" id="subarea" multiple><%=strOptions%>
</select>
<input type=hidden size=15 name="citycode" value=<%=request.getParameter("citycode")%>>
<%
String cname=request.getParameter("cityname");
if (cname!=null)
cname = new String(cname.getBytes("ISO8859_1"),"gb2312");
%>
<input type=hidden size=15 name="cityname" value="<%=cname%>">
</td>
</tr>
<tr>
<td align="center" class="12"> </td>
<td colspan="4" class="12">
<input name="create" type="submit" class="bn" value="生成专题图" >
<input name="delete" type="button" value="清除专题图" class="bn" onclick='javascript:clearClass()'>
</td>
</tr>
listPlaces.jsp:读取外层页面的几个隐藏表项
从数据库中取数据
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="com.map.MapBean" %>
<html>
<head>
<title>list</title>
</head>
<script language="javascript">
function changeSelectet(who,obj){
var strSelectedValue = "";
for (i=0;i<obj.length;i++){
if (obj.options[i].selected){
strSelectedValue += obj.options[i].value + ',';
}
}
if (who == 'p'){
parent.thematic.hiddenP.value=strSelectedValue;
}
if (who == 'c'){
parent.thematic.hiddenC.value=strSelectedValue;
}
if (who == 'd'){
parent.thematic.hiddenD.value=strSelectedValue;
}
}
</script>
<body leftmargin=0 topmargin=0>
<%!
private String[] getToken(String str){
if (str == null){
return null;
}
java.util.StringTokenizer stk = new java.util.StringTokenizer(str,",");
java.util.Vector v = new java.util.Vector();
while(stk.hasMoreTokens()){
v.addElement(stk.nextToken());
}
String[] tokens = new String[v.size()];
for(int i=0;i<v.size();i++){
tokens[i] = (String)v.elementAt(i);
}
return tokens;
}
%>
<%
MapBean mb = new MapBean();String strCityType = "p";String selectedTypeP = request.getParameter("checkCityTypeP");//省级地区
String selectedTypeC = request.getParameter("checkCityTypeC");//市级
String selectedTypeD = request.getParameter("checkCityTypeD");//县级
/*
if (selectedTypeP == null || selectedTypeP.equals("") || selectedTypeP.equals("null")){
strCityType = "";
}
*/
if (!(selectedTypeC == null || selectedTypeC.equals("") || selectedTypeC.equals("null"))){
strCityType += "c";
}
if (!(selectedTypeD == null || selectedTypeD.equals("") || selectedTypeD.equals("null"))){
strCityType += "d";
}String strSelectedCityP = request.getParameter("hiddenP");
String[] arrSelectedCityP = getToken(strSelectedCityP);
String strSelectedCityC = request.getParameter("hiddenC");
String[] arrSelectedCityC = getToken(strSelectedCityC);
String strSelectedCityD = request.getParameter("hiddenD");
String[] arrSelectedCityD = getToken(strSelectedCityD);String[] arrAllSelectStr = mb.getSelect(strCityType,arrSelectedCityP,arrSelectedCityC,arrSelectedCityD);String strFinalSelectP = arrAllSelectStr[0];
String strFinalSelectC = arrAllSelectStr[1];
String strFinalSelectD = arrAllSelectStr[2];
%>
<table border=0 width=100% height=100% align=center>
<tr>
<td>
<select style="width:100" name="p" multiple size="2" onchange="changeSelectet('p',this);"><%= strFinalSelectP %></select>
</td>
</tr>
<tr>
<td>
<select style="width:100" name="c" multiple size="2" onchange="changeSelectet('c',this);"><%= strFinalSelectC %></select><br>
</td>
</tr>
<tr>
<td>
<select style="width:100" name="d" multiple size="2" onchange="changeSelectet('d',this);"><%= strFinalSelectD %></select><br>
</td>
</tr>
</table>
</body>
</html>
页面的form里面只要不对这个listplaces部分做操作
提交就没有问题
但是如果把listplaces部分都设置上,提交就不行了
提交的时候下面就显示蓝色的条很快就完了 但是没提交
请问怎么解决
多谢
应该没什么问题阿<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="com.map.MapBean" %>
<html>
<head>
<title>list</title>
</head>
<script language="javascript">
function changeSelectet(who,obj){
var strSelectedValue = "";
for (i=0;i<obj.length;i++){
if (obj.options[i].selected){
strSelectedValue += obj.options[i].value + ',';
}
}
if (who == 'p'){
parent.thematic.hiddenP.value=strSelectedValue;
}
if (who == 'c'){
parent.thematic.hiddenC.value=strSelectedValue;
}
if (who == 'd'){
parent.thematic.hiddenD.value=strSelectedValue;
}
}
</script>
<body leftmargin=0 topmargin=0>
<%!
private String[] getToken(String str){
if (str == null){
return null;
}
java.util.StringTokenizer stk = new java.util.StringTokenizer(str,",");
java.util.Vector v = new java.util.Vector();
while(stk.hasMoreTokens()){
v.addElement(stk.nextToken());
}
String[] tokens = new String[v.size()];
for(int i=0;i<v.size();i++){
tokens[i] = (String)v.elementAt(i);
}
return tokens;
}
%>
<%
MapBean mb = new MapBean();String strCityType = "p";String selectedTypeP = request.getParameter("checkCityTypeP");
String selectedTypeC = request.getParameter("checkCityTypeC");
String selectedTypeD = request.getParameter("checkCityTypeD");
/*
if (selectedTypeP == null || selectedTypeP.equals("") || selectedTypeP.equals("null")){
strCityType = "";
}
*/
if (!(selectedTypeC == null || selectedTypeC.equals("") || selectedTypeC.equals("null"))){
strCityType += "c";
}
if (!(selectedTypeD == null || selectedTypeD.equals("") || selectedTypeD.equals("null"))){
strCityType += "d";
}String strSelectedCityP = request.getParameter("hiddenP");
String[] arrSelectedCityP = getToken(strSelectedCityP);
String strSelectedCityC = request.getParameter("hiddenC");
String[] arrSelectedCityC = getToken(strSelectedCityC);
String strSelectedCityD = request.getParameter("hiddenD");
String[] arrSelectedCityD = getToken(strSelectedCityD);String[] arrAllSelectStr = mb.getSelect(strCityType,arrSelectedCityP,arrSelectedCityC,arrSelectedCityD);String strFinalSelectP = arrAllSelectStr[0];
String strFinalSelectC = arrAllSelectStr[1];
String strFinalSelectD = arrAllSelectStr[2];
%>
<table border=0 width=100% height=100% align=center>
<tr>
<td>
<select style="width:100" name="p" multiple size="2" onchange="changeSelectet('p',this);"><%= strFinalSelectP %></select>
</td>
</tr>
<tr>
<td>
<select style="width:100" name="c" multiple size="2" onchange="changeSelectet('c',this);"><%= strFinalSelectC %></select><br>
</td>
</tr>
<tr>
<td>
<select style="width:100" name="d" multiple size="2" onchange="changeSelectet('d',this);"><%= strFinalSelectD %></select><br>
</td>
</tr>
</table>
</body>
</html>
在submitForm中给action赋值了
成了listplaces.jsp
所以提交的时候是提交给哪个页了
应该在提交之后再恢复成原来的值
就ok了
呵呵