A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 不冬眠的蚂蚁 中级黑马   /  2014-3-18 12:02  /  1169 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

本帖最后由 不冬眠的蚂蚁 于 2014-3-25 15:54 编辑

import java.sql.Date;
。。。。。。。。。。。。。。
private Date releaseDate ;
。。。。。。。。。。。
        public Date getReleaseDate() {
                return releaseDate;
        }
        public void setReleaseDate(Date releaseDate) {
                this.releaseDate = releaseDate;
        }

,,,,,,,,,,,,,,,jsp页面
<%                 java.sql.Date date = new java.sql.Date(new java.util.Date().getTime());  %>

,,,,
<p><br> 发布日期:<input type="text" readonly="readonly" name="releaseDate" value="<%= date %>"></p>

---------------------
可是出错了
Mar 18, 2014 11:22:09 AM org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0\bin;E:\java\apache-tomcat-6.0.29\bin
Mar 18, 2014 11:22:09 AM org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
Mar 18, 2014 11:22:09 AM org.apache.catalina.startup.Catalina load
信息: Initialization processed in 548 ms
Mar 18, 2014 11:22:09 AM org.apache.catalina.core.StandardService start
信息: Starting service Catalina
Mar 18, 2014 11:22:09 AM org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.29
Mar 18, 2014 11:22:09 AM org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor host-manager.xml
Mar 18, 2014 11:22:09 AM org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
Mar 18, 2014 11:22:09 AM org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
Mar 18, 2014 11:22:09 AM org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
Mar 18, 2014 11:22:09 AM org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
Mar 18, 2014 11:22:09 AM org.apache.catalina.core.ApplicationContext log
Mar 18, 2014 11:22:11 AM org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
Mar 18, 2014 11:22:11 AM org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
Mar 18, 2014 11:22:11 AM org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/28  config=null
Mar 18, 2014 11:22:11 AM org.apache.catalina.startup.Catalina start
信息: Server startup in 2465 ms
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate: select user0_.id as id1_, user0_.username as username1_, user0_.password as password1_ from user user0_ where user0_.username=?
Hibernate: select news0_.id as id2_, news0_.title as title2_, news0_.content as content2_, news0_.releaseDate as releaseD4_2_, news0_.userID as userID2_, news0_.newsTypeID as newsTypeID2_ from news news0_ limit ?
Hibernate: select user0_.id as id1_, user0_.username as username1_, user0_.password as password1_ from user user0_ where user0_.id=?
Hibernate: select newstype0_.id as id3_, newstype0_.typeName as typeName3_ from newsType newstype0_ where newstype0_.id=?
Hibernate: select news0_.id as id2_, news0_.title as title2_, news0_.content as content2_, news0_.releaseDate as releaseD4_2_, news0_.userID as userID2_, news0_.newsTypeID as newsTypeID2_ from news news0_
Hibernate: select news0_.id as id2_, news0_.title as title2_, news0_.content as content2_, news0_.releaseDate as releaseD4_2_, news0_.userID as userID2_, news0_.newsTypeID as newsTypeID2_ from news news0_ where news0_.id=?
Hibernate: select user0_.id as id1_, user0_.username as username1_, user0_.password as password1_ from user user0_ where user0_.id=?
Hibernate: select newstype0_.id as id3_, newstype0_.typeName as typeName3_ from newsType newstype0_ where newstype0_.id=?
Hibernate: select user0_.id as id1_, user0_.username as username1_, user0_.password as password1_ from user user0_
Hibernate: select newstype0_.id as id3_, newstype0_.typeName as typeName3_ from newsType newstype0_
Mar 18, 2014 11:22:44 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Error setting expression 'releaseDate' with value '[Ljava.lang.String;@10d941c'
ognl.MethodFailedException: Method "setReleaseDate" failed for object com.data.action.NewsAction@147a6a4
[java.lang.NoSuchMethodException: com.data.action.NewsAction.setReleaseDate([Ljava.lang.String;)]
        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1285)
        at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1474)
        at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
        at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
        at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2245)
        at com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:77)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2245)
        at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
        at ognl.SimpleNode.setValue(SimpleNode.java:301)
        at ognl.Ognl.setValue(Ognl.java:737)
        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:209)
        at com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:173)
        at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:160)
        at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:151)
        at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:288)
        at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:199)
        at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
        at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
        at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
        at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
        at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
        at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
        at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
        at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:722)
        Caused by: java.lang.NoSuchMethodException: com.data.action.NewsAction.setReleaseDate([Ljava.lang.String;)
        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1226)
        ... 64 more
