Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 8 Mar 2010 15:12:53 -0000 Issue 9022

user-digest-help

2010-03-08


Author LoginPost Reply

user Digest 8 Mar 2010 15:12:53 -0000 Issue 9022

Topics (messages 205286 through 205305):

Re: possible s:submit with parameter?
 205286 by: Burton Rhodes
 205290 by: adam pinder
 205292 by: Alex Rodriguez Lopez
 205302 by: lucas owen

Re: struts 2 - framework question
 205287 by: john lee
 205289 by: Cimballi
 205294 by: Alex Rodriguez Lopez
 205295 by: emil thushanga
 205300 by: stanlick.gmail.com

Cannot find bean: "bookList" in any scope
 205288 by: tesla
 205299 by: stanlick.gmail.com

S2 Forward to previous view (GoBack)
 205291 by: Marsman
 205293 by: Girish Naik

AJAX Validation (calls to action methods work on submit, but messages not displayed nor page redirected)
 205296 by: Alex Rodriguez Lopez
 205297 by: Alex Rodriguez Lopez

UriTemplates support in Struts.
 205298 by: Unmesh joshi

Re: How to do with Struts2(Similar to Web2.0 wizard)!!!!
 205301 by: emil thushanga

JQuery Struts 1
 205303 by: Jack Ryan

struts 2 display tag export problem
 205304 by: Rakesh K nair

problem with getText()
 205305 by: lucas owen

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_205286.ezm (zipped)
Adam is correct. Every item filled out in the form is sent to your
action. You can save these variables in the session or alternaitvely
store them in each subsequent jsp with hidden form variables. You can
use struts to display these properties/variables whereever you want. I
think you are making your requirement more complicated than necessary.

On 3/6/10, lucas owen <sr.ilustre@(protected):
> yes, of course...
>
> but imagine you have a list of elements, how do you pass the Id of the
> element you want to display in other page with a s:submit???
> (I cant use javascript)
> 2010/3/6 Adam Pinder <apinder@(protected)>
>
>> Any form textfield will be submitted when page submitted which is
>> effectively a parameter.
>>
>> Adam
>>
>>
>> On 5 Mar 2010, at 19:46, lucas owen <sr.ilustre@(protected):
>>
>> Hi Struts users:
>>>
>>> I'm wondering if it is possible to pass a parameter inside a s:submit
>>> tag.
>>>
>>> I'm working with the following form (this is just a sketch) on a webpage,
>>> in
>>> which I collect some user data and display a list of elements (let's say
>>> books):
>>>
>>>      ___________                 ____________
>>> Name:|___________|      Surname: |____________|
>>>
>>>
>>> List of Books:
>>>
>>>      Title
>>> Author                             Details
>>>
>>> --------------------------------------------------------------------------------------------------------------------------------------------
>>>       XYZ                     ABC
>>> <s:submit action="bookDetails" param="bookId">
>>>
>>>
>>> ...
>>>
>>> Note: it has to be a submit because if the user enters a name or surname,
>>> I
>>> want it to be displayed when the users comes back from the book details
>>> page!
>>>
>>> I dont know if this is possible with Struts 2
>>>
>>> Thanks in advance
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>

--
Sent from my mobile device


Attachment: user_205290.ezm (zipped)



in the form, make your booklist a select box (with id as the option value) or display as text with a radio button group (i.e. each book has the same radio button id) when you press submit, the id of the book selected will be sent to the action and you can use that to retrieve the book detail .....



> Date: Sun, 7 Mar 2010 10:26:39 -0600
> Subject: Re: possible s:submit with parameter?
> From: burtonrhodes@(protected)
> To: user@(protected)
>
> Adam is correct. Every item filled out in the form is sent to your
> action. You can save these variables in the session or alternaitvely
> store them in each subsequent jsp with hidden form variables. You can
> use struts to display these properties/variables whereever you want. I
> think you are making your requirement more complicated than necessary.
>
> On 3/6/10, lucas owen <sr.ilustre@(protected):
> > yes, of course...
> >
> > but imagine you have a list of elements, how do you pass the Id of the
> > element you want to display in other page with a s:submit???
> > (I cant use javascript)
> > 2010/3/6 Adam Pinder <apinder@(protected)>
> >
> >> Any form textfield will be submitted when page submitted which is
> >> effectively a parameter.
> >>
> >> Adam
> >>
> >>
> >> On 5 Mar 2010, at 19:46, lucas owen <sr.ilustre@(protected):
> >>
> >> Hi Struts users:
> >>>
> >>> I'm wondering if it is possible to pass a parameter inside a s:submit
> >>> tag.
> >>>
> >>> I'm working with the following form (this is just a sketch) on a webpage,
> >>> in
> >>> which I collect some user data and display a list of elements (let's say
> >>> books):
> >>>
> >>> ___________ ____________
> >>> Name:|___________| Surname: |____________|
> >>>
> >>>
> >>> List of Books:
> >>>
> >>> Title
> >>> Author Details
> >>>
> >>> --------------------------------------------------------------------------------------------------------------------------------------------
> >>> XYZ ABC
> >>> <s:submit action="bookDetails" param="bookId">
> >>>
> >>>
> >>> ...
> >>>
> >>> Note: it has to be a submit because if the user enters a name or surname,
> >>> I
> >>> want it to be displayed when the users comes back from the book details
> >>> page!
> >>>
> >>> I dont know if this is possible with Struts 2
> >>>
> >>> Thanks in advance
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@(protected)
> >> For additional commands, e-mail: user-help@(protected)
> >>
> >>
> >
>
> --
> Sent from my mobile device
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
           
