wap页面,源码文件处理方案解析
来源:互联网 发布:弹幕点歌什么软件 编辑:程序博客网 时间:2024/06/04 17:49
现在wap越来越流行。
您肯定希望自己wap网页不被他们窃取文本内容。
这里提供一种简单方便的方法,实现这一功能。当然,只是让取用的人稍费先手脚。
下面贴出源码。
我在自己接的一个项目中使用了这样的方式实现源码不能查看功能,为大伙提供参考。
index.jsp
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@page import="com.bogao.wap.utilclass.mf"%>
<%String path = request.getContextPath();%>
<head>
<title><%=mf.s2u("登入界面") %></title>
<meta http-equiv="Cache-Control" content="max-age=0" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Cache-Control" content="must-revalidate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" rev="stylesheet" href="http://localhost:8080/bg/typecss/wapbody.css" type="text/css"/>
</head>
<body>
<p class="pp"><%=mf.s2u("环境自动在线监测发布系统登入页面") %></p>
<form class="form_css" action="login.action" method="get">
<table cellpadding="0" cellspacing="0" style="padding: 0px; text-align: left">
<tr>
<td class="td_narrow"><%=mf.s2u("用户:") %></td>
<td><input type="text" name="username" value="user" /></td>
</tr>
<tr>
<td class="td_narrow"><%=mf.s2u("密码:") %></td>
<td><input type="password" name="password" value="password" /></td>
</tr>
<tr>
<td colspan="2" align="center">
<input class="button" type="submit" name="submit" value="<%=mf.s2u("登入") %>"/>
<input class="button" type="reset" name="" value="<%=mf.s2u("重置") %>"/>
</td>
</tr>
</table>
</form>
</body>
</html>
在页面显示内容的时候,看到了使用了mf.u2s()这个一个函数。
下面把mf源码贴出:
package com.bogao.wap.utilclass;
import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
/*
* 页面编码类
*/
public class mf {
/*
* 字符串转化函数,将字符串转化成16进制,进行显示。
*/
public static String s2u(String text)
{
String result = "";
int input;
StringReader isr;
try {
isr = new StringReader(new String(text.getBytes("iso-8859-1"), "utf-8"));
}
catch (UnsupportedEncodingException e) {
return text;
}
try {
while ( (input = isr.read()) != -1) {
result = result + "&#x" + Integer.toHexString(input) + ";";
}
}
catch (IOException e) {
return text;
}
isr.close();
return result;
}
}
处理的时候在每个16进制显示字符前加上了&#x。这个是浏览器识别显示内容必须的。
而出来的效果如下图:
- wap页面,源码文件处理方案解析
- wap页面中手机号码处理总结
- WAP解析
- WAP跳转页面了,游戏怎么处理求救
- opengl处理obj模型 源码 以及文件解析
- WAP网络服务方案
- wap文件-键盘输入时间和页面内部事件
- 页面的解析-文件
- java处理大文件方案
- 页面管理异常及处理方案
- 硬盘缓存方案DiskLruCache源码解析
- 滴滴插件化方案 VirtualApk 源码解析
- Mybatis JPA-集成方案+源码解析
- php生成WAP页面
- php生成WAP页面
- wap页面下载
- wap页面跳转
- java文件处理源码
- 无奈。。。
- DB2和 Oracle的并发控制(锁)比较
- 《Windows核心编程》の窗口闪烁函数FlashWindow和FlashWindowEx
- vc学习笔记
- FFTWater Revisited
- wap页面,源码文件处理方案解析
- 无论你是男人,还是女人,做人,想成功,下面就是你必须要做到的
- Maven学习总结
- pku2115C Loooooops
- Abap点滴记录
- 水题也可以由不同的水法~!@#$%PKU OJ1013
- 数据同步算法研究
- 是对 是错 向左 向右
- 关于Eclipse的杂货