netbeans 怎么设置项目上下文路径是 / ?

就是不着调 发布于 2012/12/07 14:27
阅读 875
收藏 0
也就是localhost可以访问项目 无需加项目名
加载中
0
王振威
王振威

<Context docBase="C:\test" path="" reloadable="true"/>
如果是tomcat的话在server.xml中加上上面配置

一定要有path=""这个就保证了你url中不带有项目名

0
王振威
王振威

完整的tomcat配置(开发环境)

<?xml version="1.0" encoding="UTF-8"?>
<Server port="8004" shutdown="SHUTDOWN">
	<Listener SSLEngine="on"
		className="org.apache.catalina.core.AprLifecycleListener" />
	<Listener className="org.apache.catalina.core.JasperListener" />
	<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
	<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
	<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
	<GlobalNamingResources>
		<Resource auth="Container" description="User database that can be updated and saved"
			factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase"
			pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase" />
	</GlobalNamingResources>
	<Service name="Catalina">
		<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1"
			redirectPort="8443" />
		<Connector port="8008" protocol="AJP/1.3" redirectPort="8443" />
		<Engine defaultHost="localhost" name="Catalina">
			<Realm className="org.apache.catalina.realm.LockOutRealm">
				<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
					resourceName="UserDatabase" />
			</Realm>
			<Host appBase="webapps" autoDeploy="true" name="localhost"
				unpackWARs="true">
				<Valve className="org.apache.catalina.valves.AccessLogValve"
					directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log."
					suffix=".txt" />
				<Context docBase="C:\Users\jack\workspace\test"
					path="" reloadable="true" />
			</Host>
		</Engine>
	</Service>
</Server>
就是不着调
就是不着调
这个我知道 不过还是谢谢. 只是想偷懒直接在netbeans里设置.eclipse是可以直接设置的.
返回顶部
顶部