Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 13 Jun 2008 17:11:26 -0000 Issue 8087

user-digest-help

2008-06-13


Author LoginPost Reply

user Digest 13 Jun 2008 17:11:26 -0000 Issue 8087

Topics (messages 187538 through 187567):

Re: how to read the 'potenrial list' from a database
 187538 by: srichin
 187543 by: Dave Newton
 187546 by: Onur Idrisoglu

Re: Form template
 187539 by: Ralf Fischer
 187540 by: Craftyman

Re: problems when using <s:iterate>
 187541 by: Dave Newton
 187550 by: Alexander Bätz

Re: [STRUTS2] Configuring Eclipse3.2 for struts2
 187542 by: Dave Newton

Re: Struts 2 and Velocity Intergration
 187544 by: Dave Newton

[Struts 2] Two action classes ?
 187545 by: Milan Milanovic
 187552 by: Dave Newton
 187554 by: Milan Milanovic
 187556 by: Dave Newton
 187558 by: Milan Milanovic
 187559 by: Dave Newton
 187560 by: Milan Milanovic
 187561 by: Al Sutton
 187563 by: Dave Newton
 187564 by: Milan Milanovic
 187566 by: Milan Milanovic

Re: adding a header in a struts 2 interceptor
 187547 by: Page
 187549 by: Page
 187555 by: Dave Newton

Execute And Wait
 187548 by: Ian Meikle

Ajax and page refresh
 187551 by: Paranoid_Fabio

[OT] Re: struts2: how to read the 'potenrial list' from a database
 187553 by: Dave Newton
 187567 by: xianwinwin

Response already committed when using ActionTag
 187557 by: David.W.Larson.mhn.com

struts 2 datetimepicker does not fire events
 187562 by: Ramesh K
 187565 by: Dave Newton

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_187538.ezm (zipped)

I'm trying to use a autocompleter that is to be built from a list (of
objects).

I want the objects id to be the value of the option and code to bethe label
to be shown in the autocompleter dropdown options.

I should be shown codes as select options in the dropdown and when I select
any of the code, the corresponding id should go as the value that has been
selected

Pointers on this would be of great help


newton.dave wrote:
>
> Search a database of city names?
>
> I'm not sure what you're asking.
>
>
> --- On Thu, 6/12/08, xianwinwin <xianwinwin@(protected):
>
>> From: xianwinwin <xianwinwin@(protected)>
>> Subject: struts2: how to read the 'potenrial list' from a database
>> To: user@(protected)
>> Date: Thursday, June 12, 2008, 6:07 PM
>> I have a list of 20,000 cities; I would like the user to
>> provide at least 2
>> chars and then present him a'potential list'.
>>
>> I managed to do this:
>>
>> JSP
>>
>> <s:autocompleter theme="simple"
>> list="state" name="StateName"/>
>>
>>
>>
>> Java:
>>
>> public class autocompleter extends ActionSupport
>> {
>>  private List state;
>>  public String execute() throws Exception{
>>   state = new ArrayList();
>>   state.add("Bonn");
>>   state.add("Paris");
>> .
>> .
>> .
>>
>>   return SUCCESS;
>>  }
>>  
>>   public List getState(){
>>   return state;
>>  }
>> }
>>
>> as you can see, the autocompliter is based on the
>> 'state' I initially
>> provided. But what if the list is huge???
>>
>> Q: How can I invoke an action once the user types a letter
>> (str) and the
>> string gets to the invoked-method (based on the str the
>> method will invoke
>> the appropriate list)
>>
>> thank you!!!
>> --
>> View this message in context:
>> http://www.nabble.com/struts2%3A-how-to-read-the-%27potenrial-list%27-from-a-database-tp17810726p17810726.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)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

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


Attachment: user_187543.ezm (zipped)
--- On Fri, 6/13/08, srichin <sridevi_chinnammal@(protected):
> I want the objects id to be the value of the option and
> code to bethe label to be shown in the autocompleter dropdown options.
>
> I should be shown codes as select options in the dropdown and when I
> select any of the code, the corresponding id should go as the
> value that has been selected
>
> Pointers on this would be of great help

I understand what you're trying to do, I don't understand what specific aspect you're having a problem with. You said you implemented the action with a hard-coded list. An action that uses a database instead is almost exactly the same, but it accesses a database instead of using a hard-coded list.

