Re: Iterator action setObject param

2008-02-20 Thread crappycrumpet



newton.dave wrote:
> 
> 
> One way to implement this functionality is to simply  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  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  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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Iterator action setObject param

2008-02-20 Thread Dave Newton
--- crappycrumpet <[EMAIL PROTECTED]> 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 .NoteAction: Error setting expression 'note'
> with value '[]'
> 
> Below is my interator loop bits:
> 
> 
>executeResult="true" ignoreContextParams="true">
> 
> [...]

The  tag pushes the current object of iteration onto the
stack.

One way to implement this functionality is to simply  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;  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 , 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Iterator action setObject param

2008-02-20 Thread crappycrumpet

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 .NoteAction: Error setting expression 'note'
with value '[]'

Below is my interator loop bits:





silver




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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]