Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 16 Feb 2010 04:54:00 -0000 Issue 9006

user-digest-help

2010-02-15


Author LoginPost Reply

user Digest 16 Feb 2010 04:54:00 -0000 Issue 9006

Topics (messages 205022 through 205036):

TypeConverters - multiple fields/values
 205022 by: Andy Sykes

Re: i18n database backed
 205023 by: Lukasz Lenart
 205025 by: CRANFORD, CHRIS
 205026 by: Lukasz Lenart
 205027 by: Lukasz Lenart
 205028 by: CRANFORD, CHRIS
 205029 by: Lukasz Lenart

Re: Struts 2 convention plugin & tiles support
 205024 by: Lukasz Lenart

[Q] JavaTemplate Plugin
 205030 by: Hoying, Ken

[Q] TabbedPanel changes in 2.1.8.1??
 205031 by: Hoying, Ken

Re: JavaTemplate Plugin
 205032 by: Chris Pratt

[Q] Enable Freemarker template caching
 205033 by: Hoying, Ken
 205034 by: Dale Newfield
 205036 by: Wes Wannemacher

javassist problem -- 2.2.0 maven plugin?
 205035 by: Jan T. Kim

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------


Attachment: user_205022.ezm (zipped)
Hi list,

I'm extending the StrutsTypeConverter and writing my own type converter. Is there any way to have the type converter reference multiple fields in order to construct a complex type?

I notice the method signature for convertFromString has three parameters - one of them is a String array of values. Is this a path to having multiple values associated with a single field? That would also provide a way of generating a complex type.

Thanks,
Andy.





Attachment: user_205023.ezm (zipped)
2010/2/12 CRANFORD, CHRIS <Chris.Cranford@(protected)>:
> Anyone have any suggested ways to support i18n internationalization
> backed by a database table rather than property files?

You have to write your own TextProvider - take a look on ActionSupport
implementation to get more details. And then configure it as a bean in
struts.xml


Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl


Attachment: user_205025.ezm (zipped)
Lukasz -

I have configured the bean in struts.xml as follows:

<bean
type="com.opensymphony.xwork2.TextProvider"
name="seek"  
class="com.setech.seek.struts2.i18n.TextProviderSupport"
/>

Aside from configuring this bean with the tag above, is there any other settings or changes I need to make to my struts.xml configuration allowing this provider to be used when I use <s:text/> and getText() methods?

Chris

-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@(protected)]
Sent: Monday, February 15, 2010 12:58 AM
To: Struts Users Mailing List
Subject: Re: i18n database backed

2010/2/12 CRANFORD, CHRIS <Chris.Cranford@(protected)>:
> Anyone have any suggested ways to support i18n internationalization
> backed by a database table rather than property files?

You have to write your own TextProvider - take a look on ActionSupport
implementation to get more details. And then configure it as a bean in
struts.xml


Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)





Attachment: user_205026.ezm (zipped)
W dniu 15 lutego 2010 15:15 użytkownik CRANFORD, CHRIS
<Chris.Cranford@(protected):
> Lukasz -
>
> I have configured the bean in struts.xml as follows:
>
> <bean
>  type="com.opensymphony.xwork2.TextProvider"
>  name="seek"
>  class="com.setech.seek.struts2.i18n.TextProviderSupport"
> />
>
> Aside from configuring this bean with the tag above, is there any other settings or changes
> I need to make to my struts.xml configuration allowing this provider to
> be used when I use <s:text/> and getText() methods?

You have to define your bean as below, to override framework settings:
 <bean type="com.opensymphony.xwork2.TextProvider" name="xwork1"
class="com.setech.seek.struts2.i18n.TextProviderSupport"
scope="default" />
 <bean type="com.opensymphony.xwork2.TextProvider" name="struts"
class="com.setech.seek.struts2.i18n.TextProviderSupport"
scope="default" />

And also, are all your actions base on ActionSupport?


