Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 9 Mar 2010 05:54:19 -0000 Issue 9023

user-digest-help

2010-03-09


Author LoginPost Reply

user Digest 9 Mar 2010 05:54:19 -0000 Issue 9023

Topics (messages 205306 through 205316):

Re: Cannot find bean: "bookList" in any scope
 205306 by: Pawe³ Wielgus
 205309 by: tesla
 205310 by: Martin Gainty
 205311 by: tesla

Expression tag.contains is undefined
 205307 by: Johannes Geppert

JSON not serializing all members of my object...
 205308 by: Stanley, Eric

Re: struts 2 - framework question
 205312 by: john lee
 205313 by: john lee
 205314 by: john lee
 205315 by: john lee
 205316 by: emil thushanga

Administrivia:

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

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


Attachment: user_205306.ezm (zipped)
Hi All,
also shouldn't it be < logic:iterate name="bookForm" property="bookList" >?

Best greetings,
Paweł Wielgus.


2010/3/8 <stanlick@(protected)>:
> You have bookList and listBook.  Change one of them.
>
> On Sun, Mar 7, 2010 at 8:25 PM, tesla <fatihdurdu@(protected):
>
>>
>> Hi i'm new at struts.I wanna write all the array elements which i defined
>> at
>> java class to the jsp file
>> but i'm getting this error
>> "javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot
>> find
>> bean: "bookList" in any scope"
>> Here is my code
>> Thx for helping
>>
>> Book.JAVA
>>
>> public class Book {
>>
>>    private String name;
>>    private int price;
>>    //private List books=new ArrayList();
>>
>>    Connection con ;
>>    Statement ps;
>>    ResultSet rs;
>>
>>    public ArrayList listBook() throws SQLException
>>    {
>>       ArrayList books=new ArrayList();
>>        try
>>        {
>>           Class.forName("com.mysql.jdbc.Driver");
>>            con =
>>
>> DriverManager.getConnection("jdbc:mysql://localhost:3306/logintest_development","root","pass");
>>            ps = con.createStatement();
>>            rs = ps.executeQuery("SELECT * FROM books");
>>            while(rs.next()){
>>                books.add(new perInfoBook(rs.getString("title")));
>>            }
>>
>>        }
>>    catch (Exception e)
>>    {
>>      System.out.println("Error Data : " + e.getMessage());
>>    }
>>        con.close();
>>        return  books;
>>    }
>>
>>
>>
>> public class perInfoBook
>> {
>>    String title;
>>   int bookid;
>>
>>    public perInfoBook(String title) {
>>        this.title = title;
>>
>>    }
>>
>> public String getTitle() {
>> return title;
>> }
>> public int getBookid() {return bookid;}
>>
>> }
>> }
>>
>>
>> BookForm.JAVA
>>
>> public class BookForm extends ActionForm{
>>
>>   private List bookList;
>>
>> public void reset(ActionMapping mapping,HttpServletRequest request){
>>   bookList=new ArrayList();
>> }
>>
>> BookAction.Java
>>
>> public class BookAction extends Action{
>>
>> public ActionForward execute(ActionMapping mapping, ActionForm form,
>> HttpServletRequest request,      HttpServletResponse response) throws
>> Exception {
>>
>> BookForm bookForm = (BookForm) form;
>> Book book = new Book();
>> bookForm.setBookList(book.listBook());
>> return mapping.findForward("success");
>>
>> }
>> }
>>
>> and here is my jsp code
>>
>> <body>
>>          <logic:iterate id="Table" name="bookList" >
>>              <tr>
>>                <td><bean:write name="Table" property="title"/></td>
>>              </tr>
>>          </logic:iterate>
>> </body>
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Cannot-find-bean%3A-%22bookList%22-in-any-scope-tp27816517p27816517.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>


Attachment: user_205309.ezm (zipped)

thx for helping but now when i run the application i see an empty page i
can't see books which i retrive from my database i guess my arraylist is
empty why it is??
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_205310.ezm (zipped)

the short answer is you'll need to populate your arraylist for any of the elements in the list to 'show up'

the long answer is
you'll need to supply jsp/struts-config.xml,struts.xml and backend beans,contents of Action class
and which struts version you are implementing on to be able to provide a solution for you

Martin Gainty
______________________________________________
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: Mon, 8 Mar 2010 13:51:10 -0800
> From: fatihdurdu@(protected)
> To: user@(protected)
> Subject: Re: Cannot find bean: "bookList" in any scope
>
>
> thx for helping but now when i run the application i see an empty page i
> can't see books which i retrive from my database i guess my arraylist is
> empty why it is??
> --
> View this message in context: http://old.nabble.com/Cannot-find-bean%3A-%22bookList%22-in-any-scope-tp27816517p27828192.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
           
_________________________________________________________________
Hotmail: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/201469228/direct/01/

Attachment: user_205311.ezm (zipped)

its struts 1 struts version 1.2.9 and also i added this code
"bookForm.getBookList().add("qwer") " to bookAction.java but still i cant
see array elemtens at the browser

its my struts config.xml

<action-mappings>
    <action path="/Welcome" forward="/welcomeStruts.jsp"/>
    <action
    path="/data"
    type="paket.BookAction"
    name="BookForm"
    scope="request"
    input="data.jsp">
    <forward name="success" path="/data.jsp" redirect="false" />
    </action>
  </action-mappings>




mgainty wrote:
>
>
> the short answer is you'll need to populate your arraylist for any of the
> elements in the list to 'show up'
>
> the long answer is
> you'll need to supply jsp/struts-config.xml,struts.xml and backend
> beans,contents of Action class
> and which struts version you are implementing on to be able to provide a
> solution for you
>
> Martin Gainty
> ______________________________________________
> 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: Mon, 8 Mar 2010 13:51:10 -0800
>> From: fatihdurdu@(protected)
>> To: user@(protected)
>> Subject: Re: Cannot find bean: "bookList" in any scope
>>
>>
>> thx for helping but now when i run the application i see an empty page i
>> can't see books which i retrive from my database i guess my arraylist is
>> empty why it is??
>> --
>> View this message in context:
>> http://old.nabble.com/Cannot-find-bean%3A-%22bookList%22-in-any-scope-tp27816517p27828192.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>            
> _________________________________________________________________
> Hotmail: Free, trusted and rich email service.
> http://clk.atdmt.com/GBL/go/201469228/direct/01/
>

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_205307.ezm (zipped)

Hello,

i want to include a freemarker template from the simple theme like this.

<#include "/${parameters.templateDir}/simple/checkboxlist.ftl" />

But I run always in an freemarker template error when I use it.

Expression tag.contains is undefined on line 39, column 14 in
template/simple/checkboxlist.ftl.
The problematic instruction:
----------
==> if tag.contains(parameters.nameValue, itemKey) [on line 39, column 9 in
template/simple/checkboxlist.ftl]
in user-directive s.iterator [on line 25, column 5 in
template/simple/checkboxlist.ftl]
in include "/${parameters.templateDir}/simple/checkboxlist.ftl" [on line
26, column 1 in template/jquery/checkboxlist.ftl]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression tag.contains is
undefined on line 39, column 14 in template/simple/checkboxlist.ftl.
 at freemarker.core.TemplateObject.assertNonNull (TemplateObject.java:124)
 at
freemarker.core.TemplateObject.invalidTypeException (TemplateObject.java:134)
 at freemarker.core.MethodCall._getAsTemplateModel (MethodCall.java:114)
 at freemarker.core.Expression.getAsTemplateModel (Expression.java:89)
 at freemarker.core.Expression.isTrue (Expression.java:138)
 at freemarker.core.ConditionalBlock.accept (ConditionalBlock.java:77)
 at freemarker.core.Environment.visit (Environment.java:209)
 at freemarker.core.MixedContent.accept (MixedContent.java:92)
 at freemarker.core.Environment.visit (Environment.java:209)
 at freemarker.core.Environment.visit (Environment.java:298)
 at freemarker.core.UnifiedCall.accept (UnifiedCall.java:130)
 at freemarker.core.Environment.visit (Environment.java:209)
 at freemarker.core.IfBlock.accept (IfBlock.java:82)
 at freemarker.core.Environment.visit (Environment.java:209)
 at freemarker.core.MixedContent.accept (MixedContent.java:92)
 at freemarker.core.Environment.visit (Environment.java:209)
 at freemarker.core.Environment.include (Environment.java:1482)
 at freemarker.core.Include.accept (Include.java:169)
 at freemarker.core.Environment.visit (Environment.java:209)
 at freemarker.core.MixedContent.accept (MixedContent.java:92)
 at freemarker.core.Environment.visit (Environment.java:209)
 at freemarker.core.IfBlock.accept (IfBlock.java:82)
 at freemarker.core.Environment.visit (Environment.java:209)
 at freemarker.core.MixedContent.accept (MixedContent.java:92)
 at freemarker.core.Environment.visit (Environment.java:209)
 at freemarker.core.Environment.process (Environment.java:189)
 at freemarker.template.Template.process (Template.java:237)
 at
org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate (FreemarkerTemplateEngine.java:182)
 at org.apache.struts2.components.UIBean.mergeTemplate (UIBean.java:559)
 at org.apache.struts2.components.ClosingUIBean.start (ClosingUIBean.java:59)
 at
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag (ComponentTagSupport.java:53)


Does anyone knows a solution for this problem?

Best Regards

Johannes Geppert

-----
---
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_205308.ezm (zipped)
All, running latest and greatest S2, and trying to convert a

HashMap<String, ArrayList<ProjectManager>>

To a JSON result. its all setup right, and it is serializing, but it always sets 2 of the members in the ProjectManager List objects to null. The members are Strings, one containing a phone number, and the other containing an email address. I have triple checked that the action is properly populating the HashMap. And again, it does serialize everything but the email and tn.



The only thing I can think of is that the email and TN contain the '+' and the '@'<mailto:'@(protected) :)

-Ryan

________________________________
This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.

Attachment: user_205312.ezm (zipped)
Cimballi,
 
tks for your help, but i do not  quite understand about '...set the parameter statically in the action definitions...',  would you demonstrate me couple line of psudo code to explain this?
 
tks in advance
 
john



/7/10, Cimballi <cimballi@(protected):


From: Cimballi <cimballi@(protected)>
Subject: Re: struts 2 - framework question
To: "john lee" <sh_thorn_bird@(protected)>
Cc: "Struts Users Mailing List" <user@(protected)>
Date: Sunday, March 7, 2010, 8:33 PM


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 lee <sh_thorn_bird@(protected):
>
>
>
> possible for you to show some psedo code for how to do it?
>
> tks in advance
>
> john
> --- On Sun, 3/7/10, Paweł Wielgus <poulwiel@(protected):
>
> From: Paweł Wielgus <poulwiel@(protected)>
> Subject: Re: struts 2 - framework question
> To: "Struts Users Mailing List" <user@(protected)
> 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 Cimballi <cimballi.cimballi@(protected)>:
> > 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 lee <sh_thorn_bird@(protected):
> >>
> >> 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-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

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





Attachment: user_205313.ezm (zipped)
Cimballi,
 
tks for your help, but i do not  quite understand about '...set the parameter statically in the action definitions...',  would you demonstrate me couple line of psudo code to explain this?
 
tks in advance
 
john



/7/10, Cimballi <cimballi@(protected):


From: Cimballi <cimballi@(protected)>
Subject: Re: struts 2 - framework question
To: "john lee" <sh_thorn_bird@(protected)>
Cc: "Struts Users Mailing List" <user@(protected)>
Date: Sunday, March 7, 2010, 8:33 PM


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 lee <sh_thorn_bird@(protected):
>
>
>
> possible for you to show some psedo code for how to do it?
>
> tks in advance
>
> john
> --- On Sun, 3/7/10, Paweł Wielgus <poulwiel@(protected):
>
> From: Paweł Wielgus <poulwiel@(protected)>
> Subject: Re: struts 2 - framework question
> To: "Struts Users Mailing List" <user@(protected)
> 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 Cimballi <cimballi.cimballi@(protected)>:
> > 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 lee <sh_thorn_bird@(protected):
> >>
> >> 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-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

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





Attachment: user_205314.ezm (zipped)
how apache/struts 2 handle multiple domain as your explain? could you explain in some detail? tks in advance
 
john 

--- On Mon, 3/8/10, stanlick@(protected):


From: stanlick@(protected)>
Subject: Re: struts 2 - framework question
To: "Struts Users Mailing List" <user@(protected)>
Date: Monday, March 8, 2010, 6:51 AM


If each company will have their own domain name this will solve itself.

On Sat, Mar 6, 2010 at 10:18 PM, john lee <sh_thorn_bird@(protected):

>
> 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
>
>
>




Attachment: user_205315.ezm (zipped)
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 <thushanga@(protected):


From: emil thushanga <thushanga@(protected)>
Subject: Re: struts 2 - framework question
To: "Struts Users Mailing List" <user@(protected)>
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
<alopez@(protected):
> 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 lee<sh_thorn_bird@(protected):
>>>
>>>
>>>
>>> possible for you to show some psedo code for how to do it?
>>>
>>> tks in advance
>>>
>>> john
>>> --- On Sun, 3/7/10, Paweł Wielgus<poulwiel@(protected):
>>>
>>> From: Paweł Wielgus<poulwiel@(protected)>
>>> Subject: Re: struts 2 - framework question
>>> To: "Struts Users Mailing List"<user@(protected)>,
>>> cimballi@(protected)
>>> 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 Cimballi<cimballi.cimballi@(protected)>:
>>>>
>>>> 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 lee<sh_thorn_bird@(protected)>
>>>>  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-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
Emil Thushanga
(Lets say i am Programmer/Developer)

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





Attachment: user_205316.ezm (zipped)
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_bird@(protected):
> 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 <thushanga@(protected):
>
>
> From: emil thushanga <thushanga@(protected)>
> Subject: Re: struts 2 - framework question
> To: "Struts Users Mailing List" <user@(protected)>
> 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
> <alopez@(protected):
>> 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 lee<sh_thorn_bird@(protected):
>>>>
>>>>
>>>>
>>>> possible for you to show some psedo code for how to do it?
>>>>
>>>> tks in advance
>>>>
>>>> john
>>>> --- On Sun, 3/7/10, Paweł Wielgus<poulwiel@(protected):
>>>>
>>>> From: Paweł Wielgus<poulwiel@(protected)>
>>>> Subject: Re: struts 2 - framework question
>>>> To: "Struts Users Mailing List"<user@(protected)>,
>>>> cimballi@(protected)
>>>> 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 Cimballi<cimballi.cimballi@(protected)>:
>>>>>
>>>>> 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 lee<sh_thorn_bird@(protected)>
>>>>>  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-unsubscribe@(protected)
>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
> --
> Emil Thushanga
> (Lets say i am Programmer/Developer)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
>



--
Emil Thushanga
(Lets say i am Programmer/Developer)

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