Re: struts 2 - framework question
Hi , You can define interceptors for each namespace. Emil On Mon, Mar 8, 2010 at 3:19 PM, Alex Rodriguez Lopez alo...@flordeutopia.pt wrote: It looks to me that you could use a combination of packages for each store with different namespaces, but to save code repetition it would be good idea to use wildcards (or go for the restful way as already suggested) in the config files and later on the action retrieve the full url to see which store the request comes from. What helped me a lot to work with only some mappings (using wildcards) and only some actions is this book, listed in Struts2 docs, which is freely downloable: http://www.infoq.com/minibooks/starting-struts2 Alex Em 08-03-2010 02:33, Cimballi escreveu: John, I don't have immediate code that I can copy paste, but I can explain a bit more the package solution. You will have to declare 2 packages, one with namespace store1 and one with namespace store2. Then you can write a single action, which take a storeId paramter, and you set the parameter statically in the action definitions. You will need 2 action definitions, one in each package, calling the same java action and setting the storeId parameter like said before. Then, in each JSP for each store, you call the correct struts action. Is it clear for you ? Cimballi On Sun, Mar 7, 2010 at 11:36 AM, john leesh_thorn_b...@yahoo.com wrote: possible for you to show some psedo code for how to do it? tks in advance john --- On Sun, 3/7/10, Paweł Wielguspoulw...@gmail.com wrote: From: Paweł Wielguspoulw...@gmail.com Subject: Re: struts 2 - framework question To: Struts Users Mailing Listuser@struts.apache.org, cimba...@cimballi.net Date: Sunday, March 7, 2010, 1:59 AM Hi All, You can also have N applications representing stores under names store1..storeN, where one application just knows about itself and all applications are identical in code but different in data and css maybe. Best greetings, Paweł Wielgus. 2010/3/7 Cimballicimballi.cimba...@gmail.com: John, you can use namespaces at the package level to distinguish your stores. You can also do that in a rest way, like http://www.xyz.com/store/1. Cimballi On Sat, Mar 6, 2010 at 11:18 PM, john leesh_thorn_b...@yahoo.com wrote: my company is distributor, we plan to provide platform for our customer(different store) to sell their product to indivual customers. http://www.xyz.om/store1 http://www.xyz.com/store2 http://www.xyz.com/store3 ... http://www.xyz.com/storeN (store1...storeN) list our(distributor)'s product to their customer, when customer see the display price, the display price=our price(base price)+storeX's margin my question is the following a. in the struts.xml, different store should have different package defination ? b. in the application, what is the struts2's method to detect which store? in other words, how can i detect which link(http://www.xyz.om/store1 or store2 or store3) is pass in ? without knowing which store is called, i can not call special routine(could be price cal, ...) associated with that store. any good idea to approach this? tks in advance john - 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 - 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 -- Emil Thushanga (Lets say i am Programmer/Developer) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to do with Struts2(Similar to Web2.0 wizard)!!!!
Hi , My idea is to create a jar file with your common codes and place it in your class path. Emil On Fri, Mar 5, 2010 at 9:44 PM, sharath karnati karna...@yahoo.com wrote: Hi All, I'm currently using Struts2 + Spring(DAO). Say I have 2 web application, these two application are using file upload functionality. Currently, we are placing same functionality in different projects(coping .jsp, .action and spring dao classes). I'd like to know similar to wizard in web2.0 where we can share code in different applications, whether this can be achieved using struts2? If possible, can you please give me how to do this without coping code in 2 projects. Thanks in advance. Regards, Sharath. -- Emil Thushanga (Lets say i am Programmer/Developer) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts 2 - framework question
i am not sure , whether this will helpful to you anyway i have done something as following, package namespace=/antigua name=myPackage2 extends=struts-default interceptors interceptor name=antiguainter class=AntiguaRegionInterceptor/interceptor interceptor-stack name=antiguaStack interceptor-ref name=createSession/ interceptor-ref name=antiguainter / interceptor-ref name=defaultStack / /interceptor-stack /interceptors default-interceptor-ref name=antiguaStack/default-interceptor-ref . . . /package package namespace=/barbados name=myPackage1 extends=struts-default interceptors interceptor name=barbadosinter class=BarbadosRegionInterceptor/interceptor interceptor-stack name=barbadosStack interceptor-ref name=createSession/ interceptor-ref name=barbadosinter / interceptor-ref name=defaultStack / /interceptor-stack /interceptors default-interceptor-ref name=barbadosStack/default-interceptor-ref . . . /package Emil On Tue, Mar 9, 2010 at 9:46 AM, john lee sh_thorn_b...@yahoo.com wrote: possible for you to show me the psudo code for how to do it? tks in advance john --- On Mon, 3/8/10, emil thushanga thusha...@gmail.com wrote: From: emil thushanga thusha...@gmail.com Subject: Re: struts 2 - framework question To: Struts Users Mailing List user@struts.apache.org Date: Monday, March 8, 2010, 3:39 AM Hi , You can define interceptors for each namespace. Emil On Mon, Mar 8, 2010 at 3:19 PM, Alex Rodriguez Lopez alo...@flordeutopia.pt wrote: It looks to me that you could use a combination of packages for each store with different namespaces, but to save code repetition it would be good idea to use wildcards (or go for the restful way as already suggested) in the config files and later on the action retrieve the full url to see which store the request comes from. What helped me a lot to work with only some mappings (using wildcards) and only some actions is this book, listed in Struts2 docs, which is freely downloable: http://www.infoq.com/minibooks/starting-struts2 Alex Em 08-03-2010 02:33, Cimballi escreveu: John, I don't have immediate code that I can copy paste, but I can explain a bit more the package solution. You will have to declare 2 packages, one with namespace store1 and one with namespace store2. Then you can write a single action, which take a storeId paramter, and you set the parameter statically in the action definitions. You will need 2 action definitions, one in each package, calling the same java action and setting the storeId parameter like said before. Then, in each JSP for each store, you call the correct struts action. Is it clear for you ? Cimballi On Sun, Mar 7, 2010 at 11:36 AM, john leesh_thorn_b...@yahoo.com wrote: possible for you to show some psedo code for how to do it? tks in advance john --- On Sun, 3/7/10, Paweł Wielguspoulw...@gmail.com wrote: From: Paweł Wielguspoulw...@gmail.com Subject: Re: struts 2 - framework question To: Struts Users Mailing Listuser@struts.apache.org, cimba...@cimballi.net Date: Sunday, March 7, 2010, 1:59 AM Hi All, You can also have N applications representing stores under names store1..storeN, where one application just knows about itself and all applications are identical in code but different in data and css maybe. Best greetings, Paweł Wielgus. 2010/3/7 Cimballicimballi.cimba...@gmail.com: John, you can use namespaces at the package level to distinguish your stores. You can also do that in a rest way, like http://www.xyz.com/store/1. Cimballi On Sat, Mar 6, 2010 at 11:18 PM, john leesh_thorn_b...@yahoo.com wrote: my company is distributor, we plan to provide platform for our customer(different store) to sell their product to indivual customers. http://www.xyz.om/store1 http://www.xyz.com/store2 http://www.xyz.com/store3 ... http://www.xyz.com/storeN (store1...storeN) list our(distributor)'s product to their customer, when customer see the display price, the display price=our price(base price)+storeX's margin my question is the following a. in the struts.xml, different store should have different package defination ? b. in the application, what is the struts2's method to detect which store? in other words, how can i detect which link(http://www.xyz.om/store1 or store2 or store3) is pass in ? without knowing which store is called, i can not call special routine(could be price cal, ...) associated with that store. any good idea to approach this? tks in advance john - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Strus2 sitemesh url parameters
Dear all, I use Struts2 and *Sitemesh* for my project. I have an issue with the URL parameters. My previous URL parameters are remaining as the same even if I go to new page, Is there any way to clear the parameter from my URL, this is a problem for me to do pagination. WEB.xml (i have configured following filters on my web.xml) = filter filter-nameaction2-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter-class /filter filter filter-namesitemesh/filter-name filter-classcom.opensymphony.module.sitemesh.filter.PageFilter/filter-class /filter filter filter-nameaction2/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter Thanks Emil
Re: Session help
Dear all, This thread was really helpful to me. i could accomplish it using interceptors as you guys mentioned. Thanks for the solution and the links. Lots of thanks Emil On Wed, Jan 20, 2010 at 9:47 PM, Dale Newfield d...@newfield.org wrote: emil thushanga wrote: Thanks for the solutions. i prefer to do it in interceptors way. if any resources available for me to grab the thing please let me know. any way thanks a lot. A good place to start: http://struts.apache.org/2.1.8.1/docs/interceptors.html and http://struts.apache.org/2.1.8.1/docs/writing-interceptors.html Examples that should help: This one accesses the action mapping: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java This one accesses the session: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Emil Thushanga
Session help
Dear all, I have an S2 web application. No login procedure and any page can be accessed. Basically it’s an Open session. It’s a hotel website. As an example when user access Barbados web pages , regardless of any URL patter session should be created and token should be save as region='Barbados'. If user accessing any of Antigua URLs session should be filled with region='Antigua' We have separated regions by using different namespaces in struts.xml. Example URL pattern, http://localhost:8084/subsites/barbados/listHotels.html?starRate=3 Please provide a help on this. Thanks Emil
Re: Session help
Hi, this may be helpful. package namespace=/barbados name=myPackage1 extends=struts-default action name=index class=IndexAction result/jsp/ukbarbados/index.jsp/result /action action name=listHotels class=StarPageAction param name=countrybarbados/param result/jsp/ukbarbados/list_hotels.jsp/result /action action name=hotel class=Hotel result /jsp/commonjsps/hotel.jsp/result /action /package package namespace=/antigua name=myPackage2 extends=struts-default action name=index class=IndexAction result/jsp/ukantigua/index.jsp/result /action /package thanks Emil On Wed, Jan 20, 2010 at 12:22 PM, Saeed Iqbal saee...@gmail.com wrote: This is strange. What kind of a setup do you have? On Wed, Jan 20, 2010 at 11:20 AM, emil thushanga thusha...@gmail.com wrote: Dear all, I have an S2 web application. No login procedure and any page can be accessed. Basically it’s an Open session. It’s a hotel website. As an example when user access Barbados web pages , regardless of any URL patter session should be created and token should be save as region='Barbados'. If user accessing any of Antigua URLs session should be filled with region='Antigua' We have separated regions by using different namespaces in struts.xml. Example URL pattern, http://localhost:8084/subsites/barbados/listHotels.html?starRate=3 Please provide a help on this. Thanks Emil -- Saeed Iqbal Independant Consultant J2EE - Application Architect / Developer -- Emil Thushanga
Re: Session help
Hi If user created a book mark and accessing a page then how can push him to index action. based on the user accessing namespace i want to set a session variable with the corresponding region. Ex if namespace is 'Barbados' session ='Barbados' if namespace is 'Antigua' session ='Antigua' If this is you saying please provide me additional info. since i am very basic in S2. Lots of thanks Emil On Wed, Jan 20, 2010 at 12:51 PM, Saeed Iqbal saee...@gmail.com wrote: You should be able to do index and land on that jsp. Also maybe put a method property inside action tag On Wed, Jan 20, 2010 at 11:48 AM, emil thushanga thusha...@gmail.com wrote: Hi, this may be helpful. package namespace=/barbados name=myPackage1 extends=struts-default action name=index class=IndexAction result/jsp/ukbarbados/index.jsp/result /action action name=listHotels class=StarPageAction param name=countrybarbados/param result/jsp/ukbarbados/list_hotels.jsp/result /action action name=hotel class=Hotel result /jsp/commonjsps/hotel.jsp/result /action /package package namespace=/antigua name=myPackage2 extends=struts-default action name=index class=IndexAction result/jsp/ukantigua/index.jsp/result /action /package thanks Emil On Wed, Jan 20, 2010 at 12:22 PM, Saeed Iqbal saee...@gmail.com wrote: This is strange. What kind of a setup do you have? On Wed, Jan 20, 2010 at 11:20 AM, emil thushanga thusha...@gmail.com wrote: Dear all, I have an S2 web application. No login procedure and any page can be accessed. Basically it’s an Open session. It’s a hotel website. As an example when user access Barbados web pages , regardless of any URL patter session should be created and token should be save as region='Barbados'. If user accessing any of Antigua URLs session should be filled with region='Antigua' We have separated regions by using different namespaces in struts.xml. Example URL pattern, http://localhost:8084/subsites/barbados/listHotels.html?starRate=3 Please provide a help on this. Thanks Emil -- Saeed Iqbal Independant Consultant J2EE - Application Architect / Developer -- Emil Thushanga -- Saeed Iqbal Independant Consultant J2EE - Application Architect / Developer -- Emil Thushanga
Re: Session help
Hi Thanks for the solutions. i prefer to do it in interceptors way. if any resources available for me to grab the thing please let me know. any way thanks a lot. Emil On Wed, Jan 20, 2010 at 1:25 PM, Dale Newfield d...@newfield.org wrote: emil thushanga wrote: if namespace is 'Barbados' session ='Barbados' if namespace is 'Antigua' session ='Antigua' One simple way to do this would be to write an interceptor that takes the namespace from the action mapping and sets the appropriate value in session scope. -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Emil Thushanga
Re: Help me design this struts, please
Do you know how to setup initial project files you want, This may be helpful to you if you very basic = mvn archetype:create -DgroupId=org.apache.struts -DartifactId=struts2-archetype-starter -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts2-archetype-starter -DarchetypeVersion=2.0.11.2 -DremoteRepositories=http://repo1.maven.org/maven2 Emil On Tue, Dec 1, 2009 at 8:42 PM, Saeed Iqbal saee...@gmail.com wrote: Yes i can send u a project where i did that at this point i dont have time to do all that for you On Tuesday, December 1, 2009, A. Lotfi majidna...@yahoo.com wrote: Hi, I have a small project and I am new in struts : DB Tables : User (userId, UserName,...,...) Roles(userId, Rolename,.) I want to have a jsp page : that has a search form : textfield(userId) and a search button when the user type a userid and press search button : all the information from the User table appear + two comboboxes : combobox (All roles in the database) combobox (Assigned roles to this user) two links : right arrow link for revoking roles left arrow link for granting roles could you please help me doing this ? thanks your help is appreciated. -- Saeed Iqbal Independant Consultant (Freelance) Struts - J2EE - Application Architect / Developer - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Emil Thushanga
how Presentation reuse in many one web apps
Hi All, I am currently developing a large website; witch is having more than 400 client websites, each and every web app is relying on one single business model which is done by spring. So the business logic is being reused here. But I want my presentation logic also to be reused in every web app. that will beneficial to change the presentation logic using one update. I tried with Apache tiles and Sitmesh, but I was unable to find a solution. Please suggest me any solution? or any resource? thanks Emil
Re: how Presentation reuse in many one web apps
Thanks lot for the reply, I have one business model application based on spring, guess I have 400 S2 Client web apps. In every S2 web app use common template to display retrieved dynamic listing based on the region. What I want to use one decorator (Sitemesh) or template (Tiles) to use in every S2 web app. Because it is required to be changed, the entire client sites in one modification. If I can centralize the decorator to use in every application it is possible, unfortunately Sitemesh or tiles doesn’t have support for that kind of feature yet. Thanks Emil On Wed, Nov 25, 2009 at 4:48 PM, Saeed Iqbal saee...@gmail.com wrote: IMO Presentation logic is your Action Beans and if you want to re-use decorator you can reuse the JSP I guess I dont understand your needs. On Wed, Nov 25, 2009 at 4:30 PM, emil thushanga thusha...@gmail.com wrote: Hi All, I am currently developing a large website; witch is having more than 400 client websites, each and every web app is relying on one single business model which is done by spring. So the business logic is being reused here. But I want my presentation logic also to be reused in every web app. that will beneficial to change the presentation logic using one update. I tried with Apache tiles and Sitmesh, but I was unable to find a solution. Please suggest me any solution? or any resource? thanks Emil -- Saeed Iqbal CEO http://www.iqbalconsulting.com Struts - J2EE - Application Architects and Developers -- Emil Thushanga
Re: how Presentation reuse in many one web apps
JSTL ‘c:import ‘ may be the solution , this enables to load external resources outside of the current domain. Thanks for the great Idea. Thanks Emil On Wed, Nov 25, 2009 at 5:35 PM, Saeed Iqbal saee...@gmail.com wrote: So you want a decorator outside the domain of application to decorate your items? If so then I also do something similar. I jsp include inside my decorators because i have some pages that do not use decorators to be able to change at one place and reflect in others. These pages however use some of jsp include files. On Wed, Nov 25, 2009 at 5:12 PM, emil thushanga thusha...@gmail.com wrote: Thanks lot for the reply, I have one business model application based on spring, guess I have 400 S2 Client web apps. In every S2 web app use common template to display retrieved dynamic listing based on the region. What I want to use one decorator (Sitemesh) or template (Tiles) to use in every S2 web app. Because it is required to be changed, the entire client sites in one modification. If I can centralize the decorator to use in every application it is possible, unfortunately Sitemesh or tiles doesn’t have support for that kind of feature yet. Thanks Emil On Wed, Nov 25, 2009 at 4:48 PM, Saeed Iqbal saee...@gmail.com wrote: IMO Presentation logic is your Action Beans and if you want to re-use decorator you can reuse the JSP I guess I dont understand your needs. On Wed, Nov 25, 2009 at 4:30 PM, emil thushanga thusha...@gmail.com wrote: Hi All, I am currently developing a large website; witch is having more than 400 client websites, each and every web app is relying on one single business model which is done by spring. So the business logic is being reused here. But I want my presentation logic also to be reused in every web app. that will beneficial to change the presentation logic using one update. I tried with Apache tiles and Sitmesh, but I was unable to find a solution. Please suggest me any solution? or any resource? thanks Emil -- Saeed Iqbal CEO http://www.iqbalconsulting.com Struts - J2EE - Application Architects and Developers -- Emil Thushanga -- Saeed Iqbal CEO http://www.iqbalconsulting.com Struts - J2EE - Application Architects and Developers -- Emil Thushanga
Re: Struts2 + EJB 3.0 + Hibernate
Struts2 is good for your presentation layer. It is the MVC front controller. Accessing EJB is a kind of a challenge inside Struts2 rather than spring. Struts2 + spring + hibernate will be a good combination if it is suitable for your problem domain. Emil On Thu, Nov 26, 2009 at 12:08 PM, vikrant S shimpi.vikr...@gmail.comwrote: Is It a good idea to build a project using the combination Struts2 + EJB 3.0 + Hibernate using MVC architecture. Guys please share ur opinion -- View this message in context: http://old.nabble.com/Struts2-%2B-EJB-3.0-%2B-Hibernate-tp26524749p26524749.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 -- Emil Thushanga
Re: Re: Struts2 + EJB 3.0 + Hibernate
Ya thats true, but its not clean such as the way used in spring, or JSF managed beans. lookup service is a another dependency for your project. Emil On Thu, Nov 26, 2009 at 1:24 PM, jheidenre...@statistik-hessen.de wrote: Why is it a challenge accessing EJB in Struts2? All you need to do is to lookup your local or remote EJB interface, which is in fact 1 line of code. Joachim Struts2 is good for your presentation layer. It is the MVC front controller. Accessing EJB is a kind of a challenge inside Struts2 rather than spring. Struts2 + spring + hibernate will be a good combination if it is suitable for your problem domain. Emil On Thu, Nov 26, 2009 at 12:08 PM, vikrant S shimpi.vikr...@gmail.comwrote: Is It a good idea to build a project using the combination Struts2 + EJB 3.0 + Hibernate using MVC architecture. Guys please share ur opinion -- View this message in context: http://old.nabble.com/Struts2-%2B-EJB-3.0-%2B-Hibernate-tp26524749p26524749.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 -- Emil Thushanga -- Emil Thushanga
Re: Struts2 online sources/ ebooks
check this one, http://www.rkcole.com/index.html Emil On Wed, Nov 18, 2009 at 10:48 AM, vikrant S shimpi.vikr...@gmail.comwrote: Hi Friends, I am currently learning struts 2 and have developed a small application using tutorials from http://www.vaannila.com and http://www.roseindia.net/struts/ . If you know any good links may be tutorials or ebooks Please share it so that I could learn from them Thanks in advance!!! -- View this message in context: http://old.nabble.com/Struts2-online-sources--ebooks-tp26402511p26402511.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 -- Emil Thushanga
New to struts2
Hi all I have a project to be re-implemented using java which has done by using Perl CGI. I have to reuse inner content pages across all the sites to be dynamically loaded. To be feasible to one shot changes. Perl system using includes from different file paths and generates the view according to the parameters. There are more the 250 web sites to be implemented. Each web site is having there own main template and some static pages. But dynamic pages are reusing among all the sites to display the site contents. So I have to place all the common dynamic pages in central location and call them to each strtus2 application to generate the site content. Initially I used Sitemesh with struts2 but I felt it is not enough to implement solution like this. Later I saw Apache Tiles is good for this kind of page reuse. But I couldn’t find how to load files from central location to each struts2 application. Please If any one how to use struts2 for this kind project and is it feasible to do so. How tiles can use to share common templates among different struts2 applications. Thanks Emil