我正在使用Maven Web应用程序(Java),Glassfish作为Web服务器。我有一个目录,例如path = Application_name/src/main/webapp
。但我需要以http:///localhost:8080/webapp
的形式访问该目录。我是否需要在我的应用程序或Glassfish或其他配置中进行一些配置?
答案 0 :(得分:0)
我怀疑您使用的是Maven,/ src / main / resources /文件夹中的资源应该在您的Web应用程序的根目录中复制。
答案 1 :(得分:0)
您可以直接在glassfish中配置端口。 8080是默认端口。如果您想要更改,请在此处查看:https://blogs.oracle.com/openroad/entry/changing_default_glassfish_port_numbers。
对于名称(webapp),它发生在您的web.xml中。加上这个:
> <context-param>
> <param-name>webAppRootKey</param-name>
> <param-value>webapp</param-value>
> </context-param>
答案 2 :(得分:0)
听起来您正在谈论如何部署应用程序:
http://maven.apache.org/plugins/maven-war-plugin/usage.html
在glassfish-web.xml(或旧版本sun-web.xml)中查找“context-root”,例如:http://docs.oracle.com/cd/E19798-01/821-1750/beasg/index.html
为了加快开发速度,您还可以部署“爆炸”的war文件或使用auto-deploy目录。 http://docs.oracle.com/cd/E18930_01/html/821-2417/gilfm.html#SJSASEEADGfvxze