Author Login
Post Reply
user Digest 1 Feb 2008 04:07:55 -0000 Issue 7836
Topics (messages 182043 through 182067):
Re: ServletActionRedirectResult issue
182043 by: Dave Newton
Re: Question about Struts 2 Flow Control
182044 by: Laurie Harper
Re: #request scope
182045 by: Laurie Harper
182046 by: Dave Newton
182051 by: Martin Gainty
182052 by: Musachy Barroso
Re: preparable vs modelDriven
182047 by: Roberto Nunnari
182055 by: Adam Hardy
182057 by: Musachy Barroso
182061 by: Jeromy Evans
Struts tags and Filter Dispatcher Url Pattern-struts 2.1.1
182048 by: Sanjeev Vijapurapu
182053 by: Dave Newton
182054 by: Sanjeev Vijapurapu
Struts validator
182049 by: Zhang, Larry \(L.\)
[S2] problems with validations
182050 by: juanc
Help with (1...N) Editing using Ajax?
182056 by: Griffith, Michael *
182058 by: Musachy Barroso
182059 by: Griffith, Michael *
182063 by: Griffith, Michael *
Struts2 tags loops
182060 by: Filipe David Manana
182064 by: Dave Newton
Doubleselect tag
182062 by: Stanley, Eric
Re: session or interceptor initialization / configuration problem
182065 by: jspring
Re: dojo script for DATEPICKER tag
182066 by: Naveen Kumar M
182067 by: Wes Wannemacher
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_182043.ezm (zipped)--- Luis Gervaso <luis.gervaso@(protected):
> If i put the name "etid" an exception is thrown
>
> If i put a larger parameter "whateverparametername" or simply "_" as
> parameter name the redirect works fine, i know it's sounds weird
Oh, I'm sorry; I read it backwards (I thought the wrong parameter didn't work
:)
Dave

Attachment:
user_182044.ezm (zipped)claym wrote:
> One of the things I really liked about Spring MVC was the fact that it was
> very easy to control the flow of a request. You could use referenceData() to
> add data that was needed on the page but not necessarily form related, then
> formBackingObject() for the actual pre-submission form population, and then
> control the processing of pre-submit and post-submit with showForm() and
> onSubmit()
>
> It was also smart enough to repopulate things like referenceData if there
> was an invalid submission.
>
> Part of this was due to the fact that there were lots of different types of
> controllers - all the referenceData and formBackingObject wasn't necessary
> if you're just displaying a non-form page, but you could always use
> SimpleFormController if you needed it.
>
> I'm not seeing that kind of behavior in Struts 2. I'm not saying it's
> required functionality, but I certainly appreciated it in Spring MVC.
>
> Is it there and I'm not seeing it? How would you control the request like
> this?
I don't know SpringMVC at all, but this all sounds like stuff that's
easy to do with Struts2, as far as I understand your description.
Firstly, anything you expose via a getter method in your action is
available from the page template, which I think takes care of the
referenceData part. Perhaps also take a look at the Preparable
interceptor and associated Preparable interface.
You can also use action getters for form population but if you prefer to
keep the form related data separate you can. Either have a getter on the
action that returns a reference to an object which holds the form data
or, if you want to make things more explicit, you can use the Model
Driven pattern (implementing a getModel() method on your action).
Doing different processing when showing the form vs. handling its
submission is easy: put the logic in two different action methods. You
can have one method invoked to display the form and invoke the other to
processes it when submitted. You can also easily invoke a different
method for each 'submit' button on the form if you need to.
Struts also knows how to automatically redisplay the input form if it's
submitted with invalid data. With appropriate configuration, you can
invoke the same logic you used to setup the form in the first place to
provide that data that wasn't 'form related'.
I would suggest trying a simple test app to experiment with these
workflows and coming back with specific questions. It's difficult to
generalize about Struts equivalents to the features of an unfamiliar
framework :-)
L.

Attachment:
user_182045.ezm (zipped)Dave Newton wrote:
> --- stanlick@(protected):
>> Yeah, that's what I thought too! I'm passing the parameter via:
>>
>> <s:url id="url" action="%{actionClass}_show">
>> <s:param name="model.parentId" value="id"/>
>> </s:url>
>>
>> and the tag <s:property value="#request.model.parentId" /> outputs the
>> number to the top of the page just fine.
>
> Do you have a "model" property in your action?
>
>> In fact, if I use #parameters.model.parentId I get nothing.
>
> If I use a parameter named "foo", set to "bar", I can't dupe this issue.
>
> If I include a "." operator then I'd suspect breakage as OGNL will attempt to
> call "getParentId()" on an object called "model". These are expressions, not
> simple, unparsed strings.
Yeah, the period seems likely to be the issue, though I'm not sure why
the expression would work in one context but not another in the same
page. I would suggest two experiments:
1, per Dave, try renaming the parameter to something w/out a period in it.
2, if that works then try playing with the OGNL expression; something
like #parameters['model.parentId'] may work (haven't tried that tho').
L.

Attachment:
user_182046.ezm (zipped)--- Laurie Harper <laurie@(protected):
> Dave Newton wrote:
> > --- stanlick@(protected):
> >> Yeah, that's what I thought too! I'm passing the parameter via:
> >>
> >> <s:url id="url" action="%{actionClass}_show">
> >> <s:param name="model.parentId" value="id"/>
> >> </s:url>
> >>
> >> and the tag <s:property value="#request.model.parentId" /> outputs the
> >> number to the top of the page just fine.
> >
> > Do you have a "model" property in your action?
> >
> >> In fact, if I use #parameters.model.parentId I get nothing.
> >
> > If I use a parameter named "foo", set to "bar", I can't dupe this issue.
> >
> > If I include a "." operator then I'd suspect breakage as OGNL will
> attempt to
> > call "getParentId()" on an object called "model". These are expressions,
> not
> > simple, unparsed strings.
>
> Yeah, the period seems likely to be the issue, though I'm not sure why
> the expression would work in one context but not another in the same
> page. I would suggest two experiments:
I'm still not convinced it does; there is no way (that I'm aware of) that a
request parameter would ever be available as a request attribute, so I think
something else is happening there in the code. Most likely something is
putting a model into request scope.
> 2, if that works then try playing with the OGNL expression; something
> like #parameters['model.parentId'] may work (haven't tried that tho').
Correct; using map-style (i.e, stopping expression evaluation) works as
expected.
Dave

Attachment:
user_182051.ezm (zipped)//assuming request parameter..
#parameters['model.parentId']
http://struts.apache.org/2.x/docs/ognl-basics.html
//if you dont know the scope try
#attr['foo']
which will ref request/session/application respectively..
M-
----- Original Message -----
From: "Dave Newton" <newton.dave@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Thursday, January 31, 2008 2:22 PM
Subject: Re: #request scope
> --- Laurie Harper <laurie@(protected):
> > Dave Newton wrote:
> > > --- stanlick@(protected):
> > >> Yeah, that's what I thought too! I'm passing the parameter via:
> > >>
> > >> <s:url id="url" action="%{actionClass}_show">
> > >> <s:param name="model.parentId" value="id"/>
> > >> </s:url>
> > >>
> > >> and the tag <s:property value="#request.model.parentId" /> outputs
the
> > >> number to the top of the page just fine.
> > >
> > > Do you have a "model" property in your action?
> > >
> > >> In fact, if I use #parameters.model.parentId I get nothing.
> > >
> > > If I use a parameter named "foo", set to "bar", I can't dupe this
issue.
> > >
> > > If I include a "." operator then I'd suspect breakage as OGNL will
> > attempt to
> > > call "getParentId()" on an object called "model". These are
expressions,
> > not
> > > simple, unparsed strings.
> >
> > Yeah, the period seems likely to be the issue, though I'm not sure why
> > the expression would work in one context but not another in the same
> > page. I would suggest two experiments:
>
> I'm still not convinced it does; there is no way (that I'm aware of) that
a
> request parameter would ever be available as a request attribute, so I
think
> something else is happening there in the code. Most likely something is
> putting a model into request scope.
>
> > 2, if that works then try playing with the OGNL expression; something
> > like #parameters['model.parentId'] may work (haven't tried that tho').
>
> Correct; using map-style (i.e, stopping expression evaluation) works as
> expected.
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_182052.ezm (zipped)btw #parameters['model.parentId'] will return an array, not just one
value, so #parameters['model.parentId'][0] will give you the value you
are looking for.
musachy
On Jan 31, 2008 2:07 PM, Laurie Harper <laurie@(protected):
> Dave Newton wrote:
> > --- stanlick@(protected):
> >> Yeah, that's what I thought too! I'm passing the parameter via:
> >>
> >> <s:url id="url" action="%{actionClass}_show">
> >> <s:param name="model.parentId" value="id"/>
> >> </s:url>
> >>
> >> and the tag <s:property value="#request.model.parentId" /> outputs the
> >> number to the top of the page just fine.
> >
> > Do you have a "model" property in your action?
> >
> >> In fact, if I use #parameters.model.parentId I get nothing.
> >
> > If I use a parameter named "foo", set to "bar", I can't dupe this issue.
> >
> > If I include a "." operator then I'd suspect breakage as OGNL will attempt to
> > call "getParentId()" on an object called "model". These are expressions, not
> > simple, unparsed strings.
>
> Yeah, the period seems likely to be the issue, though I'm not sure why
> the expression would work in one context but not another in the same
> page. I would suggest two experiments:
>
> 1, per Dave, try renaming the parameter to something w/out a period in it.
>
> 2, if that works then try playing with the OGNL expression; something
> like #parameters['model.parentId'] may work (haven't tried that tho').
>
> L.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_182047.ezm (zipped)Dave Newton wrote:
> --- Roberto Nunnari <roberto.nunnari@(protected):
>> The prepare() method task is to retrive the model
>> and store it as an instance variable.
>>
>> The getModel() method will later return the model
>> when asked by the framework that will put it on the
>> value stack.
>>
>> Please correct me if I'm wrong.
>
> Some people use getModel() to do more work, that's all; the original question
> was how to avoid some of the issues caused by using that pattern.
I see. Sorry for the noise.
Robi.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_182055.ezm (zipped)I don't think you are strictly conveying the intended usage, when you say that
the getModel() method will 'later' return the model. It depends how your
interceptor stack is ordered. In the docs, it explicitly says the
ModelDrivenInterceptor should come before ParametersInterceptor, as often the
PrepareInterceptor does.
Both ModelDriven- and PrepareInterceptor can retrieve the model and place it in
instance variables on the action.
http://struts.apache.org/2.0.11/docs/prepare-interceptor.html
http://struts.apache.org/2.0.11/docs/model-driven-interceptor.html
What I originally wanted to ask (whether I conveyed my question correctly is
another matter) was: what's the difference in intention and implementation
between these two?
Thanks
Adam
Roberto Nunnari on 31/01/08 18:12, wrote:
> The prepare() method task is to retrive the model
> and store it as an instance variable.
>
> The getModel() method will later return the model
> when asked by the framework that will put it on the
> value stack.
>
> Please correct me if I'm wrong.
>
> Adam Hardy wrote:
>> Dave Newton on 31/01/08 16:00, wrote:
>>> Adam Hardy <ahardy.struts@(protected):
>>>> Dave Newton on 31/01/08 15:29, wrote:
>>>>> Adam Hardy <ahardy.struts@(protected):
>>>>>> * ModelDriven: how do I get hold of my model during my action
>>>>>> methods? I
>>>>>> don't want to get getModel() again, because that will retrieve
>>>>>> another
>>>>>> instance of the entity and not the one that was populated by struts.
>>>>> Lazy initialization (via null check or by setting an instance var), or
>>>>> config through Spring, or...
>>>> If your getModel() puts the model entity on an instance variable, won't
>>>> that confuse the param interceptor?
>>>
>>> Depends on what instance variable you put it in, I suppose. One of your
>>> questions was how to access the model object w/o running through a
>>> getModel()
>>> method that would re-instantiate; lazily initializing an instance
>>> variable in
>>> getModel() then using that instance variable is one way of dealing
>>> with that.
>>
>> OK, that makes sense now, thanks. What I thought would be the more
>> obvious way of obtaining the model would be to fetch it from where
>> struts puts it when it calls getModel(), i.e. the value stack, however
>> I don't see any access methods for doing that, particulary on
>> ActionSupport.

Attachment:
user_182057.ezm (zipped)Struts will by default populate parameters in your action, if you use
ModelDriven, then you can supply the object that will be populated
instead of the action. Implementing preparable will make struts call
prepare() before the action is executed, or prepareX() before X() is
executed. They are just sometimes used together to achieve certain
things, as explained on the other emails.
musachy
On Jan 31, 2008 5:03 PM, Adam Hardy <ahardy.struts@(protected):
> I don't think you are strictly conveying the intended usage, when you say that
> the getModel() method will 'later' return the model. It depends how your
> interceptor stack is ordered. In the docs, it explicitly says the
> ModelDrivenInterceptor should come before ParametersInterceptor, as often the
> PrepareInterceptor does.
>
> Both ModelDriven- and PrepareInterceptor can retrieve the model and place it in
> instance variables on the action.
>
> http://struts.apache.org/2.0.11/docs/prepare-interceptor.html
>
> http://struts.apache.org/2.0.11/docs/model-driven-interceptor.html
>
> What I originally wanted to ask (whether I conveyed my question correctly is
> another matter) was: what's the difference in intention and implementation
> between these two?
>
> Thanks
> Adam
>
> Roberto Nunnari on 31/01/08 18:12, wrote:
> > The prepare() method task is to retrive the model
> > and store it as an instance variable.
> >
> > The getModel() method will later return the model
> > when asked by the framework that will put it on the
> > value stack.
> >
> > Please correct me if I'm wrong.
> >
>
> > Adam Hardy wrote:
> >> Dave Newton on 31/01/08 16:00, wrote:
> >>> Adam Hardy <ahardy.struts@(protected):
> >>>> Dave Newton on 31/01/08 15:29, wrote:
> >>>>> Adam Hardy <ahardy.struts@(protected):
> >>>>>> * ModelDriven: how do I get hold of my model during my action
> >>>>>> methods? I
> >>>>>> don't want to get getModel() again, because that will retrieve
> >>>>>> another
> >>>>>> instance of the entity and not the one that was populated by struts.
> >>>>> Lazy initialization (via null check or by setting an instance var), or
> >>>>> config through Spring, or...
> >>>> If your getModel() puts the model entity on an instance variable, won't
> >>>> that confuse the param interceptor?
> >>>
> >>> Depends on what instance variable you put it in, I suppose. One of your
> >>> questions was how to access the model object w/o running through a
> >>> getModel()
> >>> method that would re-instantiate; lazily initializing an instance
> >>> variable in
> >>> getModel() then using that instance variable is one way of dealing
> >>> with that.
> >>
> >> OK, that makes sense now, thanks. What I thought would be the more
> >> obvious way of obtaining the model would be to fetch it from where
> >> struts puts it when it calls getModel(), i.e. the value stack, however
> >> I don't see any access methods for doing that, particulary on
> >> ActionSupport.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_182061.ezm (zipped)I thought I'd quickly describe my usages and opinions of Preparable and
ModelDriven in case it helps any one:
- As Dave described, I also prefer to keep my prepare logic with the
main code because it's easier for others to understand.
- I do use Preparable in the cases where params-prepare-params is
desirable: typically where the params are directly addressing a nested
bean and the parent needs to be initialised/loaded by id first. I avoid
this but its valuable in those occasional cases.
- When using ModelDriven, putting any logic inside getModel() is a bad
idea. This is akin to putting logic inside getters. The model is
always an instance variable.
- My interpretation of the primary objective of ModelDriven is to put
the model object at the top of the value stack rather than the action.
Therefore it is complementary with Preparable
- My use of ModelDriven is also rare because it can make the context of
a JSP/FTL harder to understand (eg. I prefer contact.firstName rather
than firstName). However it has proven extremely useful in some cases,
particularly if the model is polymorphic (same action, different result,
different model class)
cheers,
Jeromy Evans
Musachy Barroso wrote:
> Struts will by default populate parameters in your action, if you use
> ModelDriven, then you can supply the object that will be populated
> instead of the action. Implementing preparable will make struts call
> prepare() before the action is executed, or prepareX() before X() is
> executed. They are just sometimes used together to achieve certain
> things, as explained on the other emails.
>
> musachy
>
> On Jan 31, 2008 5:03 PM, Adam Hardy <ahardy.struts@(protected):
>
>> I don't think you are strictly conveying the intended usage, when you say that
>> the getModel() method will 'later' return the model. It depends how your
>> interceptor stack is ordered. In the docs, it explicitly says the
>> ModelDrivenInterceptor should come before ParametersInterceptor, as often the
>> PrepareInterceptor does.
>>
>> Both ModelDriven- and PrepareInterceptor can retrieve the model and place it in
>> instance variables on the action.
>>
>> http://struts.apache.org/2.0.11/docs/prepare-interceptor.html
>>
>> http://struts.apache.org/2.0.11/docs/model-driven-interceptor.html
>>
>> What I originally wanted to ask (whether I conveyed my question correctly is
>> another matter) was: what's the difference in intention and implementation
>> between these two?
>>
>> Thanks
>> Adam
>>
>> Roberto Nunnari on 31/01/08 18:12, wrote:
>>
>>> The prepare() method task is to retrive the model
>>> and store it as an instance variable.
>>>
>>> The getModel() method will later return the model
>>> when asked by the framework that will put it on the
>>> value stack.
>>>
>>> Please correct me if I'm wrong.
>>>
>>>
>>> Adam Hardy wrote:
>>>
>>>> Dave Newton on 31/01/08 16:00, wrote:
>>>>
>>>>> Adam Hardy <ahardy.struts@(protected):
>>>>>
>>>>>> Dave Newton on 31/01/08 15:29, wrote:
>>>>>>
>>>>>>> Adam Hardy <ahardy.struts@(protected):
>>>>>>>
>>>>>>>> * ModelDriven: how do I get hold of my model during my action
>>>>>>>> methods? I
>>>>>>>> don't want to get getModel() again, because that will retrieve
>>>>>>>> another
>>>>>>>> instance of the entity and not the one that was populated by struts.
>>>>>>>>
>>>>>>> Lazy initialization (via null check or by setting an instance var), or
>>>>>>> config through Spring, or...
>>>>>>>
>>>>>> If your getModel() puts the model entity on an instance variable, won't
>>>>>> that confuse the param interceptor?
>>>>>>
>>>>> Depends on what instance variable you put it in, I suppose. One of your
>>>>> questions was how to access the model object w/o running through a
>>>>> getModel()
>>>>> method that would re-instantiate; lazily initializing an instance
>>>>> variable in
>>>>> getModel() then using that instance variable is one way of dealing
>>>>> with that.
>>>>>
>>>> OK, that makes sense now, thanks. What I thought would be the more
>>>> obvious way of obtaining the model would be to fetch it from where
>>>> struts puts it when it calls getModel(), i.e. the value stack, however
>>>> I don't see any access methods for doing that, particulary on
>>>> ActionSupport.
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
>
>
>

Attachment:
user_182048.ezm (zipped)
Attachment:
user_182053.ezm (zipped)--- Sanjeev Vijapurapu <SVijapurapu@(protected):
> So does this mean that if my jsp is using struts tags, it has to go
> through filter dispatcher?
The filter is what puts the stack into scope so the tags have data to access
(more or less).
Dave

Attachment:
user_182054.ezm (zipped)That's what I thought but why does tags need stack when I am not
accessing any of the values. It just has sx:head.
So my question is am I right in saying that struts should be able to
render struts tags as it does jstl tags without worrying abt any stack.
If stack is null, it should treat it as an empty stack rather than
throwing null pointer.
Thanks
-----Original Message-----
From: Dave Newton [mailto:newton.dave@(protected)]
Sent: Thursday, January 31, 2008 1:33 PM
To: Struts Users Mailing List
Subject: Re: Struts tags and Filter Dispatcher Url Pattern-struts 2.1.1
--- Sanjeev Vijapurapu <SVijapurapu@(protected):
> So does this mean that if my jsp is using struts tags, it has to go
> through filter dispatcher?
The filter is what puts the stack into scope so the tags have data to
access
(more or less).
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_182049.ezm (zipped)Hello coworkers,
I have a questions regarding the struts validation..., say I have three
text fields to be validated in struts validation, and three submit
buttons as well. When I submit one buttion, I only need to validate one
field, and when I click on the other submit button, I need to validate
the other field. Currently, all three fields are validated even though I
don't need to. Is there any way to overcome this issue?
Thanks.

Attachment:
user_182050.ezm (zipped)
Hi,
i have this code when i get a error
if( person.getNumId() == null || person.getNumId().trim().length() <
9 ) {
String[] pars = {"8"};
this.addFieldError( "field.doc" , this.getText(
"error.val.minlength" , pars ) );
}
where "field.doc" it is a key with a string associate in a resource file:
field.doc=Identification.
In my errors.properties file i have a error description by
"error.val.minlength":
error.val.minlength=Needs to be {0} characters long at least, for
"${getText(fieldName)}"
but in my pages i get: Needs to be 8 characters long at least, for "".
Why can not i get the string "Identification" associated with the string
"field.doc"?
In the other hand, if i put the validation into xml file like:
<field name="doc">
<field-validator type="stringlength">
8
true
<message key="error.val.minlength"/>
</field-validator>
</field>
i get: "Needs to be {0} characters long at least, for ""
How can I associated this validation with the key "field.doc" by get
"Identification" througth ${getText(fieldName)} if my field name for this
textfield it is different that key associated it?, and how can i get the
param 8 from this xml sintax?
Sorry for my english, thanks a lot for your help.
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_182056.ezm (zipped)Hello all,
I am trying to understand how to present an interface where I allow a
user to edit a master/detail relationship using an Ajax technique. I am
quite new to Struts2, so please forgive the dalliance.
I have a form that presents the user the ability to edit the master of
the master/detail, and below the form a list of each of the child
records. Each child record presents an Ajax enabled link to trigger a
method on the struts action, where I pick out the child record from the
list and put it in the session...
The link looks like this:
<s:iterator id="guide" value="guides">
<s:url id="editGuide" action="getGuide"
namespace="/datacall" >
<s:param name="gid"
value="#guide.id" />
</s:url>
<s:a theme="ajax" href="%{editGuide}"
notifyTopics="updateResult"><s:property
value="#guide.shortDescription"/></s:a> <br/>
</s:iterator>
The method is triggered in the action, and I set the child into my
request session...
request.getSession().setAttribute("guide", g);
And I have a form that I'm trying to bind to the object in the session.
The form is actually hidden in a div/panel I'm using the YUI to present
the form to the user after the round trip to the server. The form isn't
bound to the correct variable, because its set via a user interaction
after the entire page is presented to the user.
The form looks like this:
<s:form theme="ajax" action="updateGuide" method="post">
<s:hidden name="#session['guide'].id" />
<s:textfield key="guide.shortDescription"
name="#session['guide'].shortDescription" />
<s:textarea key="guide.instructions"
name="#session['guide'].instructions" cols="25" rows="8"/>
</s:form>
In Struts 1 I would have gotten a terrible error saying that the bean
wasn't found. Now the error fails silently. How can I make the form
somehow bind to the object in the session after the user clicks the
link?
Any help would be much appreciated.
MG

Attachment:
user_182058.ezm (zipped)so #session['guide'] is not returning anything?
musachy
On Jan 31, 2008 5:16 PM, Griffith, Michael *
<Michael.Griffith@(protected):
> Hello all,
>
>
>
> I am trying to understand how to present an interface where I allow a
> user to edit a master/detail relationship using an Ajax technique. I am
> quite new to Struts2, so please forgive the dalliance.
>
>
>
> I have a form that presents the user the ability to edit the master of
> the master/detail, and below the form a list of each of the child
> records. Each child record presents an Ajax enabled link to trigger a
> method on the struts action, where I pick out the child record from the
> list and put it in the session...
>
>
>
> The link looks like this:
>
>
>
> <s:iterator id="guide" value="guides">
>
> <s:url id="editGuide" action="getGuide"
> namespace="/datacall" >
>
> <s:param name="gid"
> value="#guide.id" />
>
> </s:url>
>
> <s:a theme="ajax" href="%{editGuide}"
> notifyTopics="updateResult"><s:property
> value="#guide.shortDescription"/></s:a> <br/>
>
> </s:iterator>
>
>
>
> The method is triggered in the action, and I set the child into my
> request session...
>
> request.getSession().setAttribute("guide", g);
>
>
>
> And I have a form that I'm trying to bind to the object in the session.
> The form is actually hidden in a div/panel I'm using the YUI to present
> the form to the user after the round trip to the server. The form isn't
> bound to the correct variable, because its set via a user interaction
> after the entire page is presented to the user.
>
> The form looks like this:
>
>
>
> <s:form theme="ajax" action="updateGuide" method="post">
>
> <s:hidden name="#session['guide'].id" />
>
> <s:textfield key="guide.shortDescription"
> name="#session['guide'].shortDescription" />
>
> <s:textarea key="guide.instructions"
> name="#session['guide'].instructions" cols="25" rows="8"/>
>
> </s:form>
>
>
>
> In Struts 1 I would have gotten a terrible error saying that the bean
> wasn't found. Now the error fails silently. How can I make the form
> somehow bind to the object in the session after the user clicks the
> link?
>
>
>
> Any help would be much appreciated.
>
>
>
> MG
>
>
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_182059.ezm (zipped)Nope, nothing.
If I bind my form to #guide.<property> I find the first or last item in
the Collection that belongs to the parent when the list was iterated
over.
Maybe there is a better way to specify how to bind the property to the
struts control? Maybe something like:
<s:hidden name="#guide[idx].id" />
But how would I specify the item index in the collection?
Cheers!
MG
-----Original Message-----
From: Musachy Barroso [mailto:musachy@(protected)]
Sent: Thursday, January 31, 2008 4:25 PM
To: Struts Users Mailing List
Subject: Re: Help with (1...N) Editing using Ajax?
so #session['guide'] is not returning anything?
musachy
On Jan 31, 2008 5:16 PM, Griffith, Michael *
<Michael.Griffith@(protected):
> Hello all,
>
>
>
> I am trying to understand how to present an interface where I allow a
> user to edit a master/detail relationship using an Ajax technique. I
am
> quite new to Struts2, so please forgive the dalliance.
>
>
>
> I have a form that presents the user the ability to edit the master of
> the master/detail, and below the form a list of each of the child
> records. Each child record presents an Ajax enabled link to trigger a
> method on the struts action, where I pick out the child record from
the
> list and put it in the session...
>
>
>
> The link looks like this:
>
>
>
> <s:iterator id="guide" value="guides">
>
> <s:url id="editGuide" action="getGuide"
> namespace="/datacall" >
>
> <s:param name="gid"
> value="#guide.id" />
>
> </s:url>
>
> <s:a theme="ajax" href="%{editGuide}"
> notifyTopics="updateResult"><s:property
> value="#guide.shortDescription"/></s:a> <br/>
>
> </s:iterator>
>
>
>
> The method is triggered in the action, and I set the child into my
> request session...
>
> request.getSession().setAttribute("guide", g);
>
>
>
> And I have a form that I'm trying to bind to the object in the
session.
> The form is actually hidden in a div/panel I'm using the YUI to
present
> the form to the user after the round trip to the server. The form
isn't
> bound to the correct variable, because its set via a user interaction
> after the entire page is presented to the user.
>
> The form looks like this:
>
>
>
> <s:form theme="ajax" action="updateGuide" method="post">
>
> <s:hidden name="#session['guide'].id" />
>
> <s:textfield key="guide.shortDescription"
> name="#session['guide'].shortDescription" />
>
> <s:textarea key="guide.instructions"
> name="#session['guide'].instructions" cols="25" rows="8"/>
>
> </s:form>
>
>
>
> In Struts 1 I would have gotten a terrible error saying that the bean
> wasn't found. Now the error fails silently. How can I make the form
> somehow bind to the object in the session after the user clicks the
> link?
>
>
>
> Any help would be much appreciated.
>
>
>
> MG
>
>
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_182063.ezm (zipped)In fact, looking at the page source, it appears the expression is never
cooked...
Here's the input from the rendered page:
<input type="text" name="#session['guide'].shortDescription"
value="#session['guide'].shortDescription"
id="updateGuide_#session_'guide'__shortDescription"/>
-----Original Message-----
From: Musachy Barroso [mailto:musachy@(protected)]
Sent: Thursday, January 31, 2008 4:25 PM
To: Struts Users Mailing List
Subject: Re: Help with (1...N) Editing using Ajax?
so #session['guide'] is not returning anything?
musachy
On Jan 31, 2008 5:16 PM, Griffith, Michael *
<Michael.Griffith@(protected):
> Hello all,
>
>
>
> I am trying to understand how to present an interface where I allow a
> user to edit a master/detail relationship using an Ajax technique. I
am
> quite new to Struts2, so please forgive the dalliance.
>
>
>
> I have a form that presents the user the ability to edit the master of
> the master/detail, and below the form a list of each of the child
> records. Each child record presents an Ajax enabled link to trigger a
> method on the struts action, where I pick out the child record from
the
> list and put it in the session...
>
>
>
> The link looks like this:
>
>
>
> <s:iterator id="guide" value="guides">
>
> <s:url id="editGuide" action="getGuide"
> namespace="/datacall" >
>
> <s:param name="gid"
> value="#guide.id" />
>
> </s:url>
>
> <s:a theme="ajax" href="%{editGuide}"
> notifyTopics="updateResult"><s:property
> value="#guide.shortDescription"/></s:a> <br/>
>
> </s:iterator>
>
>
>
> The method is triggered in the action, and I set the child into my
> request session...
>
> request.getSession().setAttribute("guide", g);
>
>
>
> And I have a form that I'm trying to bind to the object in the
session.
> The form is actually hidden in a div/panel I'm using the YUI to
present
> the form to the user after the round trip to the server. The form
isn't
> bound to the correct variable, because its set via a user interaction
> after the entire page is presented to the user.
>
> The form looks like this:
>
>
>
> <s:form theme="ajax" action="updateGuide" method="post">
>
> <s:hidden name="#session['guide'].id" />
>
> <s:textfield key="guide.shortDescription"
> name="#session['guide'].shortDescription" />
>
> <s:textarea key="guide.instructions"
> name="#session['guide'].instructions" cols="25" rows="8"/>
>
> </s:form>
>
>
>
> In Struts 1 I would have gotten a terrible error saying that the bean
> wasn't found. Now the error fails silently. How can I make the form
> somehow bind to the object in the session after the user clicks the
> link?
>
>
>
> Any help would be much appreciated.
>
>
>
> MG
>
>
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_182060.ezm (zipped)Hi,
Is there any way to iterate over an integer range with the <s:iterate/> tag?
I have an integer property (pageCount) in my action and I want to
print all the integer values between 1 and this property in my JSP.
cheers
--
Filipe David Manana,
fdmanana@(protected)
Obvious facts are like secrets to those not trained to see them.

Attachment:
user_182064.ezm (zipped)--- Filipe David Manana <fdmanana@(protected):
> Is there any way to iterate over an integer range with the <s:iterate/>
> tag? I have an integer property (pageCount) in my action and I want to
> print all the integer values between 1 and this property in my JSP.
Not that I'm aware of; easier to use <c:forEach.../> IMO.
Dave

Attachment:
user_182062.ezm (zipped)I'd like to have a pair of selects, the first one controlling the
content of the next. I understand that the <s:doublselect /> tag makes
this possible. I just can't make it work. I tried just copying the
example:
<s:doubleselect label="doubleselect test1" name="menu"
list="{'fruit','other'}" doubleName="dishes" doubleList="top == 'fruit'
? {'apple', 'orange'} : {'monkey', 'chicken'}" />
<s:doubleselect label="doubleselect test2" name="menu"
list="#{'fruit':'Nice Fruits', 'other':'Other Dishes'}"
doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} :
{'monkey', 'chicken'}" />
And it does not work either. It populates both selects automatically,
and the second select never changes content based on the first. They
just seem static. I'm sure I'm looking at this the wrong way, so I could
use some clarity. Thanks in advance.
-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_182065.ezm (zipped)
As it turns out, I was accessing the session in the interceptor by
final ActionContext context = invocation.getInvocationContext ();
HttpServletRequest request = (HttpServletRequest)
context.get(HTTP_REQUEST);
HttpSession session = request.getSession (true);
which wasn't working. Doing this instead is working now:
Map session = ActionContext.getContext().getSession();
...although I'm not entirely sure why.
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_182066.ezm (zipped)Thanks ravichandrac,
Yes I know it will preset the date value to the date you set in action class,
but my question is basically to limit the Date selection from the date picker created by datepicker tag, however which contains parametes called startDate and endDate, so m,y requirment I just wnated to change the startDate value dynamically.
i hope i have posted my question cleraly.......!
Thanks & Regards,
Minchu
ravi_eze <ravichandrac@(protected):
hi,
if i am uderstanding u right then this should solve ur problem.
action class:
Date inpDate = new Date();
jsp page:
so for the fist time when the page is being displayed the inpDate is set ot
the current date which will solve ur problem
hope this helps.
cheers,
ravi
Naveen Kumar M wrote:
>
>
> THANKS Wannemacher FOR YOUR REPLY.
>
> My question is, I want to change the values being assigned the
> startDate and endDate parameters for the tag. So for example
> page using my datepicker is loaded in to browser today, than
> startDate should be todays systems date, for the same in next
> coming day the startDate should be that day's system date(server date)
>
> I hope i have posted my question more clearly.
>
> Expecting some response on the issue.
>
>
> Regards,
> Minchu
>
>
>
> Wes Wannemacher wrote: Have you tried the startDate and
> endDate parameters for the tag and
> received an error?
>
> http://struts.apache.org/2.x/docs/datetimepicker.html
>
> -Wes
>
> On Thu, 2008-01-31 at 05:24 +0000, Naveen Kumar M wrote:
>> Hi,
>>
>> We have a reqierment to control startdate and enddate of the datepicker
>> dynamically, so i have tried out for controlling it by a dojo script,
>> which is breaking up the appearance of datepicker. So can any one suggest
>> how to control it dyanimcally.
>>
>> thanks in advance
>>
>>
>> regards,
>> minchu
>>
>>
>> ---------------------------------
>> Unlimited freedom, unlimited storage. Get it now
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> ---------------------------------
> 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
>
--
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)
---------------------------------
Get the freedom to save as many mails as you wish. Click here to know how.

Attachment:
user_182067.ezm (zipped)I haven't tried it, but I would think that something like -
startDate="@
java.util.Calendar@(protected)()"
might work. It should be a fairly trivial exercise to use OGNL to set
the parameters dynamically.
-Wes
On Fri, 2008-02-01 at 03:52 +0000, Naveen Kumar M wrote:
> Thanks ravichandrac,
>
> Yes I know it will preset the date value to the date you set in action class,
> but my question is basically to limit the Date selection from the date picker created by datepicker tag, however which contains parametes called startDate and endDate, so m,y requirment I just wnated to change the startDate value dynamically.
>
> i hope i have posted my question cleraly.......!
>
> Thanks & Regards,
> Minchu
>
> ravi_eze <ravichandrac@(protected):
> hi,
>
> if i am uderstanding u right then this should solve ur problem.
>
> action class:
> Date inpDate = new Date();
>
> jsp page:
>
>
> so for the fist time when the page is being displayed the inpDate is set ot
> the current date which will solve ur problem
>
> hope this helps.
>
> cheers,
> ravi
>
>
> Naveen Kumar M wrote:
> >
> >
> > THANKS Wannemacher FOR YOUR REPLY.
> >
> > My question is, I want to change the values being assigned the
> > startDate and endDate parameters for the tag. So for example
> > page using my datepicker is loaded in to browser today, than
> > startDate should be todays systems date, for the same in next
> > coming day the startDate should be that day's system date(server date)
> >
> > I hope i have posted my question more clearly.
> >
> > Expecting some response on the issue.
> >
> >
> > Regards,
> > Minchu
> >
> >
> >
> > Wes Wannemacher wrote: Have you tried the startDate and
> > endDate parameters for the tag and
> > received an error?
> >
> > http://struts.apache.org/2.x/docs/datetimepicker.html
> >
> > -Wes
> >
> > On Thu, 2008-01-31 at 05:24 +0000, Naveen Kumar M wrote:
> >> Hi,
> >>
> >> We have a reqierment to control startdate and enddate of the datepicker
> >> dynamically, so i have tried out for controlling it by a dojo script,
> >> which is breaking up the appearance of datepicker. So can any one suggest
> >> how to control it dyanimcally.
> >>
> >> thanks in advance
> >>
> >>
> >> regards,
> >> minchu
> >>
> >>
> >> ---------------------------------
> >> Unlimited freedom, unlimited storage. Get it now
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
> > ---------------------------------
> > 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
> >
>
> --
> View this message in context: http://www.nabble.com/dojo-script-for-DATEPICKER-tag-tp15198436p15203522.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)
>
>
>
>
> ---------------------------------
> Get the freedom to save as many mails as you wish. Click here to know how.