struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Lorenz <felipe.lor...@idealogic.com.br>
Subject Re: s:action tag showing result
Date Thu, 27 Jun 2013 12:14:26 GMT
Sure!

I have created an user at jira, but I think I dont have permissions to open a new issue. Or
am I in the wrong place? :)


Felipe Lorenz

Em 27/06/2013, às 03:11, Lukasz Lenart escreveu:

> Thanks Felipe!
> 
> I think we must extend RestActionProxyFactory to also add exclude list
> of namespaces, eg. "/ajax,/login", thus will allow to work in your
> configuration.
> 
> Could you register an issue?
> 
> 
> Thanks in advance
> -- 
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> 
> 2013/6/26 Felipe Lorenz <felipe.lorenz@idealogic.com.br>:
>> Hi Lukasz,
>> 
>> I could identify one plugin wich could be creating this behaviour, the rest plugin.
>> 
>> 
>> Since I have this configuration:
>>>> <constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
>>>> <constant name="struts.mapper.prefixMapping" value=":rest,/ajax:struts,/login:struts"/>
>> 
>> 
>> I expect that, when I request the following url http://xxxxxxxxxxx.com/ajax/anyThingHere,
struts should handle this call. But instead, RestActionProxyFactory is handle this call.
>> 
>> But the RestActionProxyFactory class has a if, and every time the namespace attribute
is injected with "/ajax" value. So the condition always is redirect to the rest plugin handler
and not to the struts default.
>> 
>> Here is my ActionProxyFactory implementation:
>> 
>> public class CustomActionProxyFactory extends RestActionProxyFactory {
>> 
>>        @Override
>>        public ActionProxy createActionProxy(String namespace, String actionName,
String methodName, Map<String, Object> extraContext, boolean executeResult, boolean
cleanupContext) {
>>                RestActionProxyFactory p = new RestActionProxyFactory();
>>                p.setContainer(container);
>>                if ("/ajax".equals(namespace)) {
>>                        p.setNamespace("/idealogic");
>>                }
>> 
>>                return p.createActionProxy(namespace, actionName, methodName, extraContext,
executeResult, cleanupContext);
>>        }
>> }
>> 
>> By some reason, it fixed the origin behaviour.
>> 
>> I hope it could help you.
>> 
>> Thanks,
>> Felipe Lorenz
>> 
>> Em 26/06/2013, às 04:45, Lukasz Lenart escreveu:
>> 
>>> As I understand you use <s:action executeResult="false"/> ? Which
>>> means result named "json" shouldn't be executed, you can even remove
>>> it.
>>> 
>>> 
>>> Regards
>>> --
>>> Łukasz
>>> + 48 606 323 122 http://www.lenart.org.pl/
>>> 
>>> 2013/6/22 Felipe Lorenz <felipe.lorenz@idealogic.com.br>:
>>>> Hello Lukasz,
>>>> 
>>>> I still facing this behaviour. Even with 2.3.16-SNAPSHOT.
>>>> 
>>>> One thing that make me thing, was the flush attribute. When it is true, the
json result (the string) appear in the position where the action tag is in the jsp. But, when
I change it to false, the result appears in the top os my page.
>>>> 
>>>> One workaround that I can use is return a result name that is no defined
in the struts.xml. This workaround throw an exception, since struts could no find my result
name, but my list is populated and no result from this action tag appear in my page.
>>>> 
>>>> I hope this information can help.
>>>> 
>>>> Also, I am printing my config:
>>>> 
>>>> struts.xml:
>>>> 
>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>> <!DOCTYPE struts PUBLIC
>>>>       "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
>>>>       "http://struts.apache.org/dtds/struts-2.3.dtd">
>>>> <struts order="10">
>>>>       <constant name="struts.devMode" value="false" />
>>>>       <constant name="struts.action.extension" value=",json,xhtml,xml"/>
>>>> 
>>>>       <constant name="struts.convention.action.mapAllMatches" value="true"
/>
>>>>       <constant name="struts.convention.default.parent.package" value="default"/>
>>>> 
>>>>       <constant name="struts.custom.i18n.resources" value="global" />
>>>> 
>>>>       <constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
>>>>       <constant name="struts.mapper.prefixMapping" value=":rest,/ajax:struts,/login:struts"/>
>>>> 
>>>>       <package name="default" extends="rest-default">
>>>> 
>>>>               <interceptors>
>>>>                       <interceptor class="br.com.idealogic.interceptor.LoginInterceptor"
name="login"/>
>>>>                       <interceptor class="br.com.idealogic.interceptor.PermissaoInterceptor"
name="permissao"/>
>>>>                       <interceptor class="br.com.idealogic.interceptor.I18nInterceptor"
name="idioma"/>
>>>>                       <interceptor class="br.com.idealogic.interceptor.JPAInterceptor"
name="jpa"/>
>>>>                       <interceptor-stack name="jpaStack">
>>>>                               <interceptor-ref name="login"/>
>>>>                               <interceptor-ref name="permissao"/>
>>>>                               <interceptor-ref name="idioma"/>
>>>>                               <interceptor-ref name="jpa"/>
>>>>                               <interceptor-ref name="restDefaultStack"/>
>>>>                       </interceptor-stack>
>>>>               </interceptors>
>>>>               <default-interceptor-ref name="jpaStack"/>
>>>> 
>>>> 
>>>>               <default-action-ref name="login_sistema"></default-action-ref>
>>>> 
>>>>               <global-results>
>>>>                       <result name="login">/login.jsp</result>
>>>>                       <result name="forbidden">/forbidden.jsp</result>
>>>>               </global-results>
>>>> 
>>>>       </package>
>>>> 
>>>>       <include file="struts-ajax.xml"/>
>>>>       <include file="struts-login.xml"/>
>>>>       <include file="struts-filtro.xml"/>
>>>> </struts>
>>>> 
>>>> struts-ajax.xml
>>>> 
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <!DOCTYPE struts PUBLIC
>>>> "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>>>> "http://struts.apache.org/dtds/struts-2.0.dtd">
>>>> <struts>
>>>>       <package name="ajax" extends="json-default" namespace="/ajax">
>>>>               <interceptors>
>>>>                       <interceptor class="br.com.idealogic.interceptor.JPAInterceptor"
name="jpa"/>
>>>>                       <interceptor-stack name="jpaJsonStack">
>>>>                               <interceptor-ref name="jpa"/>
>>>>                               <interceptor-ref name="jsonValidationWorkflowStack"/>
>>>>                       </interceptor-stack>
>>>>               </interceptors>
>>>>               <default-interceptor-ref name="jpaJsonStack"/>
>>>> 
>>>> 
>>>>               <action name="loadCidadeByEstado" method="loadCidadeByEstado"
class="br.com.seedingControl.action.CidadeAction">
>>>>                       <result name="json" type="json">
>>>>                               <param name="includeProperties">
>>>>                                       ^cidades\[\d+\]\.idCidade,
>>>>                                       ^cidades\[\d+\]\.nmCidade
>>>>                               </param>
>>>>                       </result>
>>>>               </action>
>>>> 
>>>>       </package>
>>>> </struts>
>>>> 
>>>> Thanks for all your help!
>>>> 
>>>> Felipe Lorenz
>>>> 
>>>> Em 22/06/2013, às 04:27, Lukasz Lenart escreveu:
>>>> 
>>>>> 2013/6/22 Litman, Bruno <blitman@alabamainteractive.org>:
>>>>>> We are also experiencing issues with tags and theme files, we are
upgrading many applications from 2.3.4.1 to 2.3.14.3
>>>>>> I am not sure if this is related - if not and if I need to start
a new discussion please let me know and accept my apology.
>>>>>> 
>>>>>> 1/
>>>>>> 
>>>>>> We previously always coded forms as :
>>>>>>      <s:form action="login" namespace="/">....
>>>>>> Now randomly, this fails to generate the proper action url in the
html (it is missing the '.action', which results in a 404 once you post the form)
>>>>>> 
>>>>>> The only workaround we have found so far is to add the '.action'
suffix to the s:form's action attribute. Before it was always added for us by struts.
>>>>>> So now we are having success with
>>>>>>      <s:form action="login.action" namespace="/">...
>>>>>> 
>>>>>> Is this expected behavior? Did this change recently? 2.3.4.1 is not
so ancient..
>>>>> 
>>>>> No, it isn't - mainly a bug - Struts should add suffix for you, you
>>>>> basically use the same action names as defined in struts.xml. This is
>>>>> very strange, I have just tested with struts2-blank on Jetty and
>>>>> suffix was there. Could you share more details about the config?
>>>>> 
>>>>>> 2/
>>>>>> 
>>>>>> We are trying to replace the "required" attribute in the textfields
with "requiredLabel" without success. Was the xhtml theme's ftl file "controlheader_core"
updated to reflect the changes in the struts-tags.tld (requiredLabel replaced required)?
>>>>> 
>>>>> You are right, it is bug :\ Please fill an issue
>>>>> 
>>>>>> Also, it seems applications are randomly serving ftl files from other
applications' theme folders with the same name.
>>>>>> This was demonstrated by modifying something obvious in one application's
ftl file (displaying some text next to a text field's label), and the effect can be seen randomly
on other applications which shouldn’t even see that application's template folder (the themes
are however named the same in both applications)
>>>>>> I am only able to make the "requiredLabel" attribute work if placed
in a <s:param> tag as opposed to being just an attribute of the s:textfield tag, but
even so it is still not always using the same ftl files (however always from similarly named
themes placed inside each application)
>>>>>> 
>>>>>> This is extremely confusing. Is FreeMarker caching files independently
of the application? Is the app container interfering with caching? (We are using Resin 4.0.36)
>>>>> 
>>>>> Hmmm... very strange behaviour, it will be hard to find the source of
>>>>> the problem. Maybe it is related to new ContainerHolder and how Resin
>>>>> is managing threads - but I'm not sure :\
>>>>> 
>>>>> 
>>>>> Regards
>>>>> --
>>>>> Łukasz
>>>>> + 48 606 323 122 http://www.lenart.org.pl/
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message