You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andras Balogh <an...@reea.net> on 2009/03/02 07:52:03 UTC

Re: [S2] json-plugin: includeProperties being ignored?

Hi,

    Try to specify the includeProperties at the
<interceptor-ref name="json" > definition and not at the result type.

BR,
Andras

John.C.Cartwright@noaa.gov wrote:
> Hello All,
>
> I'm having trouble getting the json-plugin 0.32 to behave as I'd
> expected.  The action is exposing a List of objects annotated as
> "@JSON(name="items")" in the action.
>
> I have my result configured as:
> <result type="json">
>             <param name="excludeNullProperties">true</param>
>             <param name="includeProperties">
>             items.*\.name
>             </param>
>          </result>
>
> However the returned JSON has all of the properties for the objects in
> the list.  Can someone please help me with what I'm doing wrong?
>
> Thanks!
>
> --john
>
>
> ---------------------------------------------------------------------
> 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


Struts 2.1 utf-8 validation messages (in Arabic, Chinese etc) displayed in "?" when using Ajax validation, a bug or wrong setting?

Posted by Qunhuan Mei <qm...@qm18.wanadoo.co.uk>.
Hi all, 

I am going to use Struts-blank-2.1.6 to demonstrate a localisation problem
when doing Ajax validation in maybe 10 minutes. I am not sure if it is a bug
(from dojo-plugin?) or just a wrong setting somewhere. Hope some expert
could shed some light here. Much appreciated.

Steps to reproduce the problem (using eclipse): 

1. Create a project by importing struts2-blank-2.1.6.war from
...\struts-2.1.6\apps" 
2. Copy the form code from Login.jsp into Welcome.jsp, right before </body>
tag: 

<s:form action="Login"> 
    <s:textfield key="username" /> 
    <s:password key="password" /> 
    <s:submit/> 
</s:form> 

At this point, build and run the project, everything works as it should be
and 
None of the messages are encoded using utf-8.

3. Prepare some utf-8 encoded validation message
Using Google translator to translate “register” into Arabic we get “???” and
into Chinese we get “??”. Then using command “native2ascii -encoding utf-8”
turn these two internationalised message into unicode encoded:
\u0633\u062c\u0644 and \u6ce8\u518c. Simply copy the unicode message into
the end of every message line of package.properties (and
package_es.properties if you want).

4. See message correctly displayed, without using Ajax
At this point: build and run the project, everything works as it should be -
correct behavior and unicode message also displayed correctly (graphically
recognizable).

5. Turn the validation into using Ajax:
(1) Adding dojo taglib to line 3 of Welcome.jsp: 
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> 

(2) Adding <sx:head /> right before </head> to enable ajax validation on the
page 
(3) Replace <s:submit> with <sx:submit validate="true"
ajaxAfterValidation="true" showLoadingText="false"/> 

(4) Adding do-jo jar file "struts2-dojo-plugin-2.1.6.jar" to the project's
lib (from "...\struts-2.1.6\lib") and refresh the project 
(5) Adding following two lines to example.xml, just below <action
name="Login_*" method="{1}" class="example.Login"> 
   <interceptor-ref name="i18n"/>
     <interceptor-ref name="jsonValidationWorkflowStack"/> 

Rebuild and run the project and click submit without any input, the right
error messages are displayed correctly for English and Spanish. But both
Arabic and Chinese are displayed in question marks (“?”). 

What caused the problem?

(My working environment: windows xp pro, eclipse 3.4.1, java 1.6.)

Thanks,

Qunhuan




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org