setup.jsp
来自「这是论坛原代码,希望大家能好好看看,说明需要的太多了吧」· JSP 代码 · 共 258 行
JSP
258 行
<%@ page contentType="text/html;charset=utf-8" %>
<%@ page import="java.io.*,
cn.js.fan.db.*,
cn.js.fan.util.*,
cn.js.fan.web.*,
com.redmoon.forum.*,
org.jdom.*,
java.util.*"
%>
<%
/**
* $RCSfile: setup.jsp,v $
* $Revision: 1.1.1.1 $
* $Date: 2002/09/09 13:50:21 $
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
*/
%>
<%@ page import="java.io.*,
java.util.*,
java.lang.reflect.*"
%>
<%
XMLConfig cfg = new XMLConfig("config_cws.xml", false, "gb2312");
%>
<title>云网社区安装</title>
<link rel="stylesheet" type="text/css" href="../common.css">
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td width="1%" valign="top"></td>
<td width="99%" valign="top">
<b>欢迎您使用云网社区 版本<%=cfg.get("Application.version")%></b>
<hr size="0">
<font size="-1">
在安装继续进行前,你的服务器环境必须通过以下所有检查: </font>
<ul>
<table border="0">
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
<td>
<font size="-1">
安装工具检测到你正运行在
<%= application.getServerInfo() %> </font> </td>
</tr>
<% // JDK check. See if they have Java2 or later installed by trying to
// load java.util.HashMap.
boolean isJDK1_2 = true;
try {
Class.forName("java.util.HashMap");
}
catch (ClassNotFoundException cnfe) {
isJDK1_2 = false;
}
if (isJDK1_2) {
%>
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
<td>
<font size="-1">
你的JDK版本为1.2或者更新。 </font> </td>
</tr>
<% }
else {
%>
<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td>
<td>
<font size="-1">
你的JDK版本好像低于JDK 1.2。因此安装不能继续。如果可能,请更新JDK版本并重新开始这个过程。 </font> </td>
</tr>
<% }
// Servlet version check. The appserver must support at least support
// the Servlet API 2.2.
boolean servlet2_2 = true;
try {
Class sessionClass = session.getClass();
Class[] setAttributeParams = new Class[1];
setAttributeParams[0] = Class.forName("java.lang.String");
Method getAttributeMethod = sessionClass.getMethod("getAttribute", setAttributeParams);
}
catch (SecurityException se) {
// some class loaders might not let us do the reflection above, so use
// the old method of finding the appserver version:
servlet2_2 = application.getMajorVersion() >= 2
&& application.getMinorVersion() >= 2;
}
catch (Exception e) {
// ClassNotFoundException & MethodNotFoundException end up here.
servlet2_2 = false;
}
if (servlet2_2) {
%>
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
<td>
<font size="-1">
你的应用服务器支持servlet 2.2或者更新。 </font> </td>
</tr>
<% }
else {
%>
<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
<font size="-1"> 你的应用服务器不支持servlet 2.2或者更新。</font>
</td></tr>
<%
}
%>
<%
// cloudwebsoft
boolean cloudInstalled = true;
try { Class.forName("com.redmoon.forum.MsgDb"); }
catch (ClassNotFoundException cnfe) { cloudInstalled = false; }
// Lucene
boolean luceneInstalled = true;
try { Class.forName("org.apache.lucene.document.Document"); }
catch (ClassNotFoundException cnfe) { luceneInstalled = false; }
// Lucene Chinese support
boolean luceneChineseInstalled = true;
try { Class.forName("org.apache.lucene.analysis.cn.ChineseAnalyzer"); }
catch (ClassNotFoundException cnfe) { luceneChineseInstalled = false; }
// JavaMail
boolean javaMailInstalled = true;
try {
Class.forName("javax.mail.Address"); // mail.jar
Class.forName("javax.activation.DataHandler"); // activation.jar
// Class.forName("dog.mail.nntp.Newsgroup"); // nntp.jar
}
catch (ClassNotFoundException cnfe) { javaMailInstalled = false; }
// JDBC std ext
boolean jdbcExtInstalled = true;
try { Class.forName("javax.sql.DataSource"); }
catch (ClassNotFoundException cnfe) { jdbcExtInstalled = false; }
boolean filesOK = cloudInstalled && luceneInstalled && javaMailInstalled &&
jdbcExtInstalled;
if (filesOK) {
%>
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td><td>
<font size="-1"> 所有的应用程序包都安装正确。
<% }
else {
%>
<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
<font size="-1">一个或者多个应用程序包没有被安装。
<% } %>
<tr><td colspan="2" valign=top><ul>
<font size="-1"><img src="images/<%= cloudInstalled?"check.gif":"x.gif" %>" width="13" height="13">
云网论坛内核 (forum.jar)
<br> <img src="images/<%= luceneInstalled?"check.gif":"x.gif" %>" width="13" height="13">
文本搜索引擎Lucene (lucene.jar)(中文支持)
<br> <img src="images/<%= javaMailInstalled?"check.gif":"x.gif" %>" width="13" height="13">
JavaMail支持 (mail.jar, activation.jar,)
<br> <img src="images/<%= jdbcExtInstalled?"check.gif":"x.gif" %>" width="13" height="13">
JDBC 2.0 扩展 (jdbc2_0-stdext.jar) </font>
</ul></td></tr>
<%
//Check the status of cloudHome
boolean propError = false;
String errorMessage = null;
String cloudHome = application.getRealPath("/");
try {
if (cloudHome != null) {
// See if the cloudHome directory actually exists
try {
File file = new File(cloudHome);
if (!file.exists()) {
propError = true;
errorMessage = "目录 <tt>" + cloudHome + "</tt> " +
"不存在。请指定正确的cloudHome目录。";
}
}
catch (Exception e) {}
if (!propError) {
boolean readable = (new File(cloudHome)).canRead();
if (!readable) {
propError = true;
errorMessage = "<tt>cloudHome</tt> 存在于<tt>" + cloudHome +
"</tt>, 但是你的应用服务器没有对它的读权限。请设置目录的权限修正此问题。";
}
boolean writable = (new File(cloudHome)).canWrite();
if (!writable) {
propError = true;
errorMessage = "<tt>cloudHome</tt> 存在于<tt>" + cloudHome +
"</tt>, 但是你的应用服务器没有对它的写权限。请设置目录的权限修正此问题。";
}
File homeFile = new File(cloudHome);
String [] subDirs = new String [] { "log", "upfile" };
for (int i=0; i<subDirs.length; i++) {
File subDir = new File(cloudHome, subDirs[i]);
if (!subDir.exists()) {
subDir.mkdir();
}
}
}
}
else {
propError = true;
errorMessage = "<tt>" + cloudHome + "</tt> 目录设置不正确。";
}
}
catch (Exception e) {
e.printStackTrace();
propError = true;
errorMessage = "检查<tt>" + cloudHome + "</tt>目录时发生异常。" +
"请确认你安装的是云网论坛程序是否完整!";
}
if (!propError) {
%>
<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
<td>
<tt>社区</tt> <font size="-1">目录正确配置于: </font><tt><%= cloudHome %></tt>.
</td></tr>
<%
}
else {
%>
<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
<font size="-1"><%= errorMessage %><font>
</td></tr>
<%
}
%>
</table>
</ul>
<%
if (propError || !filesOK || !isJDK1_2 || !servlet2_2) {
%>
<font color="red" size="-1"><b>安装初始化检查过程中发现错误,请更正,然后重新启动服务器重新开始安装过程。</b></font>
<%
}
else {
%>
<form action="setup2.jsp">
<hr size="0">
<div align="center">
<input type="submit" value="下一步">
</form>
<%
}
%>
</td>
</tr>
</table>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?