CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  ASP

带空格的参数接收问题

楼主shhu_lin(hupo)2005-09-21 11:49:42 在 Web 开发 / ASP 提问

页面1:<a   href="e-cp1.asp?csort=RUBBER   AND   RUBBER   PRODUCTS">RUBBER   AND   RUBBER   PRODUCTS</a>  
  页面2:   e-cp1.asp   接收到的参数csort内容为   RUBBER   AND   RUBBER   PRODUCTS  
   
    但在分页的时候(参数两个page   ,csort)   比如说第二页的时候csort   的值就变成     RUBBER  
  空格之后的内容就被截断了    
  这个问题怎么解决  
  问题点数:50、回复次数:8Top

1 楼asp_m(写个三层模式)回复于 2005-09-21 12:00:14 得分 1

关注一下:)Top

2 楼tigerwen01(小虎)回复于 2005-09-21 12:02:14 得分 40

使用Server.URLEncode(VariableName)来保证传递过去  
  变量的是按照   URL格式编码的Top

3 楼terry_yip(我只回答引起我思考的问题)回复于 2005-09-21 12:58:03 得分 2

你传过去时,把用replace函数把空格用下划线来代替,然后传到下一个页面时,先得到这个带下划线的参数,再用replace函数,把下划线替换成空格,  
   
  关于replace函数的用法,参见:  
  http://www.54uc.com/asppost13/web248603.htm  
   
  Top

4 楼shhu_lin(hupo)回复于 2005-09-21 13:34:18 得分 0

看看这样使用对不对  
   
  csort=Server.URLEncode(Request.querystring("csort"))  
   
  就不能查到具体的产品了Top

5 楼ivee(ivee)回复于 2005-09-21 13:39:20 得分 5

链接要写成:<a   href="e-cp1.asp?csort=<%=Server.UrlEncode("RUBBER   AND   RUBBER   PRODUCTS")%>">RUBBER   AND   RUBBER   PRODUCTS</a>Top

6 楼shhu_lin(hupo)回复于 2005-09-21 13:39:42 得分 0

在第二个页面能收到   RUBBER   AND   RUBBER   PRODUCTS  
  但在   使用分页的时候就会出现   只有RUBBER后面的就没有了  
  Top

7 楼cnguai(怪虎)回复于 2005-09-21 13:48:03 得分 2

把空格改成%20Top

8 楼shhu_lin(hupo)回复于 2005-09-21 14:02:26 得分 0

