Author Login
Post Reply
user Digest 24 Feb 2010 07:13:47 -0000 Issue 9011
Topics (messages 205104 through 205125):
Re: ajax validation with IE8
205104 by: Lukasz Lenart
205106 by: Stephen Ince
205107 by: Stephen Ince
205108 by: Stephen Ince
S2 JSON Plugin problem with encoding
205105 by: Néstor Boscán
Custom Window State Struts2 Portlet
205109 by: Ricardo Jorge
server side validation using GWT
205110 by: loucat
DisplayTag and Internationalization Lookups
205111 by: CRANFORD, CHRIS
205112 by: Lukasz Lenart
205113 by: CRANFORD, CHRIS
205115 by: Lukasz Lenart
Re: How struts2 supports "optgroup"?
205114 by: Felipe Lorenz
checkbox array
205116 by: lucas owen
205117 by: Robert Graf-Waczenski
205118 by: Tatiyana Tarabara
205119 by: lucas owen
Format Currency
205120 by: CRANFORD, CHRIS
205121 by: Cimballi
problem with the site docs - Bad link to the Struts 2 Wiki.
205122 by: Greg Lindholm
205125 by: Lukasz Lenart
Displaytag
205123 by: CRANFORD, CHRIS
Can one override the struts rest plugin DefaultContentTypeHandlerManager?
205124 by: Stephen Huenneke
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_205104.ezm (zipped)2010/2/21 Stephen Ince <stephenpince@(protected)>:
> Okay I found the problem. I find it hard to believe that anyone is
> using css_xhtml theme with this bug. It doesn't work in IE8 and it
> does not work properly in any other browser.
>
> problem
> struts/css_xhtml/validation.js: function findWWCtrlNode needed to be rewritten.
>
> function findWWCtrlNode(enclosingDiv) {
> var elems = enclosingDiv.getElementsByTagName("div");
> for(i = 0; i < elems.length; ++i ) {
> if (elems[i].className && elems[i].className.match(/(wwlbl|wwctrl)/))
> return elems[i];
> }
>
> elems = enclosingDiv.getElementsByTagName("span");
> for(i = 0; i < elems.length; ++i ) {
> if (elems[i].className && elems[i].className.match(/(wwlbl|wwctrl)/))
> return elems[i];
> }
> return enclosingDiv.getElementsByTagName("span")[0];
> }
Could you register that bug?
https://issues.apache.org/jira/browse/WW
Thanks in advance
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

Attachment:
user_205106.ezm (zipped)Here is the link.
https://issues.apache.org/jira/browse/WW-3393
On Mon, Feb 22, 2010 at 1:05 AM, Lukasz Lenart
<lukasz.lenart@(protected):
> 2010/2/21 Stephen Ince <stephenpince@(protected)>:
>> Okay I found the problem. I find it hard to believe that anyone is
>> using css_xhtml theme with this bug. It doesn't work in IE8 and it
>> does not work properly in any other browser.
>>
>> problem
>> struts/css_xhtml/validation.js: function findWWCtrlNode needed to be rewritten.
>>
>> function findWWCtrlNode(enclosingDiv) {
>> var elems = enclosingDiv.getElementsByTagName("div");
>> for(i = 0; i < elems.length; ++i ) {
>> if (elems[i].className && elems[i].className.match(/(wwlbl|wwctrl)/))
>> return elems[i];
>> }
>>
>> elems = enclosingDiv.getElementsByTagName("span");
>> for(i = 0; i < elems.length; ++i ) {
>> if (elems[i].className && elems[i].className.match(/(wwlbl|wwctrl)/))
>> return elems[i];
>> }
>> return enclosingDiv.getElementsByTagName("span")[0];
>> }
>
> Could you register that bug?
> https://issues.apache.org/jira/browse/WW
>
>
> Thanks in advance
> --
> Ł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_205107.ezm (zipped)Does anyone know how I can I patch /struts/css_xhtml/validation.js? I
tried replacing template/css_xhtml/validation.js in struts-core but
that does not seem to work.
I added in my own validation.js to the end of the file but I don't
like this solution.
Steve
On Mon, Feb 22, 2010 at 5:52 AM, Stephen Ince <stephenpince@(protected):
> Here is the link.
> https://issues.apache.org/jira/browse/WW-3393
>
> On Mon, Feb 22, 2010 at 1:05 AM, Lukasz Lenart
> <lukasz.lenart@(protected):
>> 2010/2/21 Stephen Ince <stephenpince@(protected)>:
>>> Okay I found the problem. I find it hard to believe that anyone is
>>> using css_xhtml theme with this bug. It doesn't work in IE8 and it
>>> does not work properly in any other browser.
>>>
>>> problem
>>> struts/css_xhtml/validation.js: function findWWCtrlNode needed to be rewritten.
>>>
>>> function findWWCtrlNode(enclosingDiv) {
>>> var elems = enclosingDiv.getElementsByTagName("div");
>>> for(i = 0; i < elems.length; ++i ) {
>>> if (elems[i].className && elems[i].className.match(/(wwlbl|wwctrl)/))
>>> return elems[i];
>>> }
>>>
>>> elems = enclosingDiv.getElementsByTagName("span");
>>> for(i = 0; i < elems.length; ++i ) {
>>> if (elems[i].className && elems[i].className.match(/(wwlbl|wwctrl)/))
>>> return elems[i];
>>> }
>>> return enclosingDiv.getElementsByTagName("span")[0];
>>> }
>>
>> Could you register that bug?
>> https://issues.apache.org/jira/browse/WW
>>
>>
>> Thanks in advance
>> --
>> Ł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_205108.ezm (zipped)IE8 is a little stubborn, you have to delete temporary files.
On Mon, Feb 22, 2010 at 6:12 AM, Stephen Ince <stephenpince@(protected):
> Does anyone know how I can I patch /struts/css_xhtml/validation.js? I
> tried replacing template/css_xhtml/validation.js in struts-core but
> that does not seem to work.
> I added in my own validation.js to the end of the file but I don't
> like this solution.
>
> Steve
>
>
> On Mon, Feb 22, 2010 at 5:52 AM, Stephen Ince <stephenpince@(protected):
>> Here is the link.
>> https://issues.apache.org/jira/browse/WW-3393
>>
>> On Mon, Feb 22, 2010 at 1:05 AM, Lukasz Lenart
>> <lukasz.lenart@(protected):
>>> 2010/2/21 Stephen Ince <stephenpince@(protected)>:
>>>> Okay I found the problem. I find it hard to believe that anyone is
>>>> using css_xhtml theme with this bug. It doesn't work in IE8 and it
>>>> does not work properly in any other browser.
>>>>
>>>> problem
>>>> struts/css_xhtml/validation.js: function findWWCtrlNode needed to be rewritten.
>>>>
>>>> function findWWCtrlNode(enclosingDiv) {
>>>> var elems = enclosingDiv.getElementsByTagName("div");
>>>> for(i = 0; i < elems.length; ++i ) {
>>>> if (elems[i].className && elems[i].className.match(/(wwlbl|wwctrl)/))
>>>> return elems[i];
>>>> }
>>>>
>>>> elems = enclosingDiv.getElementsByTagName("span");
>>>> for(i = 0; i < elems.length; ++i ) {
>>>> if (elems[i].className && elems[i].className.match(/(wwlbl|wwctrl)/))
>>>> return elems[i];
>>>> }
>>>> return enclosingDiv.getElementsByTagName("span")[0];
>>>> }
>>>
>>> Could you register that bug?
>>> https://issues.apache.org/jira/browse/WW
>>>
>>>
>>> Thanks in advance
>>> --
>>> Ł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_205105.ezm (zipped)Hi
I'm using the JSON Plugin. My JSP pages are stored in ISO-8859-1 format.
When I deploy the application on the production server JSON Plugin sends the
JSON Page with UTF-8 encoding but the content type says application/json;
charset=iso-8859-1. So the page is rendered with problems for accented
characters.
Regards,
Néstor Boscán

Attachment:
user_205109.ezm (zipped)Hello.
I'm using Liferay portal to develop a portlet using struts 2. I need to use
a custom Liferay Window State called exclusive to generate a URL. This
allows me to make AJAX calls and return only the result generated by the
action. I have added the <custom-window-state> tag to my portlet.xml
I tried
<s:url windowState="exclusive" action="moreinformation">
<s:param name="id" value="resourceId" />
</s:url>
but the windowState in the URL always ends up being 'normal' (I presume this
is the default). I did a quick look through the Struts2 code but I couldn't
find the place where this default value was processed (I will look in more
detail later).
I also tried
<portlet:actionURL windowState="exclusive">
<portlet:param name="struts.portlet.action"
value="/gdocs/moreinformation" />
<portlet:param name="id" value="---------------------" />
</portlet:actionURL>
and it works but I need to add a dynamic parameter (id) from the Value Stack
(I'm using s:iterator) but I have no idea how to put it there. <s:property>
doesn't work, using %{} or ${} doesn't work either.
Finally, I solved this problem the following way
<portlet:actionURL windowState="exclusive">
<portlet:param name="struts.portlet.action"
value="/gdocs/moreinformation" />
</portlet:actionURL>&<portlet:namespace />id=<s:property
value="resourceId" />
but it feels kind of hackish and I think that there has to be a better way.
Any suggestions?
Best Regards,
Ricardo

Attachment:
user_205110.ezm (zipped)Hi everybody,
I'm developing a web application with GWT and I was supposed to do the
server side validation with struts2.
I've read that the integration of GWT and struts2 is not so easy, in fact
I've used gwtstruts2plugin but actually I'm not using it and I still don't
know how to match widget and stuff like that with struts2, using the xml
files. I don't use struts2 tag libraries so how can I tell the validator
what widget (a text area for example) or field it should handle with?
I'm quite a newbie... I don't know if there are other validation methods in
struts2, I read something about annotations but I'd like just a normal
library with java methods I could use...
Do you have some tips for this purpose?
Any link to a tutorial or something like that?
I only find something related to tag libraries...
Thanks in advance
lou

Attachment:
user_205111.ezm (zipped)I am using the DisplayTag library with Struts2. In the
displaytag.properties file, I had to specify a property as follows:
Locale.provider=com.setech.displaytag.I18nWebworkAdapter
This class contains the following method:
ublic String getResource(String resourceKey, String defaultValue, Tag
tag,
PageContext pageContext)
{
String key = (resourceKey != null) ? resourceKey : defaultValue;
String msg = null;
ValueStack stack = TagUtils.getStack(pageContext);
Iterator iterator = stack.getRoot().iterator();
while(iterator.hasNext()) {
Object o = iterator.next();
if(o instanceof TextProvider) {
TextProvider textProvider = (TextProvider) o;
msg = textProvider.getText(key, null, (String)null);
if(msg != null) break;
}
}
if(msg==null && resourceKey != null) {
msg = "???" + key + "???";
log.debug(Messages.getString("Localization.missingkey",resourceKey));
}
return(msg);
}
This method works excellent if the key is detected for the current
locale of the browser; however the text provider does not fall back to
the default values should a key not be found within the current locale.
For example, if de_DE is my present Locale yet no key exists in the
property file for the message yet it exists in en_US, I would want the
en_US value to be displayed.
The normal text provider concept in Struts2 behaves this way; however I
am not sure why the TextProvider above does not.
The iterator finds two providers in the stack:
com.setech.seek.struts2.action.SearchPurchaseOrdersAction
com.opensymphony.xwork2.DefaultTextProviderThoughts?
Chris

Attachment:
user_205112.ezm (zipped)Maybe it's related to that
https://issues.apache.org/jira/browse/WW-3219
Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

Attachment:
user_205113.ezm (zipped)Actually it isn't that.
We actually manage our internationalization in applicationMessage_en and
our build script performs a copy of this file to applicationMessages.
This should prevent what you're referring to.
Lets say our table column key is 'page.mytable.header.ponumber'. This
key is defined in our applicationMessages_en property file but it is not
in the applicationMessages_de file.
When a user logs into the application using a locale of de_DE, the
standard s:text and other tags take the lookup values from the en
property file as it should; however, my code snippet earlier does not.
It simply says it cannot find the key.
Expectation is the following:
en file:
--------
page.mytable.header.ponumber=PO Number
de file:
--------
# page.mytable.header.ponumber does not exist
jsp file:
---------
<display:column titleKey="page.mytable.header.ponumber" />
Regardless of the Locale in the browser, I would expect this column to
be shown with "PO Number" and not "PO Number" for English and showing
the key value for the German locale.
Chris
-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@(protected)]
Sent: Monday, February 22, 2010 10:10 AM
To: Struts Users Mailing List
Subject: Re: DisplayTag and Internationalization Lookups
Maybe it's related to that
https://issues.apache.org/jira/browse/WW-3219