_________________________________________________________________
Send us your Hotmail stories and be featured in our newsletter
http://clk.atdmt.com/UKM/go/195013117/direct/01/

Attachment: user_205292.ezm (zipped)
You can use hidden fields inside of the form which will be sent too on
submit as GET or POST params(usually good for IDs).

Alex

Em 05-03-2010 23:13, Adam Pinder escreveu:
> Any form textfield will be submitted when page submitted which is
> effectively a parameter.
>
> Adam
>
> On 5 Mar 2010, at 19:46, lucas owen <sr.ilustre@(protected):
>
>> Hi Struts users:
>>
>> I'm wondering if it is possible to pass a parameter inside a s:submit
>> tag.
>>
>> I'm working with the following form (this is just a sketch) on a
>> webpage, in
>> which I collect some user data and display a list of elements (let's say
>> books):
>>
>> ___________ ____________
>> Name:|___________| Surname: |____________|
>>
>>
>> List of Books:
>>
>> Title
>> Author Details
>> --------------------------------------------------------------------------------------------------------------------------------------------
>>
>> XYZ ABC
>> <s:submit action="bookDetails" param="bookId">
>>
>>
>> ...
>>
>> Note: it has to be a submit because if the user enters a name or
>> surname, I
>> want it to be displayed when the users comes back from the book details
>> page!
>>
>> I dont know if this is possible with Struts 2
>>
>> Thanks in advance
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>



Attachment: user_205302.ezm (zipped)
thanks to all

you have been very very helpful!!!

2010/3/8 Alex Rodriguez Lopez <alopez@(protected)>

> You can use hidden fields inside of the form which will be sent too on
> submit as GET or POST params(usually good for IDs).
>
> Alex
>
> Em 05-03-2010 23:13, Adam Pinder escreveu:
>
> Any form textfield will be submitted when page submitted which is
>> effectively a parameter.
>>
>> Adam
>>
>> On 5 Mar 2010, at 19:46, lucas owen <sr.ilustre@(protected):
>>
>> Hi Struts users:
>>>
>>> I'm wondering if it is possible to pass a parameter inside a s:submit
>>> tag.
>>>
>>> I'm working with the following form (this is just a sketch) on a
>>> webpage, in
>>> which I collect some user data and display a list of elements (let's say
>>> books):
>>>
>>> ___________ ____________
>>> Name:|___________| Surname: |____________|
>>>
>>>
>>> List of Books:
>>>
>>> Title
>>> Author Details
>>>
>>> --------------------------------------------------------------------------------------------------------------------------------------------
>>>
>>> XYZ ABC
>>> <s:submit action="bookDetails" param="bookId">
>>>
>>>
>>> ...
>>>
>>> Note: it has to be a submit because if the user enters a name or
>>> surname, I
>>> want it to be displayed when the users comes back from the book details
>>> page!
>>>
>>> I dont know if this is possible with Struts 2
>>>
>>> Thanks in advance
>>>
>>
>> ---------------------------------------------------------------------
>> 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_205287.ezm (zipped)
 
 
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)





Attachment: user_205289.ezm (zipped)
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)
>
>


Attachment: user_205294.ezm (zipped)
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)
>> 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_205295.ezm (zipped)
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)


Attachment: user_205300.ezm (zipped)
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_205288.ezm (zipped)

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>



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



Attachment: user_205299.ezm (zipped)
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_205291.ezm (zipped)

Hi!

how can I forward to the previous view (for a "go back" button)? I've read
about dynamic results. But how can I determine the view, the user comes
from? Or is there an easier way to implement this (without javascript)?

Titus

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



Attachment: user_205293.ezm (zipped)
Suppose the user is in Page 'A' and then he is redirected to 'B', now on
page 'B' you want to redirect him to page 'A'.

So we can do this by getting the request.getHeader("referer") on the
submitting action of page 'A' and store it in page 'B' 's go back button.


