struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shuk <joh.k...@gmail.com>
Subject RE: Problem with Ajax and <s:text> (i18n)
Date Thu, 06 Nov 2008 18:31:20 GMT

Hi Martin,

I solved it by simply modifying my package structure. Basically I just added
one main package that contains all other packages. This allows me to put the
package.properties in the main package so that it can be accessed by all
classes in sub-packages. I added a small example below.

Old structure:
-src
  + package 1
  - package 2
       package.properties
       Class1.java
       Class2.java
  + package 3

New structure:
-src
  - main package
      + package 1
      + package 2
      + package 3
    package.properties

This is probably the simplest way to do it. No idea if it is the best way
though...

Thanks,
Shuk


mgainty wrote:
> 
> 
> Shuk-
> 
> your scoping can be modified to override the default scope interceptor
> e.g. scope="application"
> another way would be to insert <interceptor name="scope"
> class="org.apache.struts2.interceptor.ScopeInterceptor"/>
> on your Basic Stack and override the applicable params..
> 
> HTH
> Martin 
> ______________________________________________ 
> Disclaimer and confidentiality note 
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and
> Sender does not endorse distribution to any party other than intended
> recipient. Sender does not necessarily endorse content contained within
> this transmission. 
> 
> 
> 
> 
>> Date: Thu, 6 Nov 2008 07:37:25 -0800
>> From: joh.kuhs@gmail.com
>> To: user@struts.apache.org
>> Subject: Problem with Ajax and <s:text> (i18n)
>> 
>> 
>> Hi,
>> 
>> I'm trying to add some Ajax functionality to my Struts2 project but
>> unfortunately encountered a quite annoying problem with the
>> &lt;s:text&gt;
>> tag. For better understanding, here is the relevant code I'm using:
>> 
>> 
>> Ajax div on main page:
>> 
>>     &lt;s:div id="userInfo" theme="ajax" href="/Refresh.action"
>>          loadingText="Loading..."
>>          errorText="Unable to load data"&gt;
>>          placeholder text
>>     &lt;/s:div&gt;
>> 
>> 
>> 
>> Refresh action in struts.xml that simply returns SUCCESS and dispatches
>> to
>> UserInfo.jsp:
>> 
>>     &lt;action name="Refresh" class="rpc.RefreshUserInfo"
>> method="execute"&gt;
>>          &lt;result name="success">/includes/UserInfo.jsp&lt;/result&gt;
>>     &lt;/action&gt;
>> 
>> 
>> 
>> UserInfo.jsp which is returned as action result and displayed in the Ajax
>> div on the main page:
>> 
>>     &lt;%@ taglib prefix="s" uri="/struts-tags" %&gt;
>>     &lt;!-- The following tags are parsed and displayed correctly. --&gt;
>>     &lt;s:property value="#session.userInfo.userName" /&gt;,
>> &lt;s:property
>> value="#session.userInfo.authLevelName" /&gt;
>> 
>>     &lt;!-- The following tag is NOT parsed correctly. Displayed is
>> "lbl.logged.in.as" instead of the value set in the package.properties
>> file
>> --&gt;
>>     &lt;s:text name="lbl.logged.in.as"&gt;
>>        &lt;s:param value="#session.userInfo.userName" /&gt;
>>        &lt;s:param value="#session.userInfo.authLevelName" /&gt;
>>     &lt;/s:text&gt;
>> 
>> 
>> 
>> Now, the ajax div loads fine and displays the content of UserInfo.jsp.
>> However, for some reason it fails to parse the &lt;s:text&gt; tag
>> correctly.
>> Instead of reading and printing the value associated with
>> lbl.logged.in.as
>> in the package.property file it simply prints "lbl.logged.in.as". If I
>> put
>> the &lt;s:text&gt; tag directly in my jsp file it works perfectly fine
>> though. I use it at many other places and there is no problem at all.
>> Only
>> when loading the UserInfo.jsp using Ajax it just does not work. Other
>> Struts2 tags like the property tag reading a session variable works fine
>> however.
>> 
>> 
>> 
>> I really don't know what the problem is and how to fix this. I googled
>> for
>> hours but unfortunately didn't find anything helpful. Therefore, I would
>> appreciate any help you guys can provide! Please let me know if you need
>> any
>> further information or if anything is not clear to you.
>> 
>> 
>> Thank you!
>> 
>> Shuk
>> -- 
>> View this message in context:
>> http://www.nabble.com/Problem-with-Ajax-and-%3Cs%3Atext%3E-%28i18n%29-tp20363416p20363416.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> _________________________________________________________________
> Get 5 GB of storage with Windows Live Hotmail.
> http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_5gb_112008
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-Ajax-and-%3Cs%3Atext%3E-%28i18n%29-tp20363416p20367036.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message