许久没有做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");