| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 764 人关注过本帖
标题:不开森-------一个Struts2的类型转换器的问题 搞了近2H了 红帖抱抱大腿
只看楼主 加入收藏
xiaozi2013
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:四川成都
等 级:蒙面侠
威 望:6
帖 子:830
专家分:4331
注 册:2013-12-13
结帖率:91.43%
收藏
已结贴  问题点数:100 回复次数:8 
不开森-------一个Struts2的类型转换器的问题 搞了近2H了 红帖抱抱大腿

代码如下:

转换器Java:
程序代码:
package org.action;
import javax.xml.crypto.Data;
import com.opensymphony.xwork2.ActionSupport;
public class typeConverter extends ActionSupport{
    
    private Data bir;    
    public Data getBir() {
        return bir;
    }
    public void setBir(Data bir) {
        this.bir = bir;
    }
    public String execute() throws Exception{
        return SUCCESS;
    }
}


输入日期的jsp:
程序代码:
<form action="con" method="post">
   <input type="text" name="bir">
   <input type="submit"/>
</form>


struts.xml:
程序代码:
<constant name="struts.il8n.encoding" value="utf-8"></constant>    
<package name="default" extends="struts-default" namespace="">
    <action name="con" class="org.action.typeConverter" method="">
        <result>/convertershow.jsp</result>
    </action>
</package>


错误提示:
警告: Could not find action or result: /struts2_01_configuration/con
No result defined for action org.action.typeConverter and result input - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/webapps/struts2_01_configuration/WEB-INF/classes/struts.xml:20:65

    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:273)
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
    at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:125)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564)
    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
    at org.apache.tomcat.(AprEndpoint.java:2503)
    at org.apache.tomcat.(AprEndpoint.java:2492)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)


真心搞不了
搜索更多相关主题的帖子: 转换器 return Java 
2015-10-05 23:01
xiaozi2013
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:四川成都
等 级:蒙面侠
威 望:6
帖 子:830
专家分:4331
注 册:2013-12-13
收藏
得分:0 
要断电了:明早再来鸟

--整天敲那些破代码能找着媳妇儿吗。。。---
2015-10-05 23:03
诸葛欧阳
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:流年
等 级:贵宾
威 望:82
帖 子:2790
专家分:14619
注 册:2014-10-16
收藏
得分:50 
帮顶了

一片落叶掉进了回忆的流年。
2015-10-06 18:35
神vLinux飘飘
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:浙江杭州
等 级:贵宾
威 望:91
帖 子:6140
专家分:217
注 册:2004-7-17
收藏
得分:50 
信息太少了,而且也不熟悉xwork,帮你顶了

淘宝杜琨
2015-10-06 21:44
xiaozi2013
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:四川成都
等 级:蒙面侠
威 望:6
帖 子:830
专家分:4331
注 册:2013-12-13
收藏
得分:0 

      送楼上两个么么哒~~! 估计的明天问下子老师!

--整天敲那些破代码能找着媳妇儿吗。。。---
2015-10-07 09:20
诸葛欧阳
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:流年
等 级:贵宾
威 望:82
帖 子:2790
专家分:14619
注 册:2014-10-16
收藏
得分:0 
装个tomcat我都搞了几天,几个版本装了卸卸了装,还是出问题不是404就是500

一片落叶掉进了回忆的流年。
2015-10-08 10:12
xiaozi2013
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:四川成都
等 级:蒙面侠
威 望:6
帖 子:830
专家分:4331
注 册:2013-12-13
收藏
得分:0 
以下是引用诸葛欧阳在2015-10-8 10:12:58的发言:

装个tomcat我都搞了几天,几个版本装了卸卸了装,还是出问题不是404就是500


多半不是tomcat本身的问题,首先看看有没有Http://localhost:port(8080)/

用的是安装版的吗

--整天敲那些破代码能找着媳妇儿吗。。。---
2015-10-09 07:18
xiaozi2013
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:四川成都
等 级:蒙面侠
威 望:6
帖 子:830
专家分:4331
注 册:2013-12-13
收藏
得分:0 
Date型与String转换问题解决的链接:
    http://weii.

--整天敲那些破代码能找着媳妇儿吗。。。---
2015-10-09 16:47
xiaozi2013
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:四川成都
等 级:蒙面侠
威 望:6
帖 子:830
专家分:4331
注 册:2013-12-13
收藏
得分:0 
此贴终结:
今天编写自定义日期转换器才发现我错在哪里!

    private Data bir;   格式申明错了 一个字母的事 我那天搞几个小时都没有办法!!这是个教训.

--整天敲那些破代码能找着媳妇儿吗。。。---
2015-10-15 18:50
快速回复:不开森-------一个Struts2的类型转换器的问题 搞了近2H了 红帖抱抱大腿 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.072169 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved