Web项目中出现的几个问题

许久没有做web了,就着课设的书看了好久才做了一点点,复习旧知识,记录一下特别蠢的问题。书是南京大学出版社的《web系统与技术实验指导书》,通俗易懂适合入门。

1、select下拉框传值失败

    id和name都定义了导致无法传值,删除了id,只留下name的定义,成功传值。

 2、数据库连接失败

   SQL Server过期不能用了了,重新装了一下,后来发现登录验证的时候报端口错误(The TCP/IP connection to the host localhost, port 1433 has failed),查了一下,发现没有设置端口,设置一下就好,主要参考:https://blog.csdn.net/qq_39241986/article/details/80848855

3、报错:将截断字符串或二进制数据

向数据库传值的时候报错,网上查询都是说数据库设计不合理,我考虑了一下应该是数据库各个数据类型和传值不匹配,仔细检查发现数据库的设计没有问题,取值也没有问题,仔细排查发现是单选按钮的两个value我写的是“boy”“girl”,但是数据库设计的时候考虑到得是“男”和“女”,所以只设了char(2),报了错,改成男与女就成功了。

4、framset中的一些问题

(1)frameset框架滚动条的处理

无滚动条:

  <frame name="header" src="acsx/FooterIn.aspx" noResize scrolling="no">

(2)让Frameset居中,并且固定宽度的巧妙办法

来自:https://blog.csdn.net/lzwglory/article/details/18698277

原来的代码:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>web title</title>
<head>
</head>
<frameset rows="130,*,40" frameborder="no" border="0" framespacing="0">
   <frame src="http://zg672313.blog.163.com/blog/top.html" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" />
   <frame src="http://zg672313.blog.163.com/blog/center.html" name="mainFrame" id="mainFrame" />
   <frame src="http://zg672313.blog.163.com/blog/bottom.html" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" />
</frameset>
<noframes>
<body></body>
    </noframes>
</html>

====================================================================

改过的代码

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>视频会议后台管理_深圳视高科技有限公司</title>
<head>
</head>
<frameset cols="*,1024,*" frameborder="no" border="0" framespacing="0">
<frame src="about:blank"></frame>
<frameset rows="130,*,40" frameborder="no" border="0" framespacing="0">
   <frame src="http://zg672313.blog.163.com/blog/top.html" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" />
   <frame src="http://zg672313.blog.163.com/blog/center.html" name="mainFrame" id="mainFrame" />
   <frame src="http://zg672313.blog.163.com/blog/bottom.html" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" />
</frameset>
<frame src="about:blank"></frame>
</frameset>
<noframes>
<body></body>
    </noframes>
</html>

=================================================================

其实就再套了一个框架,多了紫色部分的代码而已;这样就可以使得框架居中了

(3)怎么让frameset出现整体滚动条

来自:https://jingyan.baidu.com/article/86112f135dbd4d273797870e.html

增加一个新页面:

<body style="margin:0px;height:1600px;width:auto;">
   <iframe src="admin.jsp" style="height:100%;width:100%;border-width:0px;"></iframe>
</body>

5、JSP按钮跳转

 <input type="button" value="我要提问"  οnclick="window.location='ask.jsp'" >

6.li传值+问号乱码的修改

<script type="text/javascript">
 function openScript(url,name){
     var Win=window.open(url,name);
 }
</script>

传值:<li><a href="#" name="title" οnclick="openScript('wenda_p.jsp?title=<%=rs.getString("title")%>', 'identlist')">问:<%=rs.getString("title") %></a></li>

获值:String title=new String(request.getParameter("title").getBytes("ISO-8859-1"),"UTF-8");

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值