Attachment:
user_205115.ezm (zipped)2010/2/22 CRANFORD, CHRIS <Chris.Cranford@(protected)>:
> Thoughts?
Maybe that?
http://www.mail-archive.com/displaytag-devel@(protected)
Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

Attachment:
user_205114.ezm (zipped)???? Nobody can help me?
On Wed, Feb 10, 2010 at 10:13 AM, Felipe Lorenz <felipe.lorenz@(protected):
> Im sory, but the example at http://struts.apache.org/2.1.8.1/docs/optgroup
> .html is very simple. Dont have a real example...
>
> But anyway... Im trying to use s:optgroup without success..
>
> Here is how I did without struts tag:
>
> <select name="despesa.projeto.codigo">
> <s:iterator value="projetos">
> <s:if test="%{projetoCollection.size > 0}">
> <optgroup label="<s:property value="descricao" />">
> <s:iterator value="projetoCollection">
> <option value="<s:property value="codigo"/>"><s:property
> value="descricao"/></option>
> </s:iterator>
> </optgroup>
> </s:if>
> </s:iterator>
> </select>
>
> And here is how im trying to do:
>
> <s:select name="despesa.projeto.codigo" list="projeto">
> <s:optgroup label="%{descricao}" list="projetoCollection"
> listKey="codigo" listValue="descricao"/>
> </s:select>
>
> But the result I want something like this:
>
> <select name="despesa.projeto.codigo">
> <optgroup label="Blabla">
> <option value="53">Blabla</option>
> </optgroup>
> <optgroup label="IDEALOGIC">
> <option value="3">Assessoria de Comunicação</option>
> <option value="8">Capacitação de Clientes</option>
> <option value="11">Instalação/Manutenção servidor
> Idealogic</option>
> <option value="5">Prospecção</option>
> <option value="7">Prova de Conceito</option>
> <option value="2">Rotinas Administrativas</option>
> <option value="6">Visita Técnica</option>
> </optgroup>
> <optgroup label="OUTROS CLIENTES">
> <option value="31">Blabla</option>
> <option value="24">Blabla</option>
> <option value="51">Blabla</option>
> <option value="23">Blabla</option>
> <option value="30">Blabla</option>
> <option value="25">Blabla</option>
> <option value="32">Blabla</option>
> <option value="50">Blabla</option>
> </optgroup>
> </select>
>
> Thks.
>
>
>
> On Tue, Jan 12, 2010 at 7:39 PM, Gabriel Belingueres <
> belingueres@(protected):
>
>> http://struts.apache.org/2.1.8.1/docs/optgroup.html
>>
>> 2010/1/12 Emi Lu <emilu@(protected)>:
>> > Good afternoon,
>> >
>> > Could someone tell me how struts2 support "optgroup" please?
>> >
>> > Thanks a lot!
>> > --
>> > Lu Ying
>> >
>> >
>> > <select>
>> > <optgroup label="Australia">
>> > <option value ="sydney">Sydney</option>
>> > <option value ="melbourne">Melbourne</option>
>> > </optgroup>
>> > <optgroup label="New Zealand">
>> > <option value ="cromwell">Cromwell</option>
>> > <option value ="queenstown">Queenstown</option>
>> > </optgroup>
>> > </select>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@(protected)
>> > For additional commands, e-mail: user-help@(protected)
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
> --
> Felipe A. Lorenz
> Idealogic Software
> http://www.idealogic.com.br
>
--
Felipe A. Lorenz
Idealogic Software
http://www.idealogic.com.br

Attachment:
user_205116.ezm (zipped)Hi struts users,
I'm working with a checkbox array; the problem is that it doesn't work as a
single checkbox: I can't have the checkbox array with all checkboxes
unchecked (apart from the beginning)
Example:
I check checkbox1.
I check checkbox2.
I uncheck checkbox2 --> OK
I uncheck checkbox1 --> checkbox1 doesnt get unchecked
Is this working as normal or I'm performing wrong???
Thanks in advance
Peter

