NutzCN Logo
问答 求nutz-web在window+netbeans下的 启动指导
发布于 2980天前 作者 汉歌 1378 次浏览 复制 上一个帖子 下一个帖子
标签:

java 目录/src/main/java
conf 目录/src/main/resources
webapp 目录/src/main/webapp
web.xml 目录/src/main/webapp/web-inf/web.xml
求相应的系统配置指导,感激不尽

7 回复

贴启动代码及web.propterties

通过org.nutz.web目下的WebLauncher下的类中main 启动
启动代码
public static void main(String[] args) {
String args1 = "web.properties";
start(args1);
}
//启动代码结束
web.propterties
app-root=WEBAPP/ROOT
app-port=8083
app-rs=
app-classpath:
admin-port=8084
app-defaults-descriptor=

/path/to/webdefault.xml

通过org.nutz.web目下的WebLauncher下的类中main 启动
启动代码
public static void main(String[] args) {
String args1 = "web.properties";
start(args1);
}
//启动代码结束
web.propterties
app-root=WEBAPP/ROOT
app-port=8083
app-rs=
app-classpath:
admin-port=8084
app-defaults-descriptor=

@qq_8136064a

app-root明显不对
除app-root,app-port之外的配置删掉

app-root可以
app-root,app-port之外的配置删掉就可以运行,显示
Directory: /

app-root应该src/main/webapp吧

配置web.propterties
app-root=src/main/webapp
app-port=8083
配置web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

nutz
org.nutz.mvc.NutFilter

modules
demo.hello.MainModule



nutz
/*


新建 在src/main/java下新建 demo/hello目录
新建hello.java文件
文件内容
package demo.hello;

import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author hange
*/
public class MainModule {

@At("/hello")
@Ok("jsp:jsp.hello")
public String doHello() {
    return "Hello Nutz";
}

}
在src/main/webapp下新建jsp文件夹
在src/main/webapp/jsp下新建 hello.jsp文件
hello.jsp文件内容


I am hello ^_^


<%=request.getAttribute("obj")%>


在maven中加入jsp依赖包

org.eclipse.jetty
jetty-jsp
7.6.18.v20150929

    就可以运行成功了
添加回复
请先登陆
回到顶部