Re: [S2] App generate lot (2GB) of garbage!

2007-06-23 Thread Ing. Andrea Vettori
There are three pages of issues on freemarker... I'll take a look at  
them and see if it's already present.


Thank you

Il giorno 22/giu/07, alle ore 19:17, Antonio Petrelli ha scritto:


Andrea,
please create a JIRA issue for this, and join the discussion at the
Struts Developers list too, if possible:
http://www.nabble.com/-S2--FreeMarker-usage-in-Struts-2-tf3965756.html

Antonio

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Ing. Andrea Vettori
Consulente per l'Information Technology



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] App generate lot (2GB) of garbage!

2007-06-23 Thread Ing. Andrea Vettori


Il giorno 22/giu/07, alle ore 19:20, Musachy Barroso ha scritto:

Yes, freemarker is used by Struts 2 tags to generate html. We could  
have a
property for the cache setting, but, does it solve your problem?  
(you said

it was partially resolved)



Most of the garbage is still there but at least about 400-500 MB  
generated from freemarker classes seems not there anymore.
I tried to use jrockit instead of sun jvm since it has a better  
memory analyzer but I haven't been able to produce a report yet.



May I ask more on how struts2 is using freemarker ?
How is freemarker used in a code snippet like this :

td width=34% valign=bottom class=fontNormale  
align=center

span
s:form name=RicercaArticoliVisOrdina  
action=RicercaArticoliVis
Ordina per s:select list=% 
{listaOrdinamentoArticoli} value=${numeri.ordinamento[0]}  
name=ordinamento onchange=document.RicercaArticoliVisOrdina.submit 
()/
s:hidden name=idRicerca value=$ 
{numeri.idRicerca}/

/s:form
/span
/td
td width=33% valign=bottom class=fontNormale  
align=right

span
s:form name=RicercaArticoliVisDimPagina  
action=RicercaArticoliVis
Mostra s:select list={5, 10, 20, 30}  
value=${numeri.dimPagina} name=dimPagina  
onchange=document.RicercaArticoliVisDimPagina.submit()/ prodotti  
per pagina
s:hidden name=idRicerca value=$ 
{numeri.idRicerca}/

/s:form
/span
/td

What object are created ?

Thanks












regards
musachy

On 6/20/07, Ing. Andrea Vettori [EMAIL PROTECTED] wrote:


I discussed the problem with the freemarker team and I used a
suggestion that PARTIALLY resolved.

They said :

=

You can use the code below to enable the model cache, assuming
myConfiguration is the reference to your Configuration object:

((BeansWrapper)myConfiguration.getObjectWrapper()).setUseCache(true)

and see if it helps you with your GC load levels.

=

This actually seems to happen.
In struts how can this be done ? I used :


 freemarker.template.Configuration fmc =
(freemarker.template.Configuration)
ServletActionContext.getServletContext().getAttribute
(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY);
 if (fmc != null) {
 ((freemarker.ext.beans.BeansWrapper)fmc.getObjectWrapper
()).setUseCache(true);
 }


but I think there must be a configuration somewhere
(struts.properties?).


To completely solve my problem I really need to understand the
following :

How struts uses freemarker ? If i have a jsp page that contains html,
jsp tags, struts tags and jsp EL expression, where freemarker is  
used ?

I suppose that it's used ONLY on struts tags...

So if my page is composed primarly of jsp EL and jsp tags and a few
struts tags can I focus on struts tags only to try to understand why
the app is producing garbage ?


Thank you



Il giorno 19/giu/07, alle ore 12:58, Ing. Andrea Vettori ha scritto:


 Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto:

 2007/6/19, Ing. Andrea Vettori [EMAIL PROTECTED]:

 Moreover I'm not using freemaker in my project! It's struts  
