You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by crappycrumpet <pa...@hotmail.com> on 2008/02/21 01:49:17 UTC

Iterator action setObject param

Hiya,

I'm quite new to struts 2. I'm trying to write a jsp page for an action
which iterates through a list of 'note' object and passing each of the
'note' object into another model-driven action (NoteAction) which renders
the information for the note passed in.

Now I have a method in NoteAction called setNote(Note value) which sets the
note field to the value. I also have getModel which returns a new note
object if it's null. I however keep encountering the following error:
ERROR [com.opensymphony.xwork2.interceptor.ParametersInterceptor] -
ParametersInterceptor - [setParameters]: Unexpected Exception caught setting
'note' on 'class <blah.blah>.NoteAction: Error setting expression 'note'
with value '[<BlahObject... blag... >]'

Below is my interator loop bits:

<s:iterator value="notes" status="recordStat">
                <s:action name="iml_row" namespace="/emergency_iml"
executeResult="true" ignoreContextParams="true">
                    <s:param name="note" value="[0]"/>
                    <s:if test="#recordStat.odd">
                        <s:param name="bgcolor">silver</s:param>
                    </s:if>
                </s:action>
            </s:iterator>

Now tell me can I actually put an object in the action param that's from a
iterator? Or does it only work with strings or whatever standard type
converter stuff struts uses? Do I have to write a custom type converter for
it to work?

I hope it makes sense :/

thanks,
CrappyCrumpet
-- 
View this message in context: http://www.nabble.com/Iterator-action-setObject-param-tp15602495p15602495.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Iterator action setObject param

Posted by crappycrumpet <pa...@hotmail.com>.


newton.dave wrote:
> 
> 
> One way to implement this functionality is to simply <s:include.../> the
> desired page; your "note" object will be on the top of the stack, and can
> be
> accessed appropriately.
> 
> 

Yeah I ended up doing using <s:include.../> in the end. Was wondering if
iterator passing object into action should work or not. (since it works when
it's not in the iterator) Quite few things wasn't what I expected like when
I call an action (let's call it theOther action) from an action and both has
id attribute, when I pass in the id from another attribute in the caller
action (say blahId) the id in the caller action ended up getting the
blahId's value if you refer to it later after theOther action has finished!
Now I've learnt that I can workaround it (or maybe that how it's meant to be
used...) using caller.id and theOther.id (where caller and theOther is an
model object in the caller and the other action). And to use
ignoreContextParams="true" in my <s:action.../> so that the action attribute
doesn't mysteriously get set to other stuff. I hope there isn't too much
other things to workout -_-" .

Thank you for your response!

cheers,
CrappyCrumpet
-- 
View this message in context: http://www.nabble.com/Iterator-action-setObject-param-tp15602495p15604651.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: s:datetimepicker version 2.0.11 issue

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
akash agrawal wrote:
> Issue:
> 1. Time cannot be edited by going straight to the text field and entering using keyboard. It only allows to pick up the time from the popup. However popup only gives minutes granularity in 5 minutes interval.
>
> Any workaround? Is there a better mailing list to post this question.
>   
Unfortunately...
Answer: usability of the time picker in Dojo 0.4 sucks

Work around: 
1. I use selects for time with javascript to combine the selections into 
a string in a hidden field (and vice versa).  Not as pertty, but it 
works well!
2. google javascript time picker

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: datetimepicker version 2.0.11 issue

Posted by Giovanni Azua <gi...@imc.nl>.
hi,

Indeed, as Dave pointed out that answer is confusing. I had the same 
issue as the OP and have not been able to find a working solution, at 
least not for S 2.1.x
Unfortunately not even the opposite settings of what is suggested works 
in S 2.1.x for entering free time without this 5 minute granularity 
constraint.

There is an open JIRA ticket describing precisely this problem:
https://issues.apache.org/struts/browse/WW-2353

regards,
Giovanni

Dave Newton wrote:
> --- "Rose India (http://www.roseindia.net)" <ab...@roseindiatechnologies.com>
> wrote:
>   
>> A small change is required to get the desired output.
>> You can find answer here at
>> http://www.roseindia.net/answers/viewanswers/29.html with source code.
>>     
>
> This link is to a post with the **opposite** requirement of the question
> being asked: the question was how do I **allow** editing via the textfield.
> This link answers (or may answer, anyway) the question of how to **only**
> allow editing via the popup. That's backwards.
>
> I guess I'd prefer it if, when you attempted to answer questions, you just
> posted an answer, rather than constantly trying to drive traffic to your
> site.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: datetimepicker version 2.0.11 issue

Posted by Dave Newton <ne...@yahoo.com>.
--- "Rose India (http://www.roseindia.net)" <ab...@roseindiatechnologies.com>
wrote:
> A small change is required to get the desired output.
> You can find answer here at
> http://www.roseindia.net/answers/viewanswers/29.html with source code.

This link is to a post with the **opposite** requirement of the question
being asked: the question was how do I **allow** editing via the textfield.
This link answers (or may answer, anyway) the question of how to **only**
allow editing via the popup. That's backwards.

I guess I'd prefer it if, when you attempted to answer questions, you just
posted an answer, rather than constantly trying to drive traffic to your
site.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: datetimepicker version 2.0.11 issue

Posted by Deepak Kumar <de...@roseindia.net>.
Hi,

Please note the attribute onchange="false" of  <s:datetimepicker (Date time
picker).

Thanks


-----Original Message-----
From: Rose India (http://www.roseindia.net)
[mailto:abcd@roseindiatechnologies.com]
Sent: Thursday, February 21, 2008 8:54 PM
To: Struts Users Mailing List
Subject: RE: datetimepicker version 2.0.11 issue


Hi

A small change is required to get the desired output.
You can find answer here at
http://www.roseindia.net/answers/viewanswers/29.html with source code.

Good Luck!

Best Regards


-----Original Message-----
From: akash agrawal [mailto:akash_agrawal@yahoo.co.uk]
Sent: Thursday, February 21, 2008 8:23 AM
To: Struts Users Mailing List
Subject: s:datetimepicker version 2.0.11 issue


Hi,

My code is:
                <s:datetimepicker label="Time"
                name="validityTimeTime"
                id="vtTime"
                type="time"
                displayFormat="HH:mm:ss"
                staticDisplay="true"
                value="%{#sr.validityTime}"
                language="en-us"
                required="true"
                />

Issue:
1. Time cannot be edited by going straight to the text field and entering
using keyboard. It only allows to pick up the time from the popup. However
popup only gives minutes granularity in 5 minutes interval.

Any workaround? Is there a better mailing list to post this question.

Thanks,

-Akash




---------------------------------
Never miss a thing.   Make Yahoo your homepage.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: datetimepicker version 2.0.11 issue

Posted by "Rose India (http://www.roseindia.net)" <ab...@roseindiatechnologies.com>.
Hi

A small change is required to get the desired output.
You can find answer here at
http://www.roseindia.net/answers/viewanswers/29.html with source code.

Good Luck!

Best Regards


-----Original Message-----
From: akash agrawal [mailto:akash_agrawal@yahoo.co.uk]
Sent: Thursday, February 21, 2008 8:23 AM
To: Struts Users Mailing List
Subject: s:datetimepicker version 2.0.11 issue


Hi,

My code is:
                <s:datetimepicker label="Time"
                name="validityTimeTime"
                id="vtTime"
                type="time"
                displayFormat="HH:mm:ss"
                staticDisplay="true"
                value="%{#sr.validityTime}"
                language="en-us"
                required="true"
                />

Issue:
1. Time cannot be edited by going straight to the text field and entering
using keyboard. It only allows to pick up the time from the popup. However
popup only gives minutes granularity in 5 minutes interval.

Any workaround? Is there a better mailing list to post this question.

Thanks,

-Akash




---------------------------------
Never miss a thing.   Make Yahoo your homepage.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


s:datetimepicker version 2.0.11 issue

Posted by akash agrawal <ak...@yahoo.co.uk>.
Hi,

My code is:
                <s:datetimepicker label="Time"
                name="validityTimeTime"
                id="vtTime" 
                type="time" 
                displayFormat="HH:mm:ss"
                staticDisplay="true"
                value="%{#sr.validityTime}"
                language="en-us"
                required="true"
                />

Issue:
1. Time cannot be edited by going straight to the text field and entering using keyboard. It only allows to pick up the time from the popup. However popup only gives minutes granularity in 5 minutes interval.

Any workaround? Is there a better mailing list to post this question.

Thanks,

-Akash



       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.

Re: Iterator action setObject param

Posted by Dave Newton <ne...@yahoo.com>.
--- crappycrumpet <pa...@hotmail.com> wrote:
> Now I have a method in NoteAction called setNote(Note value) which sets the
> note field to the value. I also have getModel which returns a new note
> object if it's null. I however keep encountering the following error:
> ERROR [com.opensymphony.xwork2.interceptor.ParametersInterceptor] -
> ParametersInterceptor - [setParameters]: Unexpected Exception caught
> setting
> 'note' on 'class <blah.blah>.NoteAction: Error setting expression 'note'
> with value '[<BlahObject... blag... >]'
> 
> Below is my interator loop bits:
> 
> <s:iterator value="notes" status="recordStat">
>   <s:action name="iml_row" namespace="/emergency_iml"
> executeResult="true" ignoreContextParams="true">
>                     <s:param name="note" value="[0]"/>
> [...]

The <s:iterator...> tag pushes the current object of iteration onto the
stack.

One way to implement this functionality is to simply <s:include.../> the
desired page; your "note" object will be on the top of the stack, and can be
accessed appropriately.

As you suspected, you can't pass an actual object as a parameter to an
action; <s:action...> is basically making a request for that page, so you're
forced to follow the same conventions as if you were, say, submitting a form:
strings only. If you were dead-set on implementing your "note" component this
way you'd have to do something like pass a note ID and create it via J.
Random Mechanism in the sub-action (like type conversion, via the Preparable
interface, etc.)

You could also use Tiles here, similar to <s:include...>, but perhaps a bit
less hokey than just including a JSP. I dunno; I've done both, and for simple
models I don't really have much of an issue just including a JSP, but others
will probably laugh and point at me for that :)

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org