Attachment:
user_205117.ezm (zipped)lucas owen schrieb:
> Hi struts users,
>
> I'm working with a checkbox array; the problem is that it doesn't work as a
> single checkbox: I can't have the checkbox array with all checkboxes
> unchecked (apart from the beginning)
>
> Example:
>
> I check checkbox1.
> I check checkbox2.
> I uncheck checkbox2 --> OK
> I uncheck checkbox1 --> checkbox1 doesnt get unchecked
>
> Is this working as normal or I'm performing wrong???
>
> Thanks in advance
> Peter
>
>
This should work correctly out of the box with Struts2 because there are
interceptors and hidden parameters that work the magic for you. In
Struts1, there is no such magic and the behavior you describe is normal
because if none of the checkboxes is checked, then the resulting browser
request does not contain the corresponding request parameters *at all*,
meaning that your server-side state is unchanged. Solution: Implement
the ActionForm.reset() method to deal with this properly, i.e. reset
your form values to null (or whatever) when the request parameters are
missing.
Robert

Attachment:
user_205118.ezm (zipped)Voviya,
Could you please pick up Nadika from horse riding at 7:30 p.m. today?
A ya popletus' v Majer.
T.
Robert Graf-Waczenski wrote:
> lucas owen schrieb:
>> Hi struts users,
>>
>> I'm working with a checkbox array; the problem is that it doesn't work
>> as a
>> single checkbox: I can't have the checkbox array with all checkboxes
>> unchecked (apart from the beginning)
>>
>> Example:
>>
>> I check checkbox1.
>> I check checkbox2.
>> I uncheck checkbox2 --> OK
>> I uncheck checkbox1 --> checkbox1 doesnt get unchecked
>>
>> Is this working as normal or I'm performing wrong???
>>
>> Thanks in advance
>> Peter
>>
>>
> This should work correctly out of the box with Struts2 because there are
> interceptors and hidden parameters that work the magic for you. In
> Struts1, there is no such magic and the behavior you describe is normal
> because if none of the checkboxes is checked, then the resulting browser
> request does not contain the corresponding request parameters *at all*,
> meaning that your server-side state is unchanged. Solution: Implement
> the ActionForm.reset() method to deal with this properly, i.e. reset
> your form values to null (or whatever) when the request parameters are
> missing.
>
> Robert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_205119.ezm (zipped)mmm I'm using Struts 2 (struts2-core-2.1.6) and the last checkbox (of a
checkbox array) doesn't get unchecked, as I have previously commented...
WHY?
It seems it has to be always selected one of the checkboxes at least
2010/2/23 Robert Graf-Waczenski <rgw@(protected)>
> lucas owen schrieb:
>
> Hi struts users,
>>
>> I'm working with a checkbox array; the problem is that it doesn't work as
>> a
>> single checkbox: I can't have the checkbox array with all checkboxes
>> unchecked (apart from the beginning)
>>
>> Example:
>>
>> I check checkbox1.
>> I check checkbox2.
>> I uncheck checkbox2 --> OK
>> I uncheck checkbox1 --> checkbox1 doesnt get unchecked
>>
>> Is this working as normal or I'm performing wrong???
>>
>> Thanks in advance
>> Peter
>>
>>
>>
> This should work correctly out of the box with Struts2 because there are
> interceptors and hidden parameters that work the magic for you. In Struts1,
> there is no such magic and the behavior you describe is normal because if
> none of the checkboxes is checked, then the resulting browser request does
> not contain the corresponding request parameters *at all*, meaning that your
> server-side state is unchanged. Solution: Implement the ActionForm.reset()
> method to deal with this properly, i.e. reset your form values to null (or
> whatever) when the request parameters are missing.
>
> Robert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_205120.ezm (zipped)I have added a format to my messages resource bundle as follows:
format.currency={0,number,currency}
Then I use this in my JSP
<s:text name='format.currency"><s:param name="value"
value="%{bean.unitCost}"/></s:text>
When Locale = en_US, I get 125.34 shown however when my Locale is de_DE
I get 125.34 ?. Why does it show the "?" and how do I adjust this to
show the Euro symbol or the US Dollar symbol when under en_US ?

