这是怎么回事啊?找了好长时间也找不到问题,看视频后,自己搭建nutz的框架试试的
看启动时的日志,肯定有提示
来自炫酷的 NutzCN
@wendal 确实没有推送快...IOS客户端什么时候出来呢
我看了日志
2015-11-17 9:7:27.953 DEBUG [localhost-startStop-1] Found a Class with Ioc-Annotation : class com.hits.nutz.UserAction
2015-11-17 9:7:27.968 INFO [localhost-startStop-1] Scan complete ! Found 1 classes in 1 base-packages!
beans = ["userAction"]
2015-11-17 9:7:27.978 DEBUG [localhost-startStop-1] MainModule: <com.hits.nutz.MainModel>
2015-11-17 9:7:27.982 INFO [localhost-startStop-1] Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2015-11-17 9:7:27.985 DEBUG [localhost-startStop-1] @Views(DefaultViewMaker)
2015-11-17 9:7:27.993 DEBUG [localhost-startStop-1] @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
2015-11-17 9:7:28.0 DEBUG [localhost-startStop-1] module class location 'file:/F:/works/.metadata/.plugins/org.eclipse.wst.server.core/tmp7/wtpwebapps/NutzTest/WEB-INF/classes/com/hits/nutz/MainModel.class'
2015-11-17 9:7:28.0 DEBUG [localhost-startStop-1] > scan 'com.hits.nutz'
2015-11-17 9:7:28.4 DEBUG [localhost-startStop-1] Found 3 resource by src( com/hits/nutz/ ) , regex( ^.+[.]class$ )
2015-11-17 9:7:28.6 DEBUG [localhost-startStop-1] >> add 'com.hits.nutz.UserAction'
2015-11-17 9:7:28.37 DEBUG [localhost-startStop-1] '/login' >> UserAction.login(...) : void | @Ok(->:/private/login.html) @Fail(null ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2015-11-17 9:7:28.37 INFO [localhost-startStop-1] Found 1 module methods
2015-11-17 9:7:28.39 DEBUG [localhost-startStop-1] @Localization not define
2015-11-17 9:7:28.42 INFO [localhost-startStop-1] Nutz.Mvc[nutz] is up in 264ms
十一月 17, 2015 9:07:28 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
十一月 17, 2015 9:07:28 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
十一月 17, 2015 9:07:28 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 4062 ms
2015-11-17 9:7:30.45 DEBUG [http-bio-8080-exec-3] Search mapping for path=/ : NOT Action match
这里贴代码
web.xml 代码
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
NutzTest
nutz
org.nutz.mvc.NutFilter
modules
com.hits.nutz.MainModel
nutz
/*
login
anction代码
package com.hits.nutz;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@IocBean
public class UserAction {
@Inject
private Dao dao;
@At("/login")
@Ok("->:/private/login.html")
public void login() {
}
}
mainModule代码
package com.hits.nutz;
import org.nutz.mvc.annotation.IocBy;
import org.nutz.mvc.annotation.Modules;
import org.nutz.mvc.ioc.provider.ComboIocProvider;
@Modules(scanPackage=true)
@IocBy(type=ComboIocProvider.class,args={
"*org.nutz.ioc.loader.json.JsonLoader","conf",
"*org.nutz.ioc.loader.annotation.AnnotationIocLoader","com.hits.nutz"})
public class MainModel {
}
配置文件代码
var ioc = {
dataSource:{
type:"com.alibaba.druid.pool.DruidDataSource",
events:{
depose:"close"
},
fields:{
url:"jdbc:oracle:thin:@localhost:1521:orcl",
username:"lyd",
password:"pass",
maxActive:20,
testWhileIdle:true,
validationQuery:'SELECT COUNT(*) FROM SYS_DBTEST',
removeAbandoned:true ,
removeAbandonedTimeout:1800,
filters:"stat"
}
},
dao : {
type : "org.nutz.dao.impl.NutDao",
args : [{refer:'dataSource'}]
}
};
/login
@IocBean
public class UserAction {
@Inject
private Dao dao;
@At("/login")
@Ok("->:/private/login.html")
public void login() {
}
}
我就是这样写的,不行就出现NOT Action match
URLMAPPING手册 先看看这个 在看看web.xml配置的每一项是什么意思,我已经无心给你继续讲下去了
在低版本的servlet api环境下, welcome-file必须是个真实存在的文件,才会生效的. 写 "/"或"login"不会有效果,
但是你写个"login",然后放个名叫login的空文件, 它会生效
你说的对,我直接访问http://127.0.0.1:8080/NutzTest/login是可以直接访问到我所写的页面,添加login空文件是什么意思,我得servlet-api版本应该不老吧,我用的是tomcat7
建议看看servlet相关的东西,你打开的地址是怎么请求到对应的方法的,把这些基础弄明白先
来自炫酷的 NutzCN
@tuwei1992 https://nutz.cn/yvr/links/about.html 2.x 客户端的源码