2月2日总结验证码,中文问题,jar命令,web组件的三种关联关系

===========网页产生四位的验证码:========================= 整数: <% r=new Random(); num=Math.abs(r.nextInt()%10000); String verifyNum=new Integer(num).toString(); %> double型 <% r=new Random(); num=r.nextDouble()*10000; String verifyNum=new Double(num).toString(); %> ==========jsp中文问题:============================================ where:页面显示|数据库读写|从上个页面的form中得到的中文参数|包含文件中的中文问题 解决方法: 1、在jsp页面的顶部加上<%@ page contentType="text/html;charset=GB2312"%> 2、strTemp=new String(strTemp.getBytes("ISO-8859-1"),"GB2312"); 或strTemp=new String(strTemp.getBytes("UTF-8"),"GB2312"); <%@ include file="../inc/security.jsp" encoding="GB2312"%> 当向数据库中插入时,先将Unicode->native code 当jdbc driver从数据库中查询时,将native code->Unicode ========jar的使用================================================ jar cvf test.jar test.class test.gif ==========建档应用程序javadoc的使用================================ 例子 第一步:(testHello.java保存在H:/java学习/2.2.javadoc) /**这是一个用说明的java应用程序*/ pulic class testHello{ /**主函数,输出一句话 */ public static void main(String args[]){ System.out.println("hello,恭喜你了!"); }//main() }/**testHello*/ 第二步:cmd->H:/java学习/2.2.javadoc->javadoc testHello.java-> 回车. 此时,在H:/java学习/2.2.javadoc下面有10个.html文件,一个文件夹resources,一个stylesheet.css ========web组件的三种关联关系================================== 1请求转发,共享request范围中的数据 servlet类使用javax.servlet.RequestDispatcher.forword()方法 RequestDispatcher rd=request.getRequestDispatcher("hello.jsp"); rd.forword(request,response); jsp中用 2重定向,不共享request范围中的数据 response.sendRedirect("http://"); 3包含 RequestDispatcher rd=request.getRequestDispatcher("hello.jsp"); rd.include(request,response); jsp中使用 <%@include file="heder.jsp"%>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值