将asp代码转换为java/jsp(可带js)
<!--#include file="conn.asp" -->
<link href="/css/index.css" rel="stylesheet" type="text/css">
<script language="javascript" src="/script/function.js"></script>
<%
n = request.QueryString("n")
if n = "" then
n = 0
end if
l = request.QueryString("l")
if l = "" then
l = 1
end if
guize = request.QueryString("guize")
if guize = "请生成整个站点999" then
g2 = " where id > " & n
else
g2 = " where id > " & n & " and " & guize & " "
end if
if guize = "" or guize = "请生成整个站点" then
%>
<form action="?" method="get">
<input name="guize" type="text" value="请生成整个站点" size="100" maxlength="700">
<input name="提交" type="submit" value="开始生成">
</form>
<p>刷新1级栏目:c1=* (*代表1级栏目数字id号)</p>
<p>刷新2级栏目:c2=* (*代表2级栏目数字id号)</p>
<p>刷新3级栏目:c3=* (*代表3级栏目数字id号)</p>
<p>刷新4级栏目:c4=* (*代表4级栏目数字id号)</p>
<p>刷新5级栏目:c5=* (*代表5级栏目数字id号)</p>
<p>刷新某一区间信息: id>=n1 and id<=n2 (n1代表开始信息id号,n2代表结束id号)</p>
<p>刷新某一id号后的信息: id>=n1 (n1代表开始信息id号)</p>
<p>刷新某一id号前的信息: id<=n1 (n1代表结束信息id号)</p>
<p>刷新失败信息: id in(select id from news_false)</p>
<p>
<%
conn.close()
set conn = nothing
response.end()
else
ac = request("ac")
if ac = "" then
ac = conn.execute("select count(id) from news_content " & g2)(0)
end if
end if
n = clng(n)
set rs = server.CreateObject("adodb.recordset")
sqlstr = "select top 1 id,title,filepath from news_content " & g2 & " order by id asc"
rs.open sqlstr,conn,1,1
response.write "共" & ac & "信息 当前" & n & "<br>"
if rs.eof then
rs.close()
set rs = nothing
conn.close()
set conn = nothing
response.write "更新完成"
response.end()
end if
title = rs("title")
id = rs.fields("id")
title = "<a target=_blank href=http://" & hostheader & rs("filepath") & ">" & rs("title") & "</a>"
rs.close()
set rs = nothing
conn.close()
set conn = nothing
%>
<script language="javascript">
<!--
var id = <%= id %>;
var filepath = '/news/make.asp?id=' + id + '&' + Math.random();
sxzt = gethttppage(filepath);
sxzt = sxzt.replace(/\/html\/.*?(shtml|asp|html)/ig,0);
if(sxzt==0){
document.write('当前第<% = l %> 条<br>');
document.write('<%= title %> 生成成功');
}
else{
alert(sxzt);
alert('<%= title %> 失败,' + sxzt);
}
function clock()
{
i=i-1
if(i>0)setTimeout("clock();",300);
else location.replace('?ac=<%= ac %>&l=<%= l + 1 %>&n=<%= id %>&guize=<%= guize %>');
}
var i=2;
clock();
//-->
</script>
</p>
追问:实现是肯定能的,因为以前的已经有人都改过来了,剩下两个页面了就!
我是说不能自动转换
如果你能理清逻辑,用java重写vbscript的代码,当然是可以的,就是很麻烦罢了
我都改了一半了,重新更乱了!
那就没办法了。像楼上说的。两种完全不同的语言。你怎么去转换?都是重写的。