Re: field value causing NumberFormatException and breaking Action

2010-10-15 Thread Kushan Jayathilake
Nabeel,

If your text field name is customerName then you have to have a property in
your action class called "String customerName" and also there should be a
getter and setter for this property. When the form is submitted Struts
framework will call the setter to set the value to the property and you can
use getter to access the property value. Do the conversion in the action
class.that's more easy.

Regards
Kushan Jayathilake

On 15 Oct 2010 20:55, "Nabeel Saad"  wrote:

Hello folks,

I'm working on a project to upgrade a JBoss Portal community platform to a
supported version of JBoss Enterprise Portal Platform.

During the process, I've gotten the platform building and functioning mostly
normally.  I have one issue that is completely blocking me for the moment.
 There is a portlet that pretty much searches for users that is currently
failing.  All you do is fill in a form (a dropdown [called searchType] with
the type of data your are providing - username, address, card number, etc...
- the value for that data and a post code) and it searches for the user and
returns the results of the search.

However, when I click on the search button, I get re-directed to the search
page and the attached "debug_stack_trace" is thrown in the JBoss console.
 What I've understood from the trace and from my research and testing, is
that the dropdown field searchType is returning data that is breaking its
conversion into a number, thus the NumberFormatException.

Method "setSearchType" failed for object
com.client.user.search.action.searchcustomeract...@5524c895[java.lang.nosuchmethodexception:
setSearchType([Ljava.lang.String;)]

This error does make sense because it's trying to assign the value of
searchType to the field in the class; however, searchType is actually
expected to be an int, and somehow it's receiving a String or the fact that
it's failing to convert it to a Number, then it says I can't find a method
that takes String for setSearchType...

I ran through the code, and was able to find exactly where it broke.  In
OgnlTypeConverterWrapper.convertValue the method returns
"ognl.NoConversionPossible" which causes OgnlRuntime.getConvertedTypes to
return false.

Clearly xwork is not able to convert my property, the last two lines before
the NumberFormatException are:

[XWorkConverter] field-level type converter for property [searchType] = none
found
[XWorkConverter] global-level type converter for property [searchType] =
none found

However, what I don't get is that this is core Struts functionality,
correct?  And my project, using maven dependencies, depends on struts2-core
which in turn depends on xwork-2.1.1.  So, I don't get why this is now
breaking.

One of the things that I have noticed is the line saying:

[ParametersInterceptor] Setting params struts.portlet.mode => [ view ]
dynamicAttributes => [ {} ] struts.portlet.action => [ /view/view/search ]
templateDir => [ template ] theme => [ simple ] value => [
*testuser52testuser52,
testuser52* ] searchType => [ *11, 1* ] postcode => [ ,  ]

Note the text in *bold*.  These are the values that I have entered in the
form; however, it is duplicated in the debug output!!  The actual value that
I input was only testuser52 and 1.  But somehow, somewhere in the struts
mechanism (I think), these parameters were duplicated twice, once in the
value stored in the first index of the array and another as a second value
in the second index of the array.  When I ran the original platform, the
parameter look like this:

[ParametersInterceptor] Setting params struts.portlet.mode => [ view ]
dynamicAttributes => [ {} ] struts.portlet.action => [ /view/view/search ]
templateDir => [ template ] theme => [ simple ] value => [ *testuser52* ]
searchType => [ *1* ] postcode => [ ,  ]

I've ran the code through a debugger in Ecipse while running in JBoss to try
and see what was happening.. first of all, the duplication is happening at
the lowest level of reading that I can see...  whenever there is a
getParameters() type call anywhere (even in xwork.ActionContext), the
parameters are already duplicated.  So, I'm wondering if this duplication
isn't happening when the parameters are "written". I'm not even sure the
duplication would affect the final output of my portlet (although, I suspect
it would given that the "main" value is corrupted by being duplicated) but
I'm just trying to figure out the different possible reasons for this
portlet to break.

So in summary, I think the problems I have are:
1. Parameters duplicated in request parameters somehow
2. xwork converter fails to convert my searchType String of value { 11, 1}
(an array) to an int.

Any thoughts would be much appreciated as I've been stuck on this issue for
about a week now.

Cheers,
Nabeel


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


Re: field value causing NumberFormatException and breaking Action

2010-10-15 Thread Li Ying
I suggest you to check what the parameters value actually are sent to
server side.

You can see this information via these tools:
[Burp Proxy]: http://portswigger.net/burp/proxy.html
OR
[TCPMon]: http://ws.apache.org/commons/tcpmon/tcpmontutorial.html


If the parameter value sent to server is not good,
then we can say the error occurs in client side somehow,
so you can stop analyzing your code of server side
and turn your attention to client side code (HTML, JS and so on)

If the parameter value sent to server is good,
then we can say the error occurs in the server side.
In this case, I suggest you to upgrade your version
of Struts and xWork first.
Because it's meaningless if you waste your time
on some bug of the old version of framework/library.

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



Re: struts2-portlet2-plugin-2.1.8.1 in Liferay 6.0.5 -Post-Redirect-Get aka Redirect after post

2010-10-15 Thread Frans Thamura
would u share the code

how ur spring connect to the persistance, do u create ur own session factory
for hibernate, or u can use the sessionfactory inside liferay

but my experience see that our struts and liferay are in different war

F

On Sat, Oct 16, 2010 at 1:26 AM, Alberto Gallardo  wrote:

> > My experience make portlet the ioc inside s2 conflicted with spring
> inside liferay
> >
> > Perm mem eror show
> >
> Not that I have long experience with liferay, but up to now, I have
> had no problems.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: struts2-portlet2-plugin-2.1.8.1 in Liferay 6.0.5 -Post-Redirect-Get aka Redirect after post

2010-10-15 Thread Alberto Gallardo
> My experience make portlet the ioc inside s2 conflicted with spring inside 
> liferay
>
> Perm mem eror show
>
Not that I have long experience with liferay, but up to now, I have
had no problems.

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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Brian Thompson
On Fri, Oct 15, 2010 at 11:43 AM, Dave Newton  wrote:
> On Fri, Oct 15, 2010 at 12:39 PM, Brian Thompson  
> wrote:
>>> Ever had a client that wanted/required their data segregated from
>>> everybody else's (this is not uncommon at all)? Ever wanted to
>> Apparently, it is uncommon.  I've never encountered such a demand.
>
> That... makes it uncommon?!


Oh, right.  That doesn't make it uncommon, that makes it almost unheard of.

(TBF, we're both speaking from biased samples -- but really, whether
data segregation is common or not is beside the point.)

>
>>> restrict tool access to data without jumping through any hoops
>>> ("here's the DB, here's your username/password, here's your data, and
>>> nobody else's")?
>> I haven't been in this type of situation, either.  Projects I've
>> worked on have always had user-friendly reports on the data, and what
>> little we host for people hasn't called for constantly available
>> direct DB access.
>
> I work for companies with thousands of clients: there's no "little" we
> host for people, only "a lot".
>
> Dave


Most of our projects are deployed on a client's servers rather than
hosted internally.  No big deal, just a different project environment.

-Brian

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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Dave Newton
On Fri, Oct 15, 2010 at 12:39 PM, Brian Thompson  wrote:
>> Ever had a client that wanted/required their data segregated from
>> everybody else's (this is not uncommon at all)? Ever wanted to
> Apparently, it is uncommon.  I've never encountered such a demand.

That... makes it uncommon?!

>> restrict tool access to data without jumping through any hoops
>> ("here's the DB, here's your username/password, here's your data, and
>> nobody else's")?
> I haven't been in this type of situation, either.  Projects I've
> worked on have always had user-friendly reports on the data, and what
> little we host for people hasn't called for constantly available
> direct DB access.

I work for companies with thousands of clients: there's no "little" we
host for people, only "a lot".

Dave

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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Brian Thompson
On Fri, Oct 15, 2010 at 10:22 AM, Dave Newton  wrote:
>> I'm not sure what reasons there would be to have it make sense
>> to store each entity in its own identically-structured DB.
>
> Ever had a client that wanted/required their data segregated from
> everybody else's (this is not uncommon at all)? Ever wanted to


Apparently, it is uncommon.  I've never encountered such a demand.


> restrict tool access to data without jumping through any hoops
> ("here's the DB, here's your username/password, here's your data, and
> nobody else's")?


I haven't been in this type of situation, either.  Projects I've
worked on have always had user-friendly reports on the data, and what
little we host for people hasn't called for constantly available
direct DB access.

That said, I do appreciate seeing a couple of these reasons; after all
it *is* always helpful to get some perspective outside my own
experience.

-Brian

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



Re: Encoding in

2010-10-15 Thread Antonio Sánchez
> Escaping HTML.
> 
> http://struts.apache.org/2.x/docs/property.html
> 
> Dave

Sorry Dave and sorry all! It does work!



I was using "true" by mistake because I misread "false" was the default
in the above reference link.

Besides I got confused because I didn't think that scape also means
encoding here. Even more, I'm outputting xml, not html, and escapeXml
didn't work.

Now I have one more question.

Do I have to add escapeHtml attribute in all property tags? Can I set a
default value of "false" for escapeHtml?

Thank you very much and sorry again for my mistake.
Antonio.


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



Re: Encoding in

2010-10-15 Thread Maurizio Cucchiara
Escape property is deprecated since 2.2.1 version:
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.struts/struts2-core/2.2.1/org/apache/struts2/components/Property.java/
(line 113)



-- 
Maurizio Cucchiara

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



RE: Encoding in

2010-10-15 Thread Martin Gainty

deprecated escape is not in my copy of struts-tags.tld 
deprecated for escape is not in my copy of 
org.apache.struts2.components.Property
(then again my copies are a bit more than a day old)

Martin 
__ 
Verzicht und Vertraulichkeitanmerkung

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
 

> Date: Fri, 15 Oct 2010 11:18:07 -0400
> Subject: Re: Encoding in 
> From: davelnew...@gmail.com
> To: user@struts.apache.org
> 
> 2010/10/15 Martin Gainty :
> > assuming you're implementing struts-tags?
> > try escape instead of escape-html
> 
> The deprecated property?
> 
> Dave
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
  

Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Dave Newton
> I'm not sure what reasons there would be to have it make sense
> to store each entity in its own identically-structured DB.

Ever had a client that wanted/required their data segregated from
everybody else's (this is not uncommon at all)? Ever wanted to
restrict tool access to data without jumping through any hoops
("here's the DB, here's your username/password, here's your data, and
nobody else's")?

Dave

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



Re: Encoding in

2010-10-15 Thread Dave Newton
Please post the actual JSP you're using.

On Fri, Oct 15, 2010 at 10:23 AM, Antonio Sánchez  wrote:
> Testing a servlet that forwards to a simple JSP using standard JSP.
>
>   request.setAttribute("myValue", "EspaÑa");
>
> getServletContext().getRequestDispatcher("/myJSP.jsp").forward(request,
> response);
>
> ---
>
>  <%= request.getAttribute("myValue") %>
>
> It works.
>
> Why  is not encoding properly? Is it a bug? What can I do?
>
> My application requires correct UTF-8 encoding.
>
> Thanks.
>
>
>
>

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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Brian Thompson
On Fri, Oct 15, 2010 at 9:45 AM, Dave Newton  wrote:
> That's really difficult to read.


Agreed.  More whitespace would be nice, Martin.


>
> On Fri, Oct 15, 2010 at 10:38 AM, Martin Gainty wrote:
>> a database schema represents the entire structure (tables and relationships 
>> of
>> those tables) of the there is no need for multiple databases when your 
>> database
>> schema contains the persisted entities (tables)
>
> That's not necessarily true. Depending on how the database is
> accessed, structured, distributed, etc. there are several reasons why
> it may make sense to have each tenet in their own database.


Tenet?

I'd agree with Martin on this one -- it makes more sense to use one
database and store multiple entities in it than to make one DB per
entity.  I'm not sure what reasons there would be to have it make
sense to store each entity in its own identically-structured DB.

-Brian

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



Re: Encoding in

2010-10-15 Thread Dave Newton
2010/10/15 Martin Gainty :
> assuming you're implementing struts-tags?
> try escape instead of escape-html

The deprecated property?

Dave

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



Re: Encoding in

2010-10-15 Thread Antonio Sánchez
Testing a servlet that forwards to a simple JSP using standard JSP.

   request.setAttribute("myValue", "EspaÑa");

getServletContext().getRequestDispatcher("/myJSP.jsp").forward(request,
response);

---

  <%= request.getAttribute("myValue") %>

It works. 

Why  is not encoding properly? Is it a bug? What can I do? 

My application requires correct UTF-8 encoding.

Thanks.





RE: Encoding in

2010-10-15 Thread Martin Gainty

assuming you're implementing struts-tags? 
try escape instead of escape-html


  
  escape
  false
  false


hth
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Subject: Re: Encoding in 
> To: user@struts.apache.org
> From: atcngw000...@gmail.com
> Date: Fri, 15 Oct 2010 14:39:40 +
> 
> Hi! Antonio!
> 
> How to use escapeHtml attribute?
> 
> Ex :
> 
> 
> 
> Wataru
> 
> BlackBerry from DOCOMO
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
  

Re: Encoding in

2010-10-15 Thread Maurizio Cucchiara
2010/10/15 Antonio Sánchez :
>> Escaping HTML.
>
> It doesn't work; same results.

Have you tried escaping html and still doesn't work? You should
obviously set escapeHtml to false like this:



--
Maurizio Cucchiara

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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Dave Newton
That's really difficult to read.

On Fri, Oct 15, 2010 at 10:38 AM, Martin Gainty wrote:
> a database schema represents the entire structure (tables and relationships of
> those tables) of the there is no need for multiple databases when your 
> database
> schema contains the persisted entities (tables)

That's not necessarily true. Depending on how the database is
accessed, structured, distributed, etc. there are several reasons why
it may make sense to have each tenet in their own database.

Dave

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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Frans Thamura
Every extend mapp to different injection to what lli ying said


/m/

-Original Message-
From: Eduard Neuwirt 
Date: Fri, 15 Oct 2010 16:37:56 
To: Struts Users Mailing List; 
Subject: Re: Struts, Spring, Hibernate and multiple Sessionfactories

Hi Frans,

would you mind to explain it ? Different implementation of what ?

Regards
Eduard

2010/10/15 Frans Thamura 

> How about make different implementation
>
> So
>
> Tenant1 extends tenanta
>
> Tenant2 extends tenantb
>
>
> /m/
>
> -Original Message-
> From: Eduard Neuwirt 
> Date: Fri, 15 Oct 2010 16:16:35
> To: Struts Users Mailing List
> Reply-To: "Struts Users Mailing List" 
> Subject: Re: Struts, Spring, Hibernate and multiple Sessionfactories
>
> Hi Li,
>
> thanks for the answer. I didn't get how does it work within the
> struts-spring plugins ? In this case ist the the question is how to access
> to the application context directly from struts session. I could not find
> any information in the docu.
>
>
> Regards
> Eduard
>
>
>
> 2010/10/15 Li Ying 
>
> > If you want to use multi-DB for multi-tenant (let's say tenant01 and
> > tenant02)
> >
> > I think you can create config file should likes:
> >
> > 
> >  
> > 
> >
> > 
> >  
> > 
> >
> > and then, in your java code, you can get different bean instance for
> > different tenant via [ID],
> > code looks like:
> >  BeanFactory.getBean("sessionFactory_" + tenantID,SessionFactory.class);
> >
> >
> > You can read this document for more information:
> >
> >
> http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/BeanFactory.html#getBean%28java.lang.String,%20java.lang.Class%29
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
>
>



Re: Encoding in

2010-10-15 Thread atcngw000006
Hi! Antonio!

How to use escapeHtml attribute?

Ex :



Wataru

BlackBerry from DOCOMO

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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Li Ying
I think i don't understand what you want exactly.
Can you tell me what you want to achieve?
And what your code looks like?



2010/10/15 Eduard Neuwirt :
> Hi Li,
>
> thanks for the answer. I didn't get how does it work within the
>  ? In this case ist the the question is how to access
> to the application context directly from struts session. I could not find
> any information in the docu.
>
>
> Regards
> Eduard
>

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



RE: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Martin Gainty






> Date: Fri, 15 Oct 2010 14:50:17 +0200
> Subject: Struts, Spring, Hibernate and multiple Sessionfactories
> From: eduard.neuw...@googlemail.com
> To: user@struts.apache.org
> 
> Hello,
> 
> I am looking for an elegant solution for the following situation.
> 
> I have a multitenant struts/spring/hibernate application. Every tenant is
> stored in own database within the same RDBMS. All databases has the same
> schema. 
MG>a database schema represents the entire structure (tables and relationships 
of those tables) of the Database
MG>there is no need for multiple databases when your database schema contains 
the persisted entities (tables)

At the spring layer every tenant is represented as a datasource.
MG>perhaps there is some confusion as to the meaning of the term datasource ?
MG>In hibernate a datasource is the URL string which provides connection 
attributes to your database e.g.
MG>Configuration.setProperty("hibernate.connection.datasource", 
"java:comp/env/jdbc/test")

> Because I use the Hibernate I have to create multiple SessionFactories to
MG> Hibernate SessionFactory Documentation
MG>Usually an application will create
 * a single Configuration,
 * build a single instance ofSessionFactory 
 * and then instantiate Sessions in threads servicing client requests. 
 * The Configuration is meant
 * only as an initialization-time object. 
 * SessionFactorys are
 * immutable and do not retain any association back to the
 * Configuration.
 * 
 * A new Configuration will use the properties specified in
 * hibernate.properties by default.
MG> Configuration->SessionFactory->1..n->Session
MG>using Hibernate as your implementing template and assuming you have a valid 
java.sql.Connection all you have to do is create
MG>an EmptyInterceptor object constructed from the parameters of the available 
UserSession
MG>then call SessionFactory.openSession to obtain the session
/**
 * Open a {...@link Session}, utilizing the specfied JDBC {...@link 
Connection} and
 * specified {...@link Interceptor}.
 * 
 * Note that the second-level cache will be disabled if you supply a JDBC
 * connection. Hibernate will not be able to track any statements you might
 * have executed in the same transaction.  Consider implementing your own
 * {...@link org.hibernate.connection.ConnectionProvider} instead as a 
highly
 * recommended alternative.
 *
 * @param connection a connection provided by the application.
 * @param interceptor a session-scoped interceptor
 *
 * @return The created session.
 */
public org.hibernate.classic.Session openSession(Connection connection, 
Interceptor interceptor);

OR in the case of Spring
public static Session getSession(SessionFactory sessionFactory, boolean 
allowCreate)
> 
> How can I provide the correct Seesionfactory to the UserSession in struts.
> Once I have is the tenantId stored in UserSession itself.
> 
> Please help
> Eduard
  

Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Eduard Neuwirt
Hi Frans,

would you mind to explain it ? Different implementation of what ?

Regards
Eduard

2010/10/15 Frans Thamura 

> How about make different implementation
>
> So
>
> Tenant1 extends tenanta
>
> Tenant2 extends tenantb
>
>
> /m/
>
> -Original Message-
> From: Eduard Neuwirt 
> Date: Fri, 15 Oct 2010 16:16:35
> To: Struts Users Mailing List
> Reply-To: "Struts Users Mailing List" 
> Subject: Re: Struts, Spring, Hibernate and multiple Sessionfactories
>
> Hi Li,
>
> thanks for the answer. I didn't get how does it work within the
> struts-spring plugins ? In this case ist the the question is how to access
> to the application context directly from struts session. I could not find
> any information in the docu.
>
>
> Regards
> Eduard
>
>
>
> 2010/10/15 Li Ying 
>
> > If you want to use multi-DB for multi-tenant (let's say tenant01 and
> > tenant02)
> >
> > I think you can create config file should likes:
> >
> > 
> >  
> > 
> >
> > 
> >  
> > 
> >
> > and then, in your java code, you can get different bean instance for
> > different tenant via [ID],
> > code looks like:
> >  BeanFactory.getBean("sessionFactory_" + tenantID,SessionFactory.class);
> >
> >
> > You can read this document for more information:
> >
> >
> http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/BeanFactory.html#getBean%28java.lang.String,%20java.lang.Class%29
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
>
>


Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Frans Thamura
How about make different implementation

So 

Tenant1 extends tenanta

Tenant2 extends tenantb


/m/

-Original Message-
From: Eduard Neuwirt 
Date: Fri, 15 Oct 2010 16:16:35 
To: Struts Users Mailing List
Reply-To: "Struts Users Mailing List" 
Subject: Re: Struts, Spring, Hibernate and multiple Sessionfactories

Hi Li,

thanks for the answer. I didn't get how does it work within the
struts-spring plugins ? In this case ist the the question is how to access
to the application context directly from struts session. I could not find
any information in the docu.


Regards
Eduard



2010/10/15 Li Ying 

> If you want to use multi-DB for multi-tenant (let's say tenant01 and
> tenant02)
>
> I think you can create config file should likes:
>
> 
>  
> 
>
> 
>  
> 
>
> and then, in your java code, you can get different bean instance for
> different tenant via [ID],
> code looks like:
>  BeanFactory.getBean("sessionFactory_" + tenantID,SessionFactory.class);
>
>
> You can read this document for more information:
>
> http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/BeanFactory.html#getBean%28java.lang.String,%20java.lang.Class%29
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



Re: Encoding in

2010-10-15 Thread Antonio Sánchez
> Escaping HTML.

It doesn't work; same results. 


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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Eduard Neuwirt
Hi Li,

thanks for the answer. I didn't get how does it work within the
struts-spring plugins ? In this case ist the the question is how to access
to the application context directly from struts session. I could not find
any information in the docu.


Regards
Eduard



2010/10/15 Li Ying 

> If you want to use multi-DB for multi-tenant (let's say tenant01 and
> tenant02)
>
> I think you can create config file should likes:
>
> 
>  
> 
>
> 
>  
> 
>
> and then, in your java code, you can get different bean instance for
> different tenant via [ID],
> code looks like:
>  BeanFactory.getBean("sessionFactory_" + tenantID,SessionFactory.class);
>
>
> You can read this document for more information:
>
> http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/BeanFactory.html#getBean%28java.lang.String,%20java.lang.Class%29
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Li Ying
If you want to use multi-DB for multi-tenant (let's say tenant01 and tenant02)

I think you can create config file should likes:


  



  


and then, in your java code, you can get different bean instance for
different tenant via [ID],
code looks like:
  BeanFactory.getBean("sessionFactory_" + tenantID,SessionFactory.class);


You can read this document for more information:
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/BeanFactory.html#getBean%28java.lang.String,%20java.lang.Class%29

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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Marshall Gunter
I have seen a horizontal partitioning of data using Hibernate that hides
the SessionFactories, etc in a ConfigUtil class. The idea goes something
like this.

The ConfigUtil establishes all SessionFactories and stores them in a map
with their associated identifier (ID, class, whatever you choose) as the
key. The ConfigUtil then has a call getSessionFactory(identifier) that
returns the SessionFactory for the identifier you submit.

On 10-10-15 09:43 AM, Li Ying wrote:
> We developed a multi-tenant app last year.
>
> But we didn't separate their data into different DB.
>
> Instead, we stored all data in one DB, and add
> a [tenant_id] column to all tables to distinguish
> which tenant it belong.
>
> I think this is a simpler solution.
>
> When you need to add new tenant,
> you can simply add new records to one DB,
> you don't have to create new DB and configure it in your executive 
> environment.
>
> And, when you change your DB design,
> you don't have to do this in all the DBs.
>
>
>
>
> 2010/10/15 Eduard Neuwirt :
>   
>> Hello,
>>
>> I am looking for an elegant solution for the following situation.
>>
>> I have a multitenant struts/spring/hibernate application. Every tenant is
>> stored in own database within the same RDBMS. All databases has the same
>> schema. At the spring layer every tenant is represented as a datasource.
>> Because I use the Hibernate I have to create multiple SessionFactories to
>>
>> How can I provide the correct Seesionfactory to the UserSession in struts.
>> Once I have is the tenantId stored in UserSession itself.
>>
>> Please help
>> Eduard
>> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>   

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



Re: Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Li Ying
We developed a multi-tenant app last year.

But we didn't separate their data into different DB.

Instead, we stored all data in one DB, and add
a [tenant_id] column to all tables to distinguish
which tenant it belong.

I think this is a simpler solution.

When you need to add new tenant,
you can simply add new records to one DB,
you don't have to create new DB and configure it in your executive environment.

And, when you change your DB design,
you don't have to do this in all the DBs.




2010/10/15 Eduard Neuwirt :
> Hello,
>
> I am looking for an elegant solution for the following situation.
>
> I have a multitenant struts/spring/hibernate application. Every tenant is
> stored in own database within the same RDBMS. All databases has the same
> schema. At the spring layer every tenant is represented as a datasource.
> Because I use the Hibernate I have to create multiple SessionFactories to
>
> How can I provide the correct Seesionfactory to the UserSession in struts.
> Once I have is the tenantId stored in UserSession itself.
>
> Please help
> Eduard

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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Li Ying
Thanks a lot, I will try it.


2010/10/15 Robert Taylor :
> Hi Li,
>
> JSTL and EL give you access to the implicit pageContext object.
> From there you can access attributes from request and session.
>
>
> For example:
> 
>
> And then use contextPath variable however you wish.
>
> I'm not sure how this would translate into an OGNL expression.
> But I'm sure others on this list do :)
>
> /robert
>

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



Struts, Spring, Hibernate and multiple Sessionfactories

2010-10-15 Thread Eduard Neuwirt
Hello,

I am looking for an elegant solution for the following situation.

I have a multitenant struts/spring/hibernate application. Every tenant is
stored in own database within the same RDBMS. All databases has the same
schema. At the spring layer every tenant is represented as a datasource.
Because I use the Hibernate I have to create multiple SessionFactories to

How can I provide the correct Seesionfactory to the UserSession in struts.
Once I have is the tenantId stored in UserSession itself.

Please help
Eduard


Re: give suggestion data display base on the Locale

2010-10-15 Thread Li Ying
You can call method [getText("activity.name")] to
retrieve localized string.

Read this document for more information:
http://struts.apache.org/2.2.1/docs/localization.html




2010/10/15 singh123 :
>
> 
> 
>        
>        
> 
> 
>
> listObject is a Linked list object. listValue and listIndex is of Object
> type.
> i have two properties file:
>
> messages.properties:
> activity.name=activity
>
> messages_fr.properties:
> activity.name=activity_fr
>
>  i want to add Localization feature so that when Linked list populate and
> display, it show text based on the Locale.
>  please suggest in this regard.
> --
> View this message in context: 
> http://old.nabble.com/give-suggestion-data-display-base-on-the-Locale-tp29971062p29971062.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Robert Taylor

Hi Li,

JSTL and EL give you access to the implicit pageContext object.

From there you can access attributes from request and session.



For example:


And then use contextPath variable however you wish.

I'm not sure how this would translate into an OGNL expression.
But I'm sure others on this list do :)

/robert

- Original Message - 
From: "Li Ying" 

To: "Struts Users Mailing List" 
Sent: Friday, October 15, 2010 4:12 AM
Subject: Re: referencing javascript files from (action) jsp file



Hi Robert and Dave:

I tried  in my application, and it works for almost all the case.

But there is one exception:

In my application, i customized the CSS files shiped with Struts JQuery 
plugin


and put them under path [{contextPath}/res/struts/].

In JSP, i need add code likes:



to tell Struts JQuery plugin where to load js/css files.

In this case, i think  can not help,

because [contextPath] is a part of attribute value of another tag.

I tried "%{#request.getContextPath()}", but it don't work for some
reason i don't know.

So i decide to remain my old solution(adding a property in my Action),

so i can reference [contextPath] in Struts tags.

Of cause, in simlpe URL case,  is a better choice.

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




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



give suggestion data display base on the Locale

2010-10-15 Thread singh123


 
 
 
  


listObject is a Linked list object. listValue and listIndex is of Object
type.
i have two properties file:

messages.properties:
activity.name=activity

messages_fr.properties:
activity.name=activity_fr

 i want to add Localization feature so that when Linked list populate and
display, it show text based on the Locale.  
 please suggest in this regard.
-- 
View this message in context: 
http://old.nabble.com/give-suggestion-data-display-base-on-the-Locale-tp29971062p29971062.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Dale Newfield

On 10/15/10 4:12 AM, Li Ying wrote:

I tried "%{#request.getContextPath()}", but it don't work for some
reason i don't know.


#request is not the request object, it's a map containing the items in 
request scope.


-Dale

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



Activiti and Struts2

2010-10-15 Thread Frans Thamura
anyone working with activiti

may be wanna to share ur work

we are working with it here also


--
Frans Thamura
Director
Meruvian.
The Most Complete Java Services Provider in Indonesia


Mobile: +6287885901958
Blog & Profile: http://frans.thamura.info

We grow because we share the same belief.


component tag in Struts2

2010-10-15 Thread singh123

Can any body simplify this.and what is the difference in both param tags


  
 
 

Thanks.
-- 
View this message in context: 
http://old.nabble.com/component-tag-in-Struts2-tp29970512p29970512.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Activity can display dynamically depend on the locale on Struts

2010-10-15 Thread Maurizio Cucchiara
You're welcome

2010/10/15 singh123 :
>
>  thanks.
-- 
Maurizio Cucchiara

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



Re: Activity can display dynamically depend on the locale on Struts

2010-10-15 Thread singh123

 thanks.

singh123 wrote:
> 
> i want to display activities dynamically which can be increase or decrease
> on struts 2 framework and that depend on the Locale (like English or
> French) .
> dynamically means user can be expend or collapse (add or delete) activity
> at run time.
> 
> I have two properties file:
> 
> messages.properties:
> activity.name=activity
> 
> messages_fr.properties:
> activity.name=activity_fr
> 
> for dynamic, i am using array list. i have an array list in a Java class.
> In this list i want to store the values (activities) depending on the
> locale:
> arraylist.add(new ListItem("Activity", ""));
> 
> When I retrieve the value on jsp like this:
> 
> 
> Am i going to right direction or any suggestion..
> 
> Thanks 
> 

-- 
View this message in context: 
http://old.nabble.com/Activity-can-display-dynamically-depend-on-the-locale-on-Struts-tp29941004p29970471.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Li Ying
You can read this document:
http://struts.apache.org/2.2.1/docs/static-content.html

and check if your configuration is right.



2010/10/15 Guy Thomas :
> Thank you, this works. I would like to draw your attention to possible 
> problems with the struts head tag. See below.
>
> 
> Domain Security Administrator: Pas gebruiker aan
> " rel="stylesheet" 
> type="text/css">
> " type="text/javascript">
> " 
> type="text/javascript">
> 
>
> is converted into:
>
> 
> Domain Security Administrator: Pas gebruiker aan
>  rel="stylesheet" type="text/css">
> 
>  type="text/javascript">
> 
>
> - Struts head tag problems.
>
> However, there could be a problem when the  tag has to be included 
> for one reason or another.
>
> In that case:
>
> 
> Domain Security Administrator: Pas gebruiker aan
> " rel="stylesheet" 
> type="text/css">
> " type="text/javascript">
> " 
> type="text/javascript">
> 
> 
>
> is converted into:
>
> 
> Domain Security Administrator: Pas gebruiker aan
>  rel="stylesheet" type="text/css">
> 
>  type="text/javascript">
>  type="text/css"/>
>  type="text/javascript">
> 
>
> which causes the following errors to be shown in the chrome javascript 
> console:
>
> Failed to load resource: the server responded with a status of 404 (Not 
> Found) utils.js
> Failed to load resource: the server responded with a status of 404 (Not 
> Found) styles.css
>
> No idea what utils.js and styles.css are.
>
> When adding theme="simple" to the head tag only the utils.js error message is 
> generated.
>
>
>

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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Li Ying
[utils.js] is used for client side validation.
it should be found in
[struts2-core-2.2.1.jar/org/apache/struts2/static/utils.js]


[styles.css] is used for Struts themes.
it should be found in [struts2-core-2.2.1.jar/template/theme_name/styles.css]




2010/10/15 Guy Thomas :
> Thank you, this works. I would like to draw your attention to possible 
> problems with the struts head tag. See below.
>
> 
> Domain Security Administrator: Pas gebruiker aan
> " rel="stylesheet" 
> type="text/css">
> " type="text/javascript">
> " 
> type="text/javascript">
> 
>
> is converted into:
>
> 
> Domain Security Administrator: Pas gebruiker aan
>  rel="stylesheet" type="text/css">
> 
>  type="text/javascript">
> 
>
> - Struts head tag problems.
>
> However, there could be a problem when the  tag has to be included 
> for one reason or another.
>
> In that case:
>
> 
> Domain Security Administrator: Pas gebruiker aan
> " rel="stylesheet" 
> type="text/css">
> " type="text/javascript">
> " 
> type="text/javascript">
> 
> 
>
> is converted into:
>
> 
> Domain Security Administrator: Pas gebruiker aan
>  rel="stylesheet" type="text/css">
> 
>  type="text/javascript">
>  type="text/css"/>
>  type="text/javascript">
> 
>
> which causes the following errors to be shown in the chrome javascript 
> console:
>
> Failed to load resource: the server responded with a status of 404 (Not 
> Found) utils.js
> Failed to load resource: the server responded with a status of 404 (Not 
> Found) styles.css
>
> No idea what utils.js and styles.css are.
>
> When adding theme="simple" to the head tag only the utils.js error message is 
> generated.
>
>

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



Re: referencing javascript files from (action) jsp file

2010-10-15 Thread Li Ying
Hi Robert and Dave:

I tried  in my application, and it works for almost all the case.

But there is one exception:

In my application, i customized the CSS files shiped with Struts JQuery plugin

and put them under path [{contextPath}/res/struts/].

In JSP, i need add code likes:



to tell Struts JQuery plugin where to load js/css files.

In this case, i think  can not help,

because [contextPath] is a part of attribute value of another tag.

I tried "%{#request.getContextPath()}", but it don't work for some
reason i don't know.

So i decide to remain my old solution(adding a property in my Action),

so i can reference [contextPath] in Struts tags.

Of cause, in simlpe URL case,  is a better choice.

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