Regards,
---------------------------------------------------------
Girish Naik
Mobile:-+91-09740091638
girish.naik@(protected)


On Mon, Mar 8, 2010 at 2:34 PM, Marsman <mars.man@(protected):

>
> Hi!
>
> how can I forward to the previous view (for a "go back" button)? I've read
> about dynamic results. But how can I determine the view, the user comes
> from? Or is there an easier way to implement this (without javascript)?
>
> Titus
>
> --
> View this message in context:
> http://old.nabble.com/S2-Forward-to-previous-view-%28GoBack%29-tp27818680p27818680.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_205296.ezm (zipped)
Hi!

I'm updating validations on my app to use AJAX. I followed this:

http://struts.apache.org/2.0.14/docs/ajax-validation.html

Using dojo and <sx:submit validate=true/> tag, on a tipical User form page.

The problem: When I click the submit button on the form, on the client
side nothing happens, not a message displayed, not a page reload or
request. On the server side, interceptors are called as they should,
JSONInterceptor is called, and if there where no errors, the correct
action and method (UserAction.save()) is called, so the data gets really
saved, when I manually go back to the listing of the users, the user
name got changed accordingly to the form. The only thing is that it
appears like nothing happened when pressing the submit button.

Validation worked OK before trying to implement AJAX validation. Using
Struts 2.1.8, already have on /lib the struts2-dojo-plugin and
<sx:head/> on my jsps.

Any help on this? Thanks in advance!

Alex

Code:

### edit.jsp ###

<s:form action="save" namespace="/user" method="POST">
     <s:token/>
     <s:hidden name="user.userID" />
     <s:textfield name="user.name" size="35" >
       <s:param name="label">
         <s:text name="label.name" />
       </s:param>
     </s:textfield>
     <s:textfield name="user.email" size="35" >
       <s:param name="label">
         <s:text name="label.email" />
       </s:param>
     </s:textfield>
     <s:textarea name="user.address" cols="32" >
       <s:param name="label">
         <s:text name="label.address" />
       </s:param>
     </s:textarea>
     
     <sx:submit validate="true" type="button" />
</s:form>

### user-mappings.xml ###

<package name="user"
      namespace="/user"
      extends="default">

<action name="*" method="{1}" class="package.action.user.UserAction">
 <result type="redirect">list.action</result>
 <result name="list">/WEB-INF/content/user/list.jsp</result>
 <result name="input">/WEB-INF/content/user/edit.jsp</result>
</action>

</package>

### UserAction.java ###

public String save() throws Exception {
 ServiceUser.getInstance().save(getUser());
 return SUCCESS;
}

// getter and setter for user and other stuff

### UserAction-save-validation.xml ###

<validators>
<field name="user.name">
 <field-validator type="requiredstring">
 <message>
 ${getText("error.required", {getText("label.name")})}
 </message>
 </field-validator>
</field>
<field name="user.email">
 <field-validator type="requiredstring">
 <message>
 ${getText("error.required", {getText("label.email")})}
 </message>
 </field-validator>
 <field-validator type="email">
 <message>${getText("error.format.email")}</message>
 </field-validator>
</field>
</validators>


Attachment: user_205297.ezm (zipped)
I'm thinking this might be related to the AJAX Theme thing... is this
required to work with AJAX validation? Any other requeriments aside from
including the sx:head tag?

Em 08-03-2010 11:11, Alex Rodriguez Lopez escreveu:
> Hi!
>
> I'm updating validations on my app to use AJAX. I followed this:
>
> http://struts.apache.org/2.0.14/docs/ajax-validation.html
>
> Using dojo and <sx:submit validate=true/> tag, on a tipical User form page.
>
> The problem: When I click the submit button on the form, on the client
> side nothing happens, not a message displayed, not a page reload or
> request. On the server side, interceptors are called as they should,
> JSONInterceptor is called, and if there where no errors, the correct
> action and method (UserAction.save()) is called, so the data gets really
> saved, when I manually go back to the listing of the users, the user
> name got changed accordingly to the form. The only thing is that it
> appears like nothing happened when pressing the submit button.
>
> Validation worked OK before trying to implement AJAX validation. Using
> Struts 2.1.8, already have on /lib the struts2-dojo-plugin and
> <sx:head/> on my jsps.
>
> Any help on this? Thanks in advance!
>
> Alex
>
> Code:
>
> ### edit.jsp ###
>
> <s:form action="save" namespace="/user" method="POST">
> <s:token/>
> <s:hidden name="user.userID" />
> <s:textfield name="user.name" size="35" >
> <s:param name="label">
> <s:text name="label.name" />
> </s:param>
> </s:textfield>
> <s:textfield name="user.email" size="35" >
> <s:param name="label">
> <s:text name="label.email" />
> </s:param>
> </s:textfield>
> <s:textarea name="user.address" cols="32" >
> <s:param name="label">
> <s:text name="label.address" />
> </s:param>
> </s:textarea>
>
> <sx:submit validate="true" type="button" />
> </s:form>
>
> ### user-mappings.xml ###
>
> <package name="user"
> namespace="/user"
> extends="default">
>
> <action name="*" method="{1}" class="package.action.user.UserAction">
> <result type="redirect">list.action</result>
> <result name="list">/WEB-INF/content/user/list.jsp</result>
> <result name="input">/WEB-INF/content/user/edit.jsp</result>
> </action>
>
> </package>
>
> ### UserAction.java ###
>
> public String save() throws Exception {
> ServiceUser.getInstance().save(getUser());
> return SUCCESS;
> }
>
> // getter and setter for user and other stuff
>
> ### UserAction-save-validation.xml ###
>
> <validators>
> <field name="user.name">
> <field-validator type="requiredstring">
> <message>
> ${getText("error.required", {getText("label.name")})}
> </message>
> </field-validator>
> </field>
> <field name="user.email">
> <field-validator type="requiredstring">
> <message>
> ${getText("error.required", {getText("label.email")})}
> </message>
> </field-validator>
> <field-validator type="email">
> <message>${getText("error.format.email")}</message>
> </field-validator>
> </field>
> </validators>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>



Attachment: user_205298.ezm (zipped)

Hi,
We wanted to expose Restful URLs as explained in (http://uritemplate.codeplex.com/).
Currently struts has two action mappers which support Restful urls. RestFul2ActionMapper and Rest plugin's action mapper.
The problem with Restful2 action mapper is that it expects parameter names in url
e.g. If i want to have Url like
www.mysite.com/games/action/1999
In RestFul2ActionMapper I will need to give
www.mysite.com/games/type/action/year/1999
In Rest plugin I cant even have more than one parameters in the URL part because it always expects last part of url to be ID.
There is some thing I can do with use of namespaces, but there are limitations.

I want to be able to specify url templates like
/games/{gameType}/{year} and then match URL like games/action/1999 to action names GamesAction with type parameter set to action and year parameter set to 1999.
Is there way to achieve this with Struts2? Is anyone planning to write action mappers to support this?

Thanks,Unmesh            
_________________________________________________________________
Fight for the top Test spot
http://sports.in.msn.com/cricket/

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


Attachment: user_205303.ezm (zipped)
I see that there has been a plugin developed for asynchronous loading of UI
components using JQuery in Struts 2.

Could anybody tell me of anything comparable (e.g. custom tag libraries
using JQuery) for Struts 1?

Attachment: user_205304.ezm (zipped)


Hi

I am using following code for exporting all data from a table to excel and
pdf. It works ok with the columns, but I can´t export the footer and caption
tag.


<%@(protected)"%>
<%@(protected)"%>
<%@(protected)"%>
<jsp:directive.page import="org.displaytag.sample.*" />


<display:table name="sessionScope.persons" export="true" pagesize="2">

 <display:setProperty name="export.excel.filename" value="Person List.xls"/>
  <display:setProperty name="export.pdf.filename" value="Person
List.pdf"/>

  <display:setProperty name="decorator.media.pdf"
value="org.displaytag.sample.decorators.ItextTotalWrapper" />
  <display:setProperty name="decorator.media.excel"
value="org.displaytag.sample.decorators.HssfTotalWrapper" />

 <display:setProperty name="export.pdf" value="true" />
 <display:setProperty name="export.excel" value="true" />
 <display:setProperty name="export.csv" value="false" />
 <display:setProperty name="export.xml" value="false" />

 <display:caption media="html">
   <strong>A Caption</strong>
  </display:caption>
 <display:caption media="excel pdf">A Caption</display:caption>
 
 <display:footer media="html">
   <tr>
    <td colspan="4"><strong>Sample footer</strong></td>
   </tr>
  </display:footer>
 <display:footer media="excel pdf">Sample footer</display:footer>
 
 <display:column property="id" title="ID" />
 <display:column property="name" title="NAME"/>
 
 
</display:table>


Expecting your kind interaction

Thanks in advance

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



Attachment: user_205305.ezm (zipped)
Hi Struts users:

I'm working with Struts 2. I have following property file:

solicitud.error.solicitante.enCalidad = Debe introducir en calidad de del
solicitante.

.

.

.
solicitante.enCalidad = En calidad

I know keys are similar, but not the same. When I try to retrieve
getText(solicitud.error.solicitante.enCalidad), it yields "En calidad"

Is this a bug?

Thanks in advance!!
©2008 gg3721.com - Jax Systems, LLC, U.S.A.