The Struts 2.0 autocompleter docs [1] summarize the usage of the tag; the action will be called with the current value in the text box. You use that partial value to do a database search (or filter an existing list, or however you'll implement that part).

Dave

[1] http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocompleterTag

> newton.dave wrote:
> >
> > Search a database of city names?
> >
> > I'm not sure what you're asking.
> >
> > --- On Thu, 6/12/08, xianwinwin
> <xianwinwin@(protected):
>>> I have a list of 20,000 cities; I would like the
>>> user to provide at least 2 chars and then present him a'potential
> list'.
> >>
> >> I managed to do this:
> >>
> >> JSP
> >>
> >> <s:autocompleter theme="simple"
> >> list="state"
> name="StateName"/>
> >>
> >>
> >>
> >> Java:
> >>
> >> public class autocompleter extends ActionSupport
> >> {
> >>  private List state;
> >>  public String execute() throws Exception{
> >>   state = new ArrayList();
> >>   state.add("Bonn");
> >>   state.add("Paris");
> >> .
> >> .
> >> .
> >>
> >>   return SUCCESS;
> >>  }
> >>  
> >>   public List getState(){
> >>   return state;
> >>  }
> >> }
> >>
> >> as you can see, the autocompliter is based on the
> >> 'state' I initially
> >> provided. But what if the list is huge???
> >>
> >> Q: How can I invoke an action once the user types
> a letter
> >> (str) and the
> >> string gets to the invoked-method (based on the
> str the
> >> method will invoke
> >> the appropriate list)
> >>
> >> thank you!!!
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/struts2%3A-how-to-read-the-%27potenrial-list%27-from-a-database-tp17810726p17810726.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)
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> > For additional commands, e-mail:
> user-help@(protected)
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/struts2%3A-autocompleter---howto-read-the-%27potenrial-list%27-from-a-database-tp17810726p17820863.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_187546.ezm (zipped)
I'm not sure if you can do that with autocompleter..
Autocompleter need the whole list at startup, but as I understand you want
to shape this list dynamically according to what user types. Each time user
types a character, the action will create a new list...

Maybe you can use DWR to do this

On Fri, Jun 13, 2008 at 3:13 PM, Dave Newton <newton.dave@(protected):

> --- On Fri, 6/13/08, srichin <sridevi_chinnammal@(protected):
> > I want the objects id to be the value of the option and
> > code to bethe label to be shown in the autocompleter dropdown options.
> >
> > I should be shown codes as select options in the dropdown and when I
> > select any of the code, the corresponding id should go as the
> > value that has been selected
> >
> > Pointers on this would be of great help
>
> I understand what you're trying to do, I don't understand what specific
> aspect you're having a problem with. You said you implemented the action
> with a hard-coded list. An action that uses a database instead is almost
> exactly the same, but it accesses a database instead of using a hard-coded
> list.
>
> The Struts 2.0 autocompleter docs [1] summarize the usage of the tag; the
> action will be called with the current value in the text box. You use that
> partial value to do a database search (or filter an existing list, or
> however you'll implement that part).
>
> Dave
>
> [1]
> http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocompleterTag
>
> > newton.dave wrote:
> > >
> > > Search a database of city names?
> > >
> > > I'm not sure what you're asking.
> > >
> > > --- On Thu, 6/12/08, xianwinwin
> > <xianwinwin@(protected):
> >>> I have a list of 20,000 cities; I would like the
> >>> user to provide at least 2 chars and then present him a'potential
> > list'.
> > >>
> > >> I managed to do this:
> > >>
> > >> JSP
> > >>
> > >> <s:autocompleter theme="simple"
> > >> list="state"
> > name="StateName"/>
> > >>
> > >>
> > >>
> > >> Java:
> > >>
> > >> public class autocompleter extends ActionSupport
> > >> {
> > >>  private List state;
> > >>  public String execute() throws Exception{
> > >>   state = new ArrayList();
> > >>   state.add("Bonn");
> > >>   state.add("Paris");
> > >> .
> > >> .
> > >> .
> > >>
> > >>   return SUCCESS;
> > >>  }
> > >>
> > >>   public List getState(){
> > >>   return state;
> > >>  }
> > >> }
> > >>
> > >> as you can see, the autocompliter is based on the
> > >> 'state' I initially
> > >> provided. But what if the list is huge???
> > >>
> > >> Q: How can I invoke an action once the user types
> > a letter
> > >> (str) and the
> > >> string gets to the invoked-method (based on the
> > str the
> > >> method will invoke
> > >> the appropriate list)
> > >>
> > >> thank you!!!
> > >> --
> > >> View this message in context:
> > >>
> >
> http://www.nabble.com/struts2%3A-how-to-read-the-%27potenrial-list%27-from-a-database-tp17810726p17810726.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)
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > user-unsubscribe@(protected)
> > > For additional commands, e-mail:
> > user-help@(protected)
> > >
> > >
> > >
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/struts2%3A-autocompleter---howto-read-the-%27potenrial-list%27-from-a-database-tp17810726p17820863.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)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
-- --
Onur Idrisoglu

Attachment: user_187539.ezm (zipped)
Hi Matthieu,

On Fri, Jun 13, 2008 at 11:08 AM, Matthieu MARC
<matthieu.marc@(protected):
> Hi,
>
> I am making a form page with jstl tags :
>
> <%@(protected)" %>
>
> <s:form>
>   <s:hidden name="week.username" value="%{week.username}" />
>   <s:iterator value="week.daysOfWeek">
>     <s:label labelposition="top" value="%{getText(displayName)}"
> cssStyle="font-weight: bold;" />
>     <s:select name="week.daysOfWeek[%{index}].am" onchange="countHour();"
> id="am%{index}" key="timetable.morning" list="heures" value="%{am}" />
>     <s:select name="week.daysOfWeek[%{index}].pm" onchange="countHour();"
> id="pm%{index}" key="timetable.afternoon" list="heures" value="%{pm}" />
>  </s:iterator>
>   <s:label id="tpsTotal" labelposition="left" key="timetable.totalTime"
> name="tpsTotal" />
>  <s:submit name="submitChange" value="Submit"
> action="timetableRecordChange" />
>  <s:submit name="submitCancel" value="Cancel" action="timetableDisplay" />
> </s:form>

Well, IMO you don't use ANY JSTL tag in the code snipplet here.

> The code generated used TABLE, TR and TD to put the different element on the
> page. I would prefered to use DIV, P and SPAN but I don't know how to do.
> Looking at the s:form element, I found the parameter template, but I didn't
> manage to find any documentation on how to use the paramater.
>
> Can someone give me some link to documentation on templating a form in order
> to use anything else than a table based formated page ?

That would be here [1].

Bye,
-Ralf


[1] http://struts.apache.org/2.0.11.1/docs/extending-themes.html

Attachment: user_187540.ezm (zipped)
Hi,

You can use theme="simple" in your tag to disable table mode. Ex : <s:form
theme="simple" >

Cédric

2008/6/13 Ralf Fischer <themakii@(protected)>:

> Hi Matthieu,
>
> On Fri, Jun 13, 2008 at 11:08 AM, Matthieu MARC
> <matthieu.marc@(protected):
> > Hi,
> >
> > I am making a form page with jstl tags :
> >
> > <%@(protected)" %>
> >
> > <s:form>
> >   <s:hidden name="week.username" value="%{week.username}" />
> >   <s:iterator value="week.daysOfWeek">
> >     <s:label labelposition="top" value="%{getText(displayName)}"
> > cssStyle="font-weight: bold;" />
> >     <s:select name="week.daysOfWeek[%{index}].am"
> onchange="countHour();"
> > id="am%{index}" key="timetable.morning" list="heures" value="%{am}" />
> >     <s:select name="week.daysOfWeek[%{index}].pm"
> onchange="countHour();"
> > id="pm%{index}" key="timetable.afternoon" list="heures" value="%{pm}" />
> >  </s:iterator>
> >   <s:label id="tpsTotal" labelposition="left" key="timetable.totalTime"
> > name="tpsTotal" />
> >  <s:submit name="submitChange" value="Submit"
> > action="timetableRecordChange" />
> >  <s:submit name="submitCancel" value="Cancel" action="timetableDisplay"
> />
> > </s:form>
>
> Well, IMO you don't use ANY JSTL tag in the code snipplet here.
>
> > The code generated used TABLE, TR and TD to put the different element on
> the
> > page. I would prefered to use DIV, P and SPAN but I don't know how to do.
> > Looking at the s:form element, I found the parameter template, but I
> didn't
> > manage to find any documentation on how to use the paramater.
> >
> > Can someone give me some link to documentation on templating a form in
> order
> > to use anything else than a table based formated page ?
>
> That would be here [1].
>
> Bye,
> -Ralf
>
>
> [1] http://struts.apache.org/2.0.11.1/docs/extending-themes.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_187541.ezm (zipped)
--- On Fri, 6/13/08, Alexander Bätz <baetz.paderborn@(protected):
> i'm making my first steps with struts and currently
> i'm testing the s:iterate tag. Unfortunately my test wont work.
>
> at first i created an action with a getter that returns a
> ArrayList of a special class. then i tried to iterate over that list.
>
> at first nothing happend. the tag didnt work, neither for
> my list of objects nor for a simple list of strings. Then i added the
> jar of commons-collection to my build path an now it will at least
> iterate over strings.

> can somebody help?

How? What would we use to diagnose the problem?

Dave


Attachment: user_187550.ezm (zipped)
Hi,

I would suggest experience or some insight to the requirements of
struts2 that i don't have.
yes, you can get my code, but since it is quite the same than some
iterate-examples that work (at least if you follow their authors) that
part should be correct.

the action:

  public class GetEntriesAction extends ActionSupport {
    public String execute() { return "success"; }
   
    public ArrayList<EntriesBean> getEntries() {
      EntriesBean bean = new EntriesBean();
      bean.setAuthor("blubb");
      ArrayList<EntriesBean> ret = new ArrayList<EntriesBean>();
      ret.add(bean);
      return ret;
    }

    public List<String> getTest() {
      ArrayList<String> ret = new ArrayList<String>();
      ret.add("hello1");
      ret.add("hallo2");
      return ret;
    }
  }

The Entries-Class

  public class EntriesBean {
    private String author;
   
    public String getAuthor() { return author; }
  }

The JSP

|<s:iterator value="entries" id="curEntry">
 <s:property value="author" /></td>
 objecttest
</s:iterator>
<s:iterator value="test" id="curtest">
 <s:property />
 stringtest
</s:iterator>|

The test with the stringarray works, the test with the entries class doesnt.

I created the project by importing the blank 2.0.11 war into eclipse.
maybe that helps too.

Greetings,
Alex

PS: short link to the example i was using
http://www.struts2.org/struts2-control-tags-using-iterator-tag/


Dave Newton schrieb:
> --- On Fri, 6/13/08, Alexander Bätz <baetz.paderborn@(protected):
>  
>> i'm making my first steps with struts and currently
>> i'm testing the s:iterate tag. Unfortunately my test wont work.
>>
>> at first i created an action with a getter that returns a
>> ArrayList of a special class. then i tried to iterate over that list.
>>
>> at first nothing happend. the tag didnt work, neither for
>> my list of objects nor for a simple list of strings. Then i added the
>> jar of commons-collection to my build path an now it will at least
>> iterate over strings.
>>  
>
>  
>> can somebody help?
>>  
>
> How? What would we use to diagnose the problem?
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>  


Attachment: user_187542.ezm (zipped)
--- On Fri, 6/13/08, Thulasi S. <thulasi@(protected):
> I am newbie to Struts2 & I am using Eclipse3.2.
> Could anyone help me on this regard?

S2 is just another web framework; no special configuration is necessary other than creating a web application project and putting the appropriate libraries into /WEB-INF/lib.

You may also use Maven to create a skeleton S2 project, including Eclipse project files; I'm not very familiar with the process though.

Dave


Attachment: user_187544.ezm (zipped)
--- On Fri, 6/13/08, dim5b <dim5b@(protected):
> Can anyone point out a clear demo of how i can integrate
> Velocity with Struts i have followed the guide in
> http://struts.apache.org/2.0.11/docs/velocity.html
>
> but no success i am trying to integrate with VelocityTools
> is this no supported in Struts 2

AFAIK Velocity works fine, although I haven't tested it for awhile.

It might be helpful to provide information detailing what, exactly, is happening that's wrong.

Dave


Attachment: user_187545.ezm (zipped)

Hi,

I want to have two action classes, the first class called SearchAction will
search from database and show results in a jsp page. When user click some
row I want to pass that value (through a session) to another action class
called EditAction which will then show that object for editing. Is this
possible to define in Struts 2?

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


Attachment: user_187552.ezm (zipped)
--- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
> I want to have two action classes, the first class called
> SearchAction will search from database and show results in a jsp page.
> When user click some row I want to pass that value (through a session) to
> another action class called EditAction which will then show that object
> for editing. Is this possible to define in Struts 2?

Pass *what* value? You can't "pass an object" to an action. You could pass an ID. You could use that to *retrieve* an object from the session, if your application is small enough that it can keep all those objects in session for all the users.

It's more likely you'd use the ID to get the full object from a database, though.

Dave


Attachment: user_187554.ezm (zipped)

Hi,

I want to read object from database in the first action class (i.e. Fruit
fruit) to store it into session and then to call other action class method
for editing of that method, is it possible ?

--
Thx, Milan


newton.dave wrote:
>
> --- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
>> I want to have two action classes, the first class called
>> SearchAction will search from database and show results in a jsp page.
>> When user click some row I want to pass that value (through a session) to
>> another action class called EditAction which will then show that object
>> for editing. Is this possible to define in Struts 2?
>
> Pass *what* value? You can't "pass an object" to an action. You could pass
> an ID. You could use that to *retrieve* an object from the session, if
> your application is small enough that it can keep all those objects in
> session for all the users.
>
> It's more likely you'd use the ID to get the full object from a database,
> though.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

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


Attachment: user_187556.ezm (zipped)
--- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
> I want to read object from database in the first action class
> (i.e. Fruit fruit) to store it into session and then to call
> other action class method for editing of that method, is it possible ?

Oh, I thought you said you were retrieving a *list* of objects and wanted to edit a particular one (the one the user clicks on).

If the object is already in session of course you can retrieve it from the session in the second action.

I'm pretty skeptical that we're communicating accurately here, though.

Dave


Attachment: user_187558.ezm (zipped)

Hi Dave,

Yes that's what I want. The first action search in database and show the
list of Fruits. Then user click on one and that concrete Fruit object is
passed to other action for editing.

--
Thx, Milan


newton.dave wrote:
>
> --- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
>> I want to read object from database in the first action class
>> (i.e. Fruit fruit) to store it into session and then to call
>> other action class method for editing of that method, is it possible ?
>
> Oh, I thought you said you were retrieving a *list* of objects and wanted
> to edit a particular one (the one the user clicks on).
>
> If the object is already in session of course you can retrieve it from the
> session in the second action.
>
> I'm pretty skeptical that we're communicating accurately here, though.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

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


Attachment: user_187559.ezm (zipped)
--- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
> Yes that's what I want. The first action search in database and show the
> list of Fruits. Then user click on one and that concrete Fruit object is
> passed to other action for editing.

All you can pass in an HTTP request is a string.

You can *use* that string to create or retrieve an object.

Dave


Attachment: user_187560.ezm (zipped)

But could I pass object through session object ?


newton.dave wrote:
>
> --- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
>> Yes that's what I want. The first action search in database and show the
>> list of Fruits. Then user click on one and that concrete Fruit object is
>> passed to other action for editing.
>
> All you can pass in an HTTP request is a string.
>
> You can *use* that string to create or retrieve an object.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

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


Attachment: user_187561.ezm (zipped)
If you're using a persistence framework (Hibernate, JPA, etc.) then No.

During after the first request the EntityManager will be closed, so when
you access it during the second request updates will not be propagated
to the database.

Al.

Milan Milanovic wrote:
> But could I pass object through session object ?
>
>
> newton.dave wrote:
>  
>> --- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
>>  
>>> Yes that's what I want. The first action search in database and show the
>>> list of Fruits. Then user click on one and that concrete Fruit object is
>>> passed to other action for editing.
>>>    
>> All you can pass in an HTTP request is a string.
>>
>> You can *use* that string to create or retrieve an object.
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>>  
>
>  


Attachment: user_187563.ezm (zipped)
--- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
> But could I pass object through session object ?

I don't know how to answer that.

If you have a list of objects in the session you could use the id to retrieve the object from the session (if it's in a map, or if you iterate over the list and search, etc.)

How would you put the object into the session from the browser?

Dave

>
>
> newton.dave wrote:
> >
> > --- On Fri, 6/13/08, Milan Milanovic
> <milanmilanovich@(protected):
> >> Yes that's what I want. The first action
> search in database and show the
> >> list of Fruits. Then user click on one and that
> concrete Fruit object is
> >> passed to other action for editing.
> >
> > All you can pass in an HTTP request is a string.
> >
> > You can *use* that string to create or retrieve an
> object.
> >
> > Dave
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> > For additional commands, e-mail:
> user-help@(protected)
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-Struts-2--Two-action-classes---tp17824236p17827033.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_187564.ezm (zipped)

Yes, EntityManager will be closed, but it always closes whenevery you do
something (read/write) your object from database, isn't it ? When I read for
example Fruit (id=1) from database, change it and try to save it will know
with new EntityManager instance to save it because of id number ?

--
Thx, Milan


Al Sutton wrote:
>
> If you're using a persistence framework (Hibernate, JPA, etc.) then No.
>
> During after the first request the EntityManager will be closed, so when
> you access it during the second request updates will not be propagated
> to the database.
>
> Al.
>
> Milan Milanovic wrote:
>> But could I pass object through session object ?
>>
>>
>> newton.dave wrote:
>>  
>>> --- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
>>>  
>>>> Yes that's what I want. The first action search in database and show
>>>> the
>>>> list of Fruits. Then user click on one and that concrete Fruit object
>>>> is
>>>> passed to other action for editing.
>>>>    
>>> All you can pass in an HTTP request is a string.
>>>
>>> You can *use* that string to create or retrieve an object.
>>>
>>> Dave
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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)
>
>
>

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


Attachment: user_187566.ezm (zipped)

When user clicks on one object in jsp list, its id is set in action class and
the method in action class is called which will based on that id choose from
the list and put that object in session. Then with redirect-action (somehow)
I will call another action for editing that object from session. Is this
scenario O.K. ?

--
Thx, Milan


newton.dave wrote:
>
> --- On Fri, 6/13/08, Milan Milanovic <milanmilanovich@(protected):
>> But could I pass object through session object ?
>
> I don't know how to answer that.
>
> If you have a list of objects in the session you could use the id to
> retrieve the object from the session (if it's in a map, or if you iterate
> over the list and search, etc.)
>
> How would you put the object into the session from the browser?
>
> Dave
>
>>
>>
>> newton.dave wrote:
>> >
>> > --- On Fri, 6/13/08, Milan Milanovic
>> <milanmilanovich@(protected):
>> >> Yes that's what I want. The first action
>> search in database and show the
>> >> list of Fruits. Then user click on one and that
>> concrete Fruit object is
>> >> passed to other action for editing.
>> >
>> > All you can pass in an HTTP request is a string.
>> >
>> > You can *use* that string to create or retrieve an
>> object.
>> >
>> > Dave
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail:
>> user-unsubscribe@(protected)
>> > For additional commands, e-mail:
>> user-help@(protected)
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-Struts-2--Two-action-classes---tp17824236p17827033.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)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

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


Attachment: user_187547.ezm (zipped)


newton.dave wrote:
>
> http://struts.apache.org/2.x/docs/writing-interceptors.html
>
> The result has already been rendered after the invoke, so header
> modification would be a bit superfluous ;)
>

I guess I'm going about this the wrong way. I want the other developers on
the team to be able to write actions without worrying about adding in code
to support the in-house framework, so an interceptor that could execute
after the action seemed like a fit - except that it can't modify the
request. So is there a better approach that could still keep my actions
clean?
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_187549.ezm (zipped)



Page wrote:
>
> - except that it can't modify the request.
>

sorry, meant can't modify the response
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_187555.ezm (zipped)
--- On Fri, 6/13/08, Page <jpage@(protected):
> http://struts.apache.org/2.x/docs/writing-interceptors.html
> >
> > The result has already been rendered after the invoke,
> so header
> > modification would be a bit superfluous ;)
> >
>
> I guess I'm going about this the wrong way. I want the
> other developers on
> the team to be able to write actions without worrying about
> adding in code
> to support the in-house framework, so an interceptor that
> could execute
> after the action seemed like a fit - except that it
> can't modify the
> request. So is there a better approach that could still
> keep my actions
> clean?

I think you may have missed the nub of my gist; I'm saying that the colored box at [1] with the blurb about the PreResultListener may be what you need.

Dave

[1] http://struts.apache.org/2.x/docs/writing-interceptors.html


Attachment: user_187548.ezm (zipped)

Hi,

Does anyone have any experience of using the execute and wait interceptor in
a clustered environment.
I see the interceptor put the BackgroundProcess object in the session. This
object has a reference to among other things the action. If the app server
is using a DB to share session information I am wondering about the
performance of serializing this object to and from the DB for each "update"
refresh ?

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


Attachment: user_187551.ezm (zipped)

Hello. I'm using Struts2 with Ajax support and I'm able to refresh the
content of a div with remote content via Ajax calls.
Anyway I've a problem: when the div is refreshed, the page is scrolled up to
the top, like if the entire page is refreshed.That's it, if I scroll down
the page and then i click on the ajax anchor, the div is refreshed with the
remote content, but the page is scrolled up...
The code is very simple:

<s:url id="ajaxCallUrl" action="CreateOverviewTable">
      .... some params
</s:url>

the button:

<s:a href="%{ajaxCallUrl}" theme="ajax" targets="summary_div" > ....

the div:

<s:div theme="ajax" id="summary_div" href="%{ajaxCallUrl}"
indicator="indicator1"/>

....

and finally, the action mapping:

<action name="CreateOverviewTable" class="actions.stats.StatisticsGen"
method="createOverviewTable">
 <result name="success">/pages/OverviewTable.jsp</result>
</action>

The div is refreshed with the new table (OverviewTable.jsp) but the page is
scrolled up. How can I avoid that?

Thank you!



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


Attachment: user_187553.ezm (zipped)
No CC. Just list. I don't need two copies of all list traffic.


--- On Fri, 6/13/08, Onur Idrisoglu <onur.idrisoglu@(protected):

> From: Onur Idrisoglu <onur.idrisoglu@(protected)>
> Subject: Re: struts2: how to read the 'potenrial list' from a database
> To: "Struts Users Mailing List" <user@(protected)
> Date: Friday, June 13, 2008, 10:09 AM
> I'm not sure if you can do that with autocompleter..
> Autocompleter need the whole list at startup, but as I
> understand you want
> to shape this list dynamically according to what user
> types. Each time user
> types a character, the action will create a new list...
>
> Maybe you can use DWR to do this
>
> On Fri, Jun 13, 2008 at 3:13 PM, Dave Newton
> <newton.dave@(protected):
>
> > --- On Fri, 6/13/08, srichin
> <sridevi_chinnammal@(protected):
> > > I want the objects id to be the value of the
> option and
> > > code to bethe label to be shown in the
> autocompleter dropdown options.
> > >
> > > I should be shown codes as select options in the
> dropdown and when I
> > > select any of the code, the corresponding id
> should go as the
> > > value that has been selected
> > >
> > > Pointers on this would be of great help
> >
> > I understand what you're trying to do, I don't
> understand what specific
> > aspect you're having a problem with. You said you
> implemented the action
> > with a hard-coded list. An action that uses a database
> instead is almost
> > exactly the same, but it accesses a database instead
> of using a hard-coded
> > list.
> >
> > The Struts 2.0 autocompleter docs [1] summarize the
> usage of the tag; the
> > action will be called with the current value in the
> text box. You use that
> > partial value to do a database search (or filter an
> existing list, or
> > however you'll implement that part).
> >
> > Dave
> >
> > [1]
> >
> http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocompleterTag
> >
> > > newton.dave wrote:
> > > >
> > > > Search a database of city names?
> > > >
> > > > I'm not sure what you're asking.
> > > >
> > > > --- On Thu, 6/12/08, xianwinwin
> > > <xianwinwin@(protected):
> > >>> I have a list of 20,000 cities; I would
> like the
> > >>> user to provide at least 2 chars and then
> present him a'potential
> > > list'.
> > > >>
> > > >> I managed to do this:
> > > >>
> > > >> JSP
> > > >>
> > > >> <s:autocompleter
> theme="simple"
> > > >> list="state"
> > > name="StateName"/>
> > > >>
> > > >>
> > > >>
> > > >> Java:
> > > >>
> > > >> public class autocompleter extends
> ActionSupport
> > > >> {
> > > >>  private List state;
> > > >>  public String execute() throws
> Exception{
> > > >>   state = new ArrayList();
> > > >>   state.add("Bonn");
> > > >>   state.add("Paris");
> > > >> .
> > > >> .
> > > >> .
> > > >>
> > > >>   return SUCCESS;
> > > >>  }
> > > >>
> > > >>   public List getState(){
> > > >>   return state;
> > > >>  }
> > > >> }
> > > >>
> > > >> as you can see, the autocompliter is
> based on the
> > > >> 'state' I initially
> > > >> provided. But what if the list is
> huge???
> > > >>
> > > >> Q: How can I invoke an action once the
> user types
> > > a letter
> > > >> (str) and the
> > > >> string gets to the invoked-method (based
> on the
> > > str the
> > > >> method will invoke
> > > >> the appropriate list)
> > > >>
> > > >> thank you!!!
> > > >> --
> > > >> View this message in context:
> > > >>
> > >
> >
> http://www.nabble.com/struts2%3A-how-to-read-the-%27potenrial-list%27-from-a-database-tp17810726p17810726.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)
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > user-unsubscribe@(protected)
> > > > For additional commands, e-mail:
> > > user-help@(protected)
> > > >
> > > >
> > > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://www.nabble.com/struts2%3A-autocompleter---howto-read-the-%27potenrial-list%27-from-a-database-tp17810726p17820863.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)
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> > For additional commands, e-mail:
> user-help@(protected)
> >
> >
>
>
> --
> -- --
> Onur Idrisoglu

Attachment: user_187567.ezm (zipped)

OK...I'm getting there! I got the idea: loadOnTextChange.

so I ended up with this JSP:

<s:url id="json" value="/groupManagement_potentialList.do" />
<s:autocompleter href="%{json}" loadOnTextChange="true"
loadMinimumCount="1"  showDownArrow="true" name="userKeys" theme="ajax"
autoComplete="true"/>

BUT where is the list?!?!?!
I can invoke a method, but how does the statement above knows which list to
use?!
And what should the potentialList method return?

THANKS for any pointers!




newton.dave wrote:
>
> No CC. Just list. I don't need two copies of all list traffic.
>
>
> --- On Fri, 6/13/08, Onur Idrisoglu <onur.idrisoglu@(protected):
>
>> From: Onur Idrisoglu <onur.idrisoglu@(protected)>
>> Subject: Re: struts2: how to read the 'potenrial list' from a database
>> To: "Struts Users Mailing List" <user@(protected)>,
>> newton.dave@(protected)
>> Date: Friday, June 13, 2008, 10:09 AM
>> I'm not sure if you can do that with autocompleter..
>> Autocompleter need the whole list at startup, but as I
>> understand you want
>> to shape this list dynamically according to what user
>> types. Each time user
>> types a character, the action will create a new list...
>>
>> Maybe you can use DWR to do this
>>
>> On Fri, Jun 13, 2008 at 3:13 PM, Dave Newton
>> <newton.dave@(protected):
>>
>> > --- On Fri, 6/13/08, srichin
>> <sridevi_chinnammal@(protected):
>> > > I want the objects id to be the value of the
>> option and
>> > > code to bethe label to be shown in the
>> autocompleter dropdown options.
>> > >
>> > > I should be shown codes as select options in the
>> dropdown and when I
>> > > select any of the code, the corresponding id
>> should go as the
>> > > value that has been selected
>> > >
>> > > Pointers on this would be of great help
>> >
>> > I understand what you're trying to do, I don't
>> understand what specific
>> > aspect you're having a problem with. You said you
>> implemented the action
>> > with a hard-coded list. An action that uses a database
>> instead is almost
>> > exactly the same, but it accesses a database instead
>> of using a hard-coded
>> > list.
>> >
>> > The Struts 2.0 autocompleter docs [1] summarize the
>> usage of the tag; the
>> > action will be called with the current value in the
>> text box. You use that
>> > partial value to do a database search (or filter an
>> existing list, or
>> > however you'll implement that part).
>> >
>> > Dave
>> >
>> > [1]
>> >
>> http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocompleterTag
>> >
>> > > newton.dave wrote:
>> > > >
>> > > > Search a database of city names?
>> > > >
>> > > > I'm not sure what you're asking.
>> > > >
>> > > > --- On Thu, 6/12/08, xianwinwin
>> > > <xianwinwin@(protected):
>> > >>> I have a list of 20,000 cities; I would
>> like the
>> > >>> user to provide at least 2 chars and then
>> present him a'potential
>> > > list'.
>> > > >>
>> > > >> I managed to do this:
>> > > >>
>> > > >> JSP
>> > > >>
>> > > >> <s:autocompleter
>> theme="simple"
>> > > >> list="state"
>> > > name="StateName"/>
>> > > >>
>> > > >>
>> > > >>
>> > > >> Java:
>> > > >>
>> > > >> public class autocompleter extends
>> ActionSupport
>> > > >> {
>> > > >>  private List state;
>> > > >>  public String execute() throws
>> Exception{
>> > > >>   state = new ArrayList();
>> > > >>   state.add("Bonn");
>> > > >>   state.add("Paris");
>> > > >> .
>> > > >> .
>> > > >> .
>> > > >>
>> > > >>   return SUCCESS;
>> > > >>  }
>> > > >>
>> > > >>   public List getState(){
>> > > >>   return state;
>> > > >>  }
>> > > >> }
>> > > >>
>> > > >> as you can see, the autocompliter is
>> based on the
>> > > >> 'state' I initially
>> > > >> provided. But what if the list is
>> huge???
>> > > >>
>> > > >> Q: How can I invoke an action once the
>> user types
>> > > a letter
>> > > >> (str) and the
>> > > >> string gets to the invoked-method (based
>> on the
>> > > str the
>> > > >> method will invoke
>> > > >> the appropriate list)
>> > > >>
>> > > >> thank you!!!
>> > > >> --
>> > > >> View this message in context:
>> > > >>
>> > >
>> >
>> http://www.nabble.com/struts2%3A-how-to-read-the-%27potenrial-list%27-from-a-database-tp17810726p17810726.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)
>> > > >
>> > > >
>> > >
>> ---------------------------------------------------------------------
>> > > > To unsubscribe, e-mail:
>> > > user-unsubscribe@(protected)
>> > > > For additional commands, e-mail:
>> > > user-help@(protected)
>> > > >
>> > > >
>> > > >
>> > >
>> > > --
>> > > View this message in context:
>> > >
>> >
>> http://www.nabble.com/struts2%3A-autocompleter---howto-read-the-%27potenrial-list%27-from-a-database-tp17810726p17820863.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)
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail:
>> user-unsubscribe@(protected)
>> > For additional commands, e-mail:
>> user-help@(protected)
>> >
>> >
>>
>>
>> --
>> -- --
>> Onur Idrisoglu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

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


Attachment: user_187557.ezm (zipped)

I have a JSP that uses an ActionTag <s:action> to call a Struts 2 action
class directly from the JSP. But in the action class, the HTTP response
has already been committed. This makes it impossible for me to set cookies
from my action class.

I tested this by calling HttpServletResponse.isCommitted() is my execute()
method of my action class, and it returns true.

Is this a bug? Why is the response committed if the JSP hasn't finished
rendering?


--somePage.jsp--
<s:action name="someAction" executeResult="true"
ignoreContextParams="false" />

--struts.xml--
<action name="someAction" class="com.dev.MyAction" method="execute">
  <result>/page.jsp</result>
</action>

--MyAction.java--
public String execute()
{
System.out.println("response.isCommitted() = " + response.isCommitted());
//this prints true
}



Thanks,
David




---------------------------------------------------------------------
This message, together with any attachments, is
intended only for the use of the individual or entity
to which it is addressed. It may contain information
that is confidential and prohibited from disclosure.
If you are not the intended recipient, you are hereby
notified that any dissemination or copying of this
message or any attachment is strictly prohibited. If
you have received this message in error, please notify
the original sender immediately by telephone or by
return e-mail and delete this message, along with any
attachments, from your computer. Thank you.

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

Attachment: user_187562.ezm (zipped)

Hi Everyone,
 
  I faced a tedious problem in manipuluating s:datetimepicker in my page.
It hasn't focus set and events are not fired.

Anyone help me to give the solution.


Regards,

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


Attachment: user_187565.ezm (zipped)
--- On Fri, 6/13/08, Ramesh K <ramesh.k@(protected):
> I faced a tedious problem in manipuluating s:datetimepicker in my page.
> It hasn't focus set and events are not fired.

That's not much to go on.

You have the <s:head...> tag? Your S2 mapping is correct such that it's serving the Dojo files?

Dave

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