/-- Encapsulated exception ------------\
java.lang.NoSuchMethodException: com.data.action.NewsAction.setReleaseDate([Ljava.lang.String;)
        at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1226)
        at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1474)
        at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
        at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
        at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27)


毕业设计卡主了 。。。。求大神帮帮看看呢

评分

参与人数 1技术分 +1 收起 理由
朱神必 + 1

查看全部评分

2 个回复

倒序浏览
能把你服务器里面的Servlet编出来的.java文件(或者.class文件)贴出来吗?

评分

参与人数 1技术分 +1 收起 理由
朱神必 + 1

查看全部评分

回复 使用道具 举报
水蓝 发表于 2014-3-18 12:05
能把你服务器里面的Servlet编出来的.java文件(或者.class文件)贴出来吗?

package com.data.action;

import java.sql.Date;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.data.model.News;
import com.data.model.NewsType;
import com.data.model.User;
import com.data.service.NewsService;
import com.data.service.impl.NewsServiceImpl;
import com.data.service.impl.NewsTypeServiceImpl;
import com.data.service.impl.UserServiceImpl;
import com.opensymphony.xwork2.ActionSupport;

public class NewsAction extends ActionSupport {
        private int newsID;
        private String title;
        private String content;
        private Date releaseDate;
        private int userID;
        private int newsTypeID;
        private List<News> allNews;
        private int pageSize = 10;
        private int pageNow = 1;
        private int totalCount;
        private List<User> allUsers;
        private List<NewsType> allNewsType;
       
       
        public List<User> getAllUsers() {
                return allUsers;
        }
        public void setAllUsers(List<User> allUsers) {
                this.allUsers = allUsers;
        }
        public List<NewsType> getAllNewsType() {
                return allNewsType;
        }
        public void setAllNewsType(List<NewsType> allNewsType) {
                this.allNewsType = allNewsType;
        }
        public int getNewsID() {
                return newsID;
        }
        public void setNewsID(int newsID) {
                this.newsID = newsID;
        }
        public String getTitle() {
                return title;
        }
        public void setTitle(String title) {
                this.title = title;
        }
        public String getContent() {
                return content;
        }
        public void setContent(String content) {
                this.content = content;
        }
        public Date getReleaseDate() {
                return releaseDate;
        }
        public void setReleaseDate(Date releaseDate) {
                this.releaseDate = releaseDate;
        }
        public int getUserID() {
                return userID;
        }
        public void setUserID(int userID) {
                this.userID = userID;
        }
        public int getNewsTypeID() {
                return newsTypeID;
        }
        public void setNewsTypeID(int newsTypeID) {
                this.newsTypeID = newsTypeID;
        }
       