--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl


Attachment: user_205027.ezm (zipped)
W dniu 15 lutego 2010 15:28 użytkownik CRANFORD, CHRIS
<Chris.Cranford@(protected):
> Yes they are.  In fact, all my actions are based on a custom common action called SeekBaseAction which extends ActionSupport.

So, just define TextProvider as mentioned by me and should work!


Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl


Attachment: user_205028.ezm (zipped)
k

-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@(protected)]
Sent: Monday, February 15, 2010 8:38 AM
To: Struts Users Mailing List
Subject: Re: i18n database backed

W dniu 15 lutego 2010 15:28 użytkownik CRANFORD, CHRIS
<Chris.Cranford@(protected):
> Yes they are.  In fact, all my actions are based on a custom common action called SeekBaseAction which extends ActionSupport.

So, just define TextProvider as mentioned by me and should work!


Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)





Attachment: user_205029.ezm (zipped)
W dniu 15 lutego 2010 17:33 użytkownik CRANFORD, CHRIS
<Chris.Cranford@(protected):
> 2.1.6
>
> I cannot move to 2.1.8 yet without impact to a few other things sadly :(.

I made a small mistake, you have to define your own bean and then
define two constants in struts.xml:

<bean class="org.demo.MyTextProvider" name="myTextProvider"
type="com.opensymphony.xwork2.TextProvider"/>

<constant name="struts.xworkTextProvider" value="myTextProvider"/>

if you want to also use your implementation for framework's messages
define another constant (remember to put all framework messages into)
<constant name="system" value="myTextProvider" />

But that will work from version 2.1.7 of xwork (Struts 2.1.8). You can
try to define your own ActionSupport and implement as it is right now
http://svn.opensymphony.com/svn/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java


Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl


Attachment: user_205024.ezm (zipped)
2010/2/14 Peter Nguyen <ppdnguyen@(protected)>:
> I'm currently looking at the Struts 2 Convention plugin for small project as
> a means of zero configuration, however I'm also looking to use tiles for my
> templating. Does anyone know if there's any documentation on supported
> result types for the convention plugin (other than the default
> dispatcher,velocity,freemarker result types) and if Tiles is supported?

All should be supported, you're defining them with annotations
http://struts.apache.org/2.1.6/docs/convention-plugin.html#ConventionPlugin-Resultannotation


Regard
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl


Attachment: user_205030.ezm (zipped)
I would like to make use of the JavaTemplate Plugin in order to improve my applications performance. However, I do have "ajax" themed tags, as well as, some of my own theme tags. I perfectly realize that the any non "simple" theme tags would not be able to take advantage of the performance improvement. However, I cannot seem to get my application to work at all. Does this mean that in order to use this plugin, I can only use the "simple" theme and no other?

Cannot render tag [head] because theme [ajax] was not found. - [unknown location]
    at org.apache.struts2.views.java.JavaTemplateEngine.renderTemplate (JavaTemplateEngine.java:58)
    at org.apache.struts2.components.UIBean.mergeTemplate (UIBean.java:559)
    at org.apache.struts2.components.UIBean.end (UIBean.java:513)
-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.


Attachment: user_205031.ezm (zipped)
I am in the process of upgrading from Struts 2.0.11.1 to 2.1.8.1 and am having some issues with the TabbedPanel.

Previously, I had customized how the TabbedPanel looks by setting the templateCssPath attribute to the location of a CSS file that was a copy of the provided TabContainer.css with my changes. I made a few minor changes which included pointing to different image files with different names. This worked great in 2.0.11.1. However, it does not appear to be working at all in 2.1.8.1.

When I look at the HTTP header in my browser, it does look like the control is attempting to do something with the templateCssPath that I provided. I just cannot tell what. In particular, I notice the following in my HTTP headers when using 2.1.8.1:

68:29:11.823   0.345  800   260   GET   200   text/css                                http://localhost:8180/sca/struts/TabbedPanel.css
68:29:11.961   0.274  823   1186   GET   404   text/html (NS_IMAGELIB_ERROR_NO_DECODER)     http://localhost:8180/sca/static/css/images/tab_left.gif
68:29:12.036   0.222  828   1201   GET   404   text/html (NS_IMAGELIB_ERROR_NO_DECODER)     http://localhost:8180/sca/static/css/images/tab_top_right.gif

If I remove the templateCssPath, I notice the following in my HTTP headers when using 2.1.8.1:

00:00:02.582   0.286  800   260   GET   200   text/css     http://localhost:8180/sca/struts/TabbedPanel.css
00:00:02.687   0.203  845   260   GET   200   image/gif     http://localhost:8180/sca/struts/dojo/src/widget/templates/images/tab_left.gif
00:00:02.770   0.126  850   260   GET   200   image/gif     http://localhost:8180/sca/struts/dojo/src/widget/templates/images/tab_top_right.gif

This is what is looks likes using 2.0.11.1 with the templateCssPath set:

00:00:47.149   0.233  1386   3919   GET   200   text/css     http://localhost:8180/sca/static/css/tabContainerGray.css
00:00:47.526   0.026  1405   518   GET   200   text/html     http://localhost:8180/sca/struts/dojo/src/widget/templates/TabContainer.html
00:00:47.645   0.131  1356   1556   GET   200   image/gif     http://localhost:8180/sca/static/images/gray_tab_left.gif
00:00:47.724   0.062  1361   3318   GET   200   image/gif     http://localhost:8180/sca/static/images/gray_tab_top_right.gif

Am I doing something wrong or is this a bug?

Thanks in advance,
Ken



-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.

Attachment: user_205032.ezm (zipped)
Yes, I believe that is the case. If you use the Java Templates plugin it
switches the Templating Engine to Java. Since there are no themes defined
in the Java Template Engine other than simple, you're out of luck if you
want to mix themed and non-themed content.
(*Chris*)

On Fri, Feb 12, 2010 at 8:06 AM, Hoying, Ken <Ken_Hoying@(protected):

> I would like to make use of the JavaTemplate Plugin in order to improve my
> applications performance. However, I do have "ajax" themed tags, as well
> as, some of my own theme tags. I perfectly realize that the any non
> "simple" theme tags would not be able to take advantage of the performance
> improvement. However, I cannot seem to get my application to work at all.
> Does this mean that in order to use this plugin, I can only use the
> "simple" theme and no other?
>
> Cannot render tag [head] because theme [ajax] was not found. - [unknown
> location]
>     at
> org.apache.struts2.views.java.JavaTemplateEngine.renderTemplate (JavaTemplateEngine.java:58)
>     at
> org.apache.struts2.components.UIBean.mergeTemplate (UIBean.java:559)
>     at org.apache.struts2.components.UIBean.end (UIBean.java:513)
>
>
>
> -----------------------------------------
> ***Note:The information contained in this message may be privileged
> and confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient,
> you are hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited. If you have
> received this communication in error, please notify the Sender
> immediately by replying to the message and deleting it from your
> computer. Thank you. Premier Inc.
>

Attachment: user_205033.ezm (zipped)
I am finding the text regarding the enablement of Freemarker template caching in the performance tuning document (http://struts.apache.org/2.1.8.1/docs/performance-tuning.html) to be a bit confusing.

The document states:
<start clip>
As of Struts 2.0.10, setting the property struts.freemarker.templatesCache to true will enable the Struts internal caching of Freemarker templates. This property is set to false by default.

In Struts versions prior to 2.0.10, you had to copy the /template directory from the Struts 2 jar in your WEB_APP root to utilize Freemarker's built in chaching mechanism in order to achieve similar results.

The built in Freemarker caching mechanism fails to properly cache templates when they are retrieved from the classpath. Copying them to the WEB_APP root allows Freemarker to cache them correctly. Freemarker looks at the last modified time of the template to determine if it needs to reload the templates. Resources retrieved from the classpath have no last modified time, so Freemarker will reload them on every request.
<end clip>

I am confused. Do I or don't I need to copy the Freemarker templates to my WEBAPP to take advantage of the caching? Do I copy them to WEBAPP\template\.. or to WEBAPP\struts\template like with the static content?

Thanks,
Ken



-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.

Attachment: user_205034.ezm (zipped)
Hoying, Ken wrote:
> In Struts versions prior to 2.0.10, you had to copy the /template
> directory from the Struts 2 jar in your WEB_APP root to utilize
> Freemarker's built in chaching mechanism in order to achieve similar
> results.

And I think as a result of following this old advice I've now got older
revisions of many of these files in my app than I would otherwise, which
should probably be listed here as a caveat should this still be the
correct advice.

-Dale


Attachment: user_205036.ezm (zipped)
If you are using struts 2.0.9 or earlier, then you will have to copy
the template directory out of the struts2-core jar file into your
web-app. (Off the top of my head, I can't remember if you copy it to
context-root, context-root/WEB-INF, context-root/WEB-INF/classes, but
I'm sure that's in the docs or online somewhere).

If you are using 2.0.10 or higher, then just set the mentioned value
to true... You can do that by putting this in your struts.xml file -

<constant name="struts.freemarker.templatesCache" value="true" />

-Wes

On Mon, Feb 15, 2010 at 2:33 PM, Hoying, Ken <Ken_Hoying@(protected):
> I am finding the text regarding the enablement of Freemarker template caching in the performance tuning document (http://struts.apache.org/2.1.8.1/docs/performance-tuning.html) to be a bit confusing.
>
> The document states:
> <start clip>
> As of Struts 2.0.10, setting the property struts.freemarker.templatesCache  to true will enable the Struts internal caching of Freemarker templates. This property is set to false by default.
>
> In Struts versions prior to 2.0.10, you had to copy the /template directory from the Struts 2 jar in your WEB_APP root to utilize Freemarker's built in chaching mechanism in order to achieve similar results.
>
> The built in Freemarker caching mechanism fails to properly cache templates when they are retrieved from the classpath. Copying them to the WEB_APP root allows Freemarker to cache them correctly. Freemarker looks at the last modified time of the template to determine if it needs to reload the templates. Resources retrieved from the classpath have no last modified time, so Freemarker will reload them on every request.
> <end clip>
>
> I am confused.  Do I or don't I need to copy the Freemarker templates to my WEBAPP to take advantage of the caching?  Do I copy them to WEBAPP\template\..  or to WEBAPP\struts\template like with the static content?
>
> Thanks,
> Ken
>
>
>
> -----------------------------------------
> ***Note:The information contained in this message may be privileged
> and confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient,
> you are hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited.  If you have
> received this communication in error, please notify the Sender
> immediately by replying to the message and deleting it from your
> computer.  Thank you.  Premier Inc.



--
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!


Attachment: user_205035.ezm (zipped)
Dear All,

I've run into the problem that the javassist package contained in
xwork-2.1.6.jar clashes with the javassist package contained in jboss.
According to https://issues.apache.org/jira/browse/WW-3308 this
problem is fixed in struts 2.2.0. Are there any maven plugins around
that take advantage of this fix already?

If they're not yet available I'd also be interested in a workaround.
I've tried excluding xwork-core but to no avail (possibly due to lack
of maven competence -- RTFAQs etc. welcome).

Best regards, Jan
--
+- Jan T. Kim -------------------------------------------------------+
|         email: j.kim@(protected)                      |
|         WWW:  http://www.cmp.uea.ac.uk/people/jtk         |
*-----=< hierarchical systems are for files, not for humans >=-----*

©2008 gg3721.com - Jax Systems, LLC, U.S.A.