Attachment:
user_205121.ezm (zipped)Not sure at 100%, but should be a problem of encoding. What's the
encoding of your page ?
Cimballi
On Tue, Feb 23, 2010 at 12:44 PM, CRANFORD, CHRIS
<Chris.Cranford@(protected):
> I have added a format to my messages resource bundle as follows:
>
> format.currency={0,number,currency}
>
> Then I use this in my JSP
>
> <s:text name='format.currency"><s:param name="value"
> value="%{bean.unitCost}"/></s:text>
>
> When Locale = en_US, I get 125.34 shown however when my Locale is de_DE
> I get 125.34 ?. Why does it show the "?" and how do I adjust this to
> show the Euro symbol or the US Dollar symbol when under en_US ?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_205122.ezm (zipped)Bad link to the Struts 2 Wiki.
On page http://struts.apache.org/2.x/docs/home.html
Scroll down to Quick Links:
The link name "Struts 2 Wiki space" doesn't work.
It is pointed to
http://struts.apache.org/2.x/S2WIKI/welcome-to-apache-struts2.html
where the earlier link above is pointed to
http://cwiki.apache.org/S2WIKI/home.html which works.
I got permission denied when I tried to edit it.

Attachment:
user_205125.ezm (zipped)2010/2/23 Greg Lindholm <greg.lindholm@(protected)>:
> Bad link to the Struts 2 Wiki.
>
> On page http://struts.apache.org/2.x/docs/home.html
>
> Scroll down to Quick Links:
> The link name "Struts 2 Wiki space" doesn't work.
> It is pointed to
> http://struts.apache.org/2.x/S2WIKI/welcome-to-apache-struts2.html
> where the earlier link above is pointed to
> http://cwiki.apache.org/S2WIKI/home.html which works.
>
> I got permission denied when I tried to edit it.
Thanks for reporting, solved! You can see change here [1]
[1] http://cwiki.apache.org/confluence/display/WW/Home
Best regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

Attachment:
user_205123.ezm (zipped)Anyone had any issues with displaytag giving you empty export pages? It
works fine within the Struts2 web page but for whatever reason, I get
blank CSV and Excel outputs.

Attachment:
user_205124.ezm (zipped)I'm having a rather particular problem with heap space and the
DefaultContentTypeHandlerManager in the struts rest plugin. I've got a
model driven rest controller with a few different methods that return rather
large result sets and it's causing heap space issues when the content type
handler tries to create a json string out of the result array. I traced the
problem through to when the content type handler being passed a StringWriter
object to output to, eventually it tries to resize some internal
representation of the string and we get a heap space error. I'd prefer to
write directly to the response output stream and not have the whole response
string buffered in memory. So, I wrote my own extension of
DefaultContentTypeHandlerManager that will pass my custom JSON content
handler the response stream instead of a StringWriter. All seems well,
except that I can't seem to find a way to override the class type of the
ContentTypeHandlerManager. Here's my struts.xml:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.convention.package.locators" value="leadsService"/>
<constant name="struts.convention.action.suffix" value="Controller"/>
<constant name="struts.convention.action.mapAllMatches" value="true"/>
<constant name="struts.convention.default.parent.package"
value="rest-default"/>
<constant name="struts.convention.result.path" value="/WEB-INF/templates/"
/>
<constant name="struts.rest.defaultExtension" value="json" />
<bean name="myJson"
type="
org.apache.struts2.rest.handler.ContentTypeHandler"
class="com.myCode.LeadsJsonHandler" />
<bean type="
org.apache.struts2.rest.ContentTypeHandlerManager"
class="com.myCode.MyContentTypeHandlerManager" />
</struts>
And my struts.properties:
struts.rest.handlerOverride.json=myJson
Is it even possible to override the ContentTypeHandlerManager? When I try
to setup the bean in struts.xml as above, it just dies and throws this
error:
Caused by: Bean type interface
org.apache.struts2.rest.ContentTypeHandlerManager with the name default has
already been loaded by [unknown location] - bean -
file:/home/user/myCode/trunk/target/classes/struts.xml:12:142
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register (
XmlConfigurationProvider.java:205)
A quick grep of the source has yielded me nothing so far, but any help in
the right direction to look would be most appreciated.
Thank you,
Stephen Huenneke