        public List<News> getAllNews() {
                return allNews;
        }
        public void setAllNews(List<News> allNews) {
                this.allNews = allNews;
        }
       
       
        public int getPageSize() {
                return pageSize;
        }
        public void setPageSize(int pageSize) {
                this.pageSize = pageSize;
        }
        public int getPageNow() {
                return pageNow;
        }
        public void setPageNow(int pageNow) {
                this.pageNow = pageNow;
        }
        public int getTotalCount() {
                return totalCount;
        }
        public void setTotalCount(int totalCount) {
                this.totalCount = totalCount;
        }
        public String createNews(){
                HttpSession session = ServletActionContext.getRequest().getSession();
                User user = (User)session.getAttribute("user");
                News news = new News();
                news.setTitle(this.title);
                news.setContent(this.content);
                news.setReleaseDate(this.releaseDate);
                news.setUserID(user.getId());
                news.setNewsTypeID(this.newsTypeID);
                NewsService newsService = new NewsServiceImpl();
                newsService.createNews(news);
                this.allNews = newsService.queryAllNews(this.pageSize, this.pageNow);
                for(Iterator<News> it = allNews.iterator();it.hasNext();){
                        News n = it.next();
                        User u1 = new UserServiceImpl().queryUser(n.getUserID());
                        n.setUser(u1);
                        NewsType newsType = new NewsTypeServiceImpl().queryNewsType(n.getNewsTypeID());
                        n.setNewsType(newsType);
                }
                this.totalCount = newsService.queryAllNews().size();
                return SUCCESS;
        }
       
        public String showNews(){
                NewsService newService = new NewsServiceImpl();
                News news = newService.queryNews(this.newsID);
                User user = new UserServiceImpl().queryUser(news.getUserID());
                news.setUser(user);
                NewsType newsType = new NewsTypeServiceImpl().queryNewsType(news.getNewsTypeID());
                news.setNewsType(newsType);
                HttpServletRequest request = ServletActionContext.getRequest();
                request.setAttribute("news", news);
                this.allUsers = new UserServiceImpl().queryAllUsers();
                this.allNewsType = new NewsTypeServiceImpl().queryAllNewsTypes();
                return SUCCESS;
        }
       
        public String showAllNews(){
                NewsService newsService = new NewsServiceImpl();
                this.allNews = newsService.queryAllNews(this.pageSize, this.pageNow);
                for(Iterator<News> it = allNews.iterator();it.hasNext();){
                        News n = it.next();
                        User user = new UserServiceImpl().queryUser(n.getUserID());
                        n.setUser(user);
                        NewsType newsType = new NewsTypeServiceImpl().queryNewsType(n.getNewsTypeID());
                        n.setNewsType(newsType);
                }
                this.totalCount = newsService.queryAllNews().size();
                return SUCCESS;
        }
       
        public String showNewsByTypeID(){
                NewsService newsService = new NewsServiceImpl();
                this.allNews = newsService.queryAllNews(this.newsTypeID);
                return SUCCESS;
        }
       
        public String updateNews(){
                NewsService newsService = new NewsServiceImpl();
                News news = newsService.queryNews(this.newsID);
                news.setTitle(this.title);
                news.setContent(this.content);
                news.setReleaseDate(this.releaseDate);
                news.setUserID(this.userID);
                news.setNewsTypeID(this.newsTypeID);
                newsService.updateNews(news);
                this.allNews = newsService.queryAllNews(this.pageSize, this.pageNow);
                for(Iterator<News> it = allNews.iterator();it.hasNext();){
                        News n = it.next();
                        User user = new UserServiceImpl().queryUser(n.getUserID());
                        n.setUser(user);
                        NewsType newsType = new NewsTypeServiceImpl().queryNewsType(n.getNewsTypeID());
                        n.setNewsType(newsType);
                }
                this.totalCount = newsService.queryAllNews().size();
                return SUCCESS;
        }
       
        public String deleteNews(){
                NewsService newsService = new NewsServiceImpl();
                News news = newsService.queryNews(this.newsID);
                newsService.deleteNews(news);
                this.allNews = newsService.queryAllNews(this.pageSize, this.pageNow);
                for(Iterator<News> it = allNews.iterator();it.hasNext();){
                        News n = it.next();
                        User user = new UserServiceImpl().queryUser(n.getUserID());
                        n.setUser(user);
                        NewsType newsType = new NewsTypeServiceImpl().queryNewsType(n.getNewsTypeID());
                        n.setNewsType(newsType);
                }
                this.totalCount = newsService.queryAllNews().size();
                return SUCCESS;
        }
       
        public String showAllNewsTypes(){
                this.allNewsType = new NewsTypeServiceImpl().queryAllNewsTypes();
                return SUCCESS;
        }
       
}
..............
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马