that's

 using it.
 My page are all jsps !!



 This is pretty strange... Is FreeMarker servlet declared in your
 web.xml?

 No it's not.

 I think that freemarker classes are used by struts internally for
 the themes... I use the simple theme.

 I really can't understand what's producing near 2GB of garbage
 every 10 seconds!


 --
 Ing. Andrea Vettori
 Consulente per l'Information Technology



  
-

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


--
Ing. Andrea Vettori
Consulente per l'Information Technology



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Hey you! Would you help me to carry the stone? Pink Floyd


--
Ing. Andrea Vettori
Consulente per l'Information Technology



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] App generate lot (2GB) of garbage!

2007-06-23 Thread Musachy Barroso

Struts 2 uses freemarker to generate the html for the tags, for example for
the form tag this template is used:

http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/form.ftl?view=markup

I was playing with jrockit also and trying to replicate the problem, but it
is kind of hard :). Do you have any testcase, or a page, something that
could help us replicate the problem? I also posted a note on the freemarker
list on how struts configures freemarker, which is on this class:

http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java?view=markup

On that same package there is an StrutsBeanWrapper which is the wrapper used
with freemarker. (I think you asked about it right? memory failing...it is
kind of late :) )

regards
musachy

On 6/23/07, Ing. Andrea Vettori [EMAIL PROTECTED] wrote:



Il giorno 22/giu/07, alle ore 19:20, Musachy Barroso ha scritto:

 Yes, freemarker is used by Struts 2 tags to generate html. We could
 have a
 property for the cache setting, but, does it solve your problem?
 (you said
 it was partially resolved)


Most of the garbage is still there but at least about 400-500 MB
generated from freemarker classes seems not there anymore.
I tried to use jrockit instead of sun jvm since it has a better
memory analyzer but I haven't been able to produce a report yet.


May I ask more on how struts2 is using freemarker ?
How is freemarker used in a code snippet like this :

 td width=34% valign=bottom class=fontNormale
align=center
 span
 s:form name=RicercaArticoliVisOrdina
action=RicercaArticoliVis
 Ordina per s:select list=%
{listaOrdinamentoArticoli} value=${numeri.ordinamento[0]}
name=ordinamento onchange=document.RicercaArticoliVisOrdina.submit
()/
 s:hidden name=idRicerca value=$
{numeri.idRicerca}/
 /s:form
 /span
 /td
 td width=33% valign=bottom class=fontNormale
align=right
 span
 s:form name=RicercaArticoliVisDimPagina
action=RicercaArticoliVis
 Mostra s:select list={5, 10, 20, 30}
value=${numeri.dimPagina} name=dimPagina
onchange=document.RicercaArticoliVisDimPagina.submit()/ prodotti
per pagina
 s:hidden name=idRicerca value=$
{numeri.idRicerca}/
 /s:form
 /span
 /td

What object are created ?

Thanks











 regards
 musachy

 On 6/20/07, Ing. Andrea Vettori [EMAIL PROTECTED] wrote:

 I discussed the problem with the freemarker team and I used a
 suggestion that PARTIALLY resolved.

 They said :

 =

 You can use the code below to enable the model cache, assuming
 myConfiguration is the reference to your Configuration object:

 ((BeansWrapper)myConfiguration.getObjectWrapper()).setUseCache(true)

 and see if it helps you with your GC load levels.

 =

 This actually seems to happen.
 In struts how can this be done ? I used :


  freemarker.template.Configuration fmc =
 (freemarker.template.Configuration)
 ServletActionContext.getServletContext().getAttribute
 (FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY);
  if (fmc != null) {
  ((freemarker.ext.beans.BeansWrapper)fmc.getObjectWrapper
 ()).setUseCache(true);
  }


 but I think there must be a configuration somewhere
 (struts.properties?).


 To completely solve my problem I really need to understand the
 following :

 How struts uses freemarker ? If i have a jsp page that contains html,
 jsp tags, struts tags and jsp EL expression, where freemarker is
 used ?
 I suppose that it's used ONLY on struts tags...

 So if my page is composed primarly of jsp EL and jsp tags and a few
 struts tags can I focus on struts tags only to try to understand why
 the app is producing garbage ?


 Thank you



 Il giorno 19/giu/07, alle ore 12:58, Ing. Andrea Vettori ha scritto:

 
  Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto:
 
  2007/6/19, Ing. Andrea Vettori [EMAIL PROTECTED]:
 
  Moreover I'm not using freemaker in my project! It's struts
 that's
  using it.
  My page are all jsps !!
 
 
 
  This is pretty strange... Is FreeMarker servlet declared in your
  web.xml?
 
  No it's not.
 
  I think that freemarker classes are used by struts internally for
  the themes... I use the simple theme.
 
  I really can't understand what's producing near 2GB of garbage
  every 10 seconds!
 
 
  --
  Ing. Andrea Vettori
  Consulente per l'Information Technology
 
 
 
 
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 

 --
 Ing. Andrea Vettori
 Consulente per l'Information Technology



 -
 To unsubscribe, e-mail: 

Re: [S2] App generate lot (2GB) of garbage!

2007-06-23 Thread Ing. Andrea Vettori


Il giorno 23/giu/07, alle ore 09:19, Musachy Barroso ha scritto:

Struts 2 uses freemarker to generate the html for the tags, for  
example for

the form tag this template is used:

http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/ 
resources/template/simple/form.ftl?view=markup


So struts asks freemarker to generate the html for the struts tag.  
Freemarker looks at the template and outputs the html based on it.  
Freemarker is caching the template in memory to not have to read them  
from the disk every time. Looks similar to what jsp compiler do with  
the difference that jsp tags have hard-coded html and freemarker  
has template based html. Am I right ?


But what's the various BeanWrappers doing in the previous process ?  
It's about the passing of parameters from the struts tag to  
FreeMarker ?
It's the BeanWrappers that was consuming a lot of memory before I  
enabled caching of them.





I was playing with jrockit also and trying to replicate the  
problem, but it
is kind of hard :). Do you have any testcase, or a page, something  
that

could help us replicate the problem?



The jrcmd command that's used to profiling is not working on my  
server :( I posted a question on the bea forum This problem is a  
hell !!! :)


I don't think I can produce a testcase but I try to tell how is the  
application organized (btw you can view the site on  
www.elettrotop.com but don't think this can help to solve the  
problem...).


I have a MaxDB (formerly SAPDB) database that's accessed ONLY through  
EJB3 session beans / entity beans. I'm using JBoss 4.0.5-GA which  
uses Hibernate 3.
The view is composed of struts2 actions, a few servlets producing  
PDFs and images and jsp pages.


All the view logic is inside struts2 actions and they access the  
database using RMI call to stateless and stateful session beans. Now  
it's all inside the same server but this architecture gives me the  
option to separate the web interface (with the option to have more  
than one web server) from the business logic (maybe on another  
server) and the database (maybe on another server).


I've implemented a lot of caching of (mostly read-only) database data  
in the struts actions but the profiler says that less than 100MB are  
used by my classes. Also the cache lasts at least a Session life so  
it can't be part of the 2GB that's collected since this happens every  
10 seconds or less (using sun jvm). I've checked I don't have  
_unfortunately_ a lot sessions that dies every 10 seconds :)


Most used page of the site is the product listings where the user can  
browse an in ram list of dataobjects created with an ejb3 query in  
a session bean. The entire list is returned and cached for struts2  
action as said above.


When I first profiled the app, the most ram demanding classes was  
freemarker.ext.beans. generated HashMaps (between 400 and 500 mb).



--
Ing. Andrea Vettori
Consulente per l'Information Technology



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] App generate lot (2GB) of garbage!

2007-06-23 Thread Guillaume Carré

2007/6/23, Ing. Andrea Vettori [EMAIL PROTECTED]:

So struts asks freemarker to generate the html for the struts tag.
Freemarker looks at the template and outputs the html based on it.
Freemarker is caching the template in memory to not have to read them
from the disk every time.