从页面1   接收到的   参数csort   值是RUBBER   AND   RUBBER   PRODUCTS    
   
  在页面2   分页的时候   csort的值   就只有RUBBER   了  
   
          <%  
  Const   MaxPerPage=14  
        dim   totalPut        
        dim   CurrentPage  
        dim   TotalPages  
        dim   j  
        dim   sql  
          if   Not   isempty(request.QueryString("page"))   then  
              currentPage=Cint(request.QueryString("page"))  
        else  
              currentPage=1  
        end   if    
   
  dim   csort  
   
  csort=Request.QueryString("csort")  
   
  Response.Write   csort  
   
  set   rs=Server.CreateObject("ADODB.Recordset")  
  sqlss="select       *       from       [cp]     where     ep_sort   like   '%"&csort&"%'"  
  rs.open   sqlss,ccon,1,1  
   
        if   err.number<>0   then  
  response.write("<script>alert('Sorry   ,The   Product   not   found!');window.open('e-cp.htm','_self');</script>")  
  end   if  
   
      if   rs.eof   And   rs.bof   then  
  response.write("<script>alert('Sorry   ,The   Product   not   found!');window.open('e-cp.htm','_self');</script>")  
        else  
      totalPut=rs.recordcount  
   
              if   currentpage<1   then  
                      currentpage=1  
              end   if  
   
              if   (currentpage-1)*MaxPerPage>totalput   then  
        if   (totalPut   mod   MaxPerPage)=0   then  
            currentpage=   totalPut   \   MaxPerPage  
        else  
              currentpage=   totalPut   \   MaxPerPage   +   1  
        end   if  
              end   if  
   
                if   currentPage=1   then  
                          showContent  
                          showpage   totalput,MaxPerPage,"e-cp1.asp"  
                else  
                        if   (currentPage-1)*MaxPerPage<totalPut   then  
                          rs.move     (currentPage-1)*MaxPerPage  
                          dim   bookmark  
                          bookmark=rs.bookmark  
                          showContent  
                            showpage   totalput,MaxPerPage,"e-cp1.asp"  
                  else  
                  currentPage=1  
                        showContent  
                        showpage   totalput,MaxPerPage,"e-cp1.asp"  
              end   if  
        end   if  
        end   if  
   
        sub   showContent  
                dim   i  
        i=0  
  %>          
  <table   width="100%"     border="0"   align="center"   cellpadding="0"   cellspacing="1"   bgcolor="#88C4FF">  
    <tr   bgcolor="#C8D2F0"   class="p10">  
                            <td   width="23%"   height="30"><div   align="center"   class="style1">Name</div></td>  
                            <td   width="29%"   height="30"><div   align="center"   class="style1">Specification</div></td>  
                            <td   width="23%"   height="30"><div   align="center"   class="style1">Packing</div></td>  
                            <td   width="12%"   height="30"><div   align="center"   class="style1">Habitat</div></td>  
                            <td   width="13%"   height="30"><div   align="center"   class="style1">Specify</div></td>  
                      </tr>  
  <%  
  do   while   not   rs.eof  
  %>  
                      <tr   class="p10">  
                              <td   height="25"   bgcolor="#F0F3FB"><div   align="center"><a   onclick="return   callpage(this.href)"   href="e-cp01.asp?id=<%=rs("id")%>">   <%=left(rs("ep_name"),8)%></a></div></td>  
                              <td   height="25"   bgcolor="#F0F3FB"><div   align="center">   <%=left(rs("ep_maioshu"),20)%></div></td>  
                              <td   height="25"   bgcolor="#F0F3FB"><div   align="center">   <%=rs("p_baozhuang")%></div></td>  
                              <td   height="25"   bgcolor="#F0F3FB"><div   align="center">   <%=rs("ep_chandi")%></div></td>  
                              <td   height="25"   bgcolor="#F0F3FB"><div   align="center"><A   onclick="return   callpage(this.href)"   href="e-cp01.asp?id=<%=rs("id")%>">Specify</a></div></td>  
                      </tr>  
  <%  
    i=i+1  
  if   i>=MaxPerPage   then   Exit   Do  
  rs.movenext  
          loop  
          rs.close  
          set   rs=nothing  
  %>  
                  </table>  
  <%  
  End   Sub        
       
  Function   showpage(totalnumber,maxperpage,filename)      
      Dim   n  
       
  If   totalnumber   Mod   maxperpage=0   Then      
  n=   totalnumber   \   maxperpage      
  Else  
  n=   totalnumber   \   maxperpage+1      
  End   If  
   
  Response.Write   "<form   method=Post   action="&filename&">"      
  Response.Write   "<p   align='center'   class='contents'>   "      
  If   CurrentPage<2   Then      
  Response.Write   "<font   class='contents'>Home   Previous</font>   "      
  Else      
  Response.Write   "<a   href="&filename&"?page=1&csort="&csort&">Home</a>   "      
  Response.Write   "<a   href="&filename&"?page="&CurrentPage-1&"&csort="&csort&">Previous</a>   "      
  End   If  
   
  If   n-currentpage<1   Then      
  Response.Write   "<font   class='contents'>Next   Tail</font>"      
  Else      
  Response.Write   "<a   href="&filename&"?page="&(CurrentPage+1)&"&csort="&csort&">"      
  Response.Write   "Next</a>   <a   href="&filename&"?page="&n&"&csort="&csort&">Tail</a>"      
  End   If      
  Response.Write   "<font   class='contents'>   Order:</font><font   class='contents'>"&CurrentPage&"</font><font   class='contents'>/"&n&"Page</font>   "      
  Response.Write   "<font   class='contents'>   Total"&totalnumber&"Product   "    
  Response.Write   "<font   class='contents'>Jump:</font><input   type='text'   name='page'   size=2   maxlength=10   class=smallInput   value="&currentpage&">Page"      
  Response.Write   "&nbsp;<input   type='submit'     class='contents'   value='Jump'   name='cndok'   ></form>"      
  End   Function      
  %>    
  Top

相关问题

  • 如何传送带空格的参数
  • 过滤器怎么接收带参数的url
  • 参数接收的问题??????????
  • CreateProcess() lpCmdLine参数中有带空格的长文件名
  • asp.net中像[test.aspx?param=中国],这样的带参数的页面为什么无法接收中文参数值
  • 如何使scanf接收空格字符?
  • 标签不能接收参数!!!激呀!!
  • 如何让接收运行参数
  • 关于静态页面接收参数
  • 触发器可以接收参数和传递参数吗

关键词

得分解答快速导航

  • 帖主:shhu_lin
  • asp_m
  • tigerwen01
  • terry_yip
  • ivee
  • cnguai

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo