Hi Martin, don't know howto do it. can you please give me some detailed materials?
在2009-05-20,"Martin Gainty" <mgai...@hotmail.com> 写道: > >let the StrutsDispatcher handle the navigation details >you'll have to fill in any necessary java classes as well as input/output jsps >but the basic structure is outlined in struts.xml illustrated below > >Martin Gainty >______________________________________________ >Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > >Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger >sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung >oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich >dem Austausch von Informationen und entfaltet keine rechtliche >Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen >wir keine Haftung fuer den Inhalt uebernehmen. >Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le >destinataire prévu, nous te demandons avec bonté que pour satisfaire informez >l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est >interdite. Ce message sert à l'information seulement et n'aura pas n'importe >quel effet légalement obligatoire. Étant donné que les email peuvent >facilement être sujets à la manipulation, nous ne pouvons accepter aucune >responsabilité pour le contenu fourni. > > > > >> Date: Wed, 20 May 2009 18:36:57 +0800 >> From: xnp...@163.com >> To: user@struts.apache.org >> Subject: Re:Re: Struts2+ReST-plugin prolems need help!!! >> >> >> Hi Dave! >> I'm using Struts2.1.6 and struts2-rest-plugin-2.1.6. >> >> first ,I need a global error page when exception happen like this: >> >> Stacktraces >> java.lang.NoSuchMethodException: com.xunan.sitexa.rest.MainController.a() >> java.lang.Class.getMethod(Unknown Source) >> >> org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75) >> >> org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47) >> >> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) >> >> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) >> >> com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) >> >> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) >> >> org.apache.struts2.rest.ContentTypeInterceptor.intercept(ContentTypeInterceptor.java:67) >> >> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) >> >> and second,I want to forward request to action like the follow: >> if(type=='1'){ >> request.forward("action1); >> }else if(type=='2'){ >> request.forward("action1); >> } > >struts.xml ><package name="default" extends="struts-default" namespace="/"> > <interceptors> ><interceptor name="tokenSession" >class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/> > <interceptor name="authentication" > class="com.xunan.framework.web.interceptor.SimpleInterceptor"/> > ><!--define which interceptors you need for default behaviour inside here --> > <interceptor-stack name="defaultStack"> > </interceptor=stack> ><!-- define which interceptors you need for suser-submit inside here --> > <interceptor-stack name="user-submit"> > > <interceptor-ref name="tokenSession"/> > ><interceptor-ref name="user"/> > ></interceptor-stack> > <interceptor-stack name="user"> > <interceptor-ref name="authentication"/> > <interceptor-ref name="defaultStack"/> > </interceptor-stack> > > <interceptor-stack name="guest"> > </interceptors> ><!--default to user interceptor stack of user--> > <default-interceptor-ref name="user"/> > > <global-results> ><!--freemarker uses .ftl filename jsp uses jsp --> > <result name="error" type="jsp">/error.jsp</result> > </global-results> > > <global-exception-mappings> > <exception-mapping exception="java.lang.Exception" result="error"> > </exception-mapping> > </global-exception-mappings> > > <action name="login" class="chatLoginAction"> > <interceptor-ref name="defaultStack" /> > <result type="redirect">/action${ClassName.type}.action</result> > <result name="input">/index.jsp</result> > </action> > <action name="action1"> > <interceptor-ref name="defaultStack" /> > <result name="success">action1_success.jsp</result> > <result name="error">action1_error.jsp</result> > </action> > <action name="action2"> > > <interceptor-ref name="defaultStack" /> > > <result name="success">action2_success.jsp</result> > <result name="error">action2_error.jsp</result> > > </action> ></package> > >> third, a SimpleInterceptor doing login check, >> <package name="default" namespace="/" extends="struts-default"> >> <interceptors> >> <interceptor name="authentication" >> class="com.xunan.framework.web.interceptor.SimpleInterceptor"/> >> <interceptor-stack name="user"> >> <interceptor-ref name="authentication"/> >> <interceptor-ref name="defaultStack"/> >> </interceptor-stack> >> <interceptor-stack name="user-submit"> >> <interceptor-ref name="tokenSession"/> >> <interceptor-ref name="user"/> >> </interceptor-stack> >> <interceptor-stack name="guest"> >> <interceptor-ref name="defaultStack"/> >> </interceptor-stack> >> </interceptors> >> <default-interceptor-ref name="user"/> >> <global-results> >> <result name="error" type="freemarker">/error.jsp</result> >> </global-results> >> <global-exception-mappings> >> <exception-mapping exception="java.lang.Exception" >> result="error"> >> </exception-mapping> >> </global-exception-mappings> >> </package> >> >> thank you very much. >> >> >> 在2009-05-20,"Dave Newton" <newton.d...@yahoo.com> 写道: >> >xnpeng wrote: >> >> I'm doing my project with struts2+rest-plugin for about 3 months.there is >> >> a lot of problems unresolved. >> >> >> >> With rest-plugin and convention-plugin,all action-mapping are done >> >> automatically,manual action-mapping in struts.xml cannot work.so, >> >> 1, I cannot define global-error-result; >> >> 2, I cannot do forward; >> >> 3, I cannot insert my own Interceptors. >> >> >> >> I 'm watching this mail-list day and day, there is not much discuss on >> >> rest-plugin, neithere is enough materials on the internet. Does someone >> >> have much experience on this topic? I need your help ergently! >> >> >> >> >> >> >> > >> >It's definitely possible to combine REST and XML mappings. >> > >> >You might have better luck telling us what specific issues you're >> >having, along with what version of S2 you're using. >> > >> >Dave >> > >> >--------------------------------------------------------------------- >> >To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> >For additional commands, e-mail: user-h...@struts.apache.org >> > > >_________________________________________________________________ >Hotmail® goes with you. >http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009