freemarker caches the templates only if there are in the WEB_APP root,
have you copied the /template directory from the struts2 jar there?

see: http://struts.apache.org/2.x/docs/performance-tuning.html
--
Guillaume Carré

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] App generate lot (2GB) of garbage!

2007-06-23 Thread Ing. Andrea Vettori

yes the templates are into

WEB-INFO/templates


Il giorno 23/giu/07, alle ore 11:28, Guillaume Carré ha scritto:


2007/6/23, Ing. Andrea Vettori [EMAIL PROTECTED]:

So struts asks freemarker to generate the html for the struts tag.
Freemarker looks at the template and outputs the html based on it.
Freemarker is caching the template in memory to not have to read them
from the disk every time.


freemarker caches the templates only if there are in the WEB_APP root,
have you copied the /template directory from the struts2 jar there?

see: http://struts.apache.org/2.x/docs/performance-tuning.html
--
Guillaume Carré

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Ing. Andrea Vettori
Consulente per l'Information Technology



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



S2: updownselect

2007-06-23 Thread Scott Nesbitt


I am using the updownselect tag and things are almost
working perfectly.  Once I switched to a s:form it
sends the sorted list to the server, but the select
gets refreshed on the screen and scrolled to the
bottom despite the fact that it is not in a refreshing
div.

Has anybody else run into this?

Currently using Struts 2.0.6.

Thanks,

Scott

(Reposting this after reading about hijacking topics)


  

Shape Yahoo! in your own image.  Join our Network Research Panel today!   
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Hibernate and S2

2007-06-23 Thread Mansour

Jeromy Evans wrote:

Mansour wrote:


An alternative approach is that you don't allow persistent entities 
to be modified within your actions whatsoever and all updates are 
applied behind a service layer that performs reattachment and updates.
How do I do this (reattachment and updates)? Assuming I have a very 
big and complex entities.
The most appropriate approach depends mainly on the complexity of 
your entities and the separation of concerns you require.


OK, that's what I have in my business layer. Tere's a facade for my 
business layer. The actions can obtain a reference to this facade 
through the session by implemeting SessionAware.



In this case, at the layer interface you would manually transfer the 
relevant content of the persistent entities to simple beans created 
especially for the use-case.  Your actions use the beans, not the 
entities.  Updates from the beans are manually applied by your code to 
the persistent entities behind the layer (load, apply changes 
manually, persist).  These simple beans are sometimes called Data 
Transfer Objects (DTOs), and by manually I mean you have to write code 
to explicitly apply the conversion and updates to and from the simple 
beans and persistent entities.  
This is exactly what I was trying to avoid doing in the first place. The 
way my code works now is by taking the bean from the view and pass it to 
the business facade, where it over writes only the properties that have 
changed. But again, what If I have complex Entities. On the other hand, 
this approach forces you to consider the view when you are working in 
your model, so you have to keep in mind that this properties are 
populated by the view and it's (IMHO) against the pattern of DAO, where 
you use only object (DTO) to communicate between different layers of the 
system. In this approach we are really using properties (fields) that 
are wrapped in an object.
The way I want to do it, is to totally separate the layers, so if I 
needed to update or modify different fields in the future, I shouldn't 
touch the business layer, as this is not really a change in the 
functionality. Makes sense?


I think the approach you gave me earlier is the best in this case, which 
is to use the preparable. Any advice or comments or tutorial about how 
to use preparable in this scenario?



This comes at great cost in terms of the amount of code and testing 
required as well as processing performance compared to the other 
approach. The advantage is that the layer can provide strict 
constraints on how data can be viewed and updated (good security), 
your business layer is COMPLETELY distinct and independent of the view 
(good when you have large teams or multiple views) and the business 
layer can easily be distributed (remote and/or clustered services).  
That's essentially the basis of EJB.  If you ever use GWT you'll also 
take the same approach.  I stress though, that's a lot more effort and 
the additional cost is not appropriate in most web applications.

Glad I could help,
Jeromy Evans



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Nested Struts

2007-06-23 Thread Asaf Paris Mandoki

I've already got the action tag working but what I really need is to
call an action from inside an action class.

What I'm trying to do is a web application that aggregates a set
sub-applications.

My plan is that the main application will process the
HttpServletRequest which can contain requests intended for many
sub-applications. This processing will create a HttpServletRequest for
each sub-application and then forward the request to the
sub-application that should receive it. After that, I want to
Include the executed result of each sub-application into a JSP that
will spatially organize all these results.

Is what i'm trying to do appropriate for the Struts 2 architecture?

How should I call the actions of the sub applications?

How should I include the executed results onto my main JSP?

Thanks in advance
Asaf



On 6/20/07, Martin Gainty [EMAIL PROTECTED] wrote:

can you associate a name with the compiled Java class? e.g.
action name=actionTagAction1 class=tmjee.testing.ActionTagAction
executeResult=true id=HtmlID

http://struts.apache.org/2.0.6/docs/action.html

?
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message -
From: Asaf Paris Mandoki [EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Wednesday, June 20, 2007 8:20 PM
Subject: Re: Nested Struts


 Is there a way to use the s:action tag to call actions of other
 webapps deployed on the same container?

 Is there a way to get the result of an action from inside another action
 class?

 On 6/20/07, Asaf Paris Mandoki [EMAIL PROTECTED] wrote:
 I'm trying to make a web application that organizes a bunch of
 widgets. I want each widget to be programmed using struts and have
 it's own struts.xml. Each widget should be packed as a war file.

 I was told on an older thread that I could use a different name space
 for each widget and also that I could use the action tag to call the
 actions on each widget.

 My question is how should I deploy my Widgets? Should I do it as
 regular web applications?

 Thanks in advance ,
 Asaf


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



extending a template

2007-06-23 Thread Mansour

Hello every one:
I couldn't find an answer to this simple question on struts doc site.
I need to modify the template for the submit button and remove the tr 
tag surrounding it in ajax theme.
I extracted submit.ftl from struts jar (I am using 2.0.6). Did the 
modification I need, and now can not refrence it from my JSP. I tried 
using template and templateDir attributes but no luck.


The modified template file is in /template/ajax/submit.ftl of my WEBAPP 
ROOT. Then I moved this directory to WEB-INF and no luck.


I tried this template=/template/ajax/submit.ftl and tried 
templateDir=/template/ajax and templateDir=template but no luck.


can some one point out, how to do this.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



autocompleter help

2007-06-23 Thread Pedro Herrera

Hi,
  In the struts-showcase is showed an example of autocomplete.

http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/autocompleter/index.jsp

 When the user changes the first combo(color or fruits) , the second combo
is changed (apple, banana,ect) too.
I need an example for the second combo be filled with names and keys too.
How I do this with autocomplete? What I need to change in options.ftl ??

Thanks 

Herrera 
(Strus2.0.8)
-- 
View this message in context: 
http://www.nabble.com/autocompleter-help-tf3971137.html#a11272073
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Submitting a form with ajax submit inside the form

2007-06-23 Thread Mansour
From the documentation 
http://struts.apache.org/2.0.8/docs/ajax-tags.html#AjaxTags-submitTag


If the submit button is used inside a form (href is not required on this 
case), the form will be submitted asynchronously:


This is note true. It can never submit from inside a form. This will 
never anything. It will never make any thing. I am using 2.0.6


s:iterator value=taskList status=stat id=row

s:form action=updateTask id=form_${id}
   s:if test=#stat.odd == true
   tr class=odd
   /s:if
   s:else
   tr class=even
   /s:else

   div id=DIV_${id}
   td
   s:textfield value=${id} name=task.id /
   /td

   td
   s:submit theme=ajax  /
   /td
  
   /div

   /tr
/s:form
/s:iterator






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]