Mark Lowe wrote:

I've been looking through the struts source with a view to trying to find a way of handling nested dispatch actions.

I don't think it matters what kind of action it is, but maybe I'm missing what you are trying to do. I've looked at what you have below, but I confused from a 'real life implementation' sense what you are trying to achieve? Could you explain a bit more what you want the user to be able to do?



Basically the problem is passing through an index or key to the getMethodName (MappedDispatchAction) or the getKeyMethodMap (LookupDispatchAction) and running a method based on that.

I'm not sure what this has to do with the nested situation at hand?

<html:form action="/foo.do">
<c:forEach var="course" items="${menuForm.courses}" varStatus="firstIndex">
<c:forEach var="nestedLevel" items="${course.dishes}" varStatus="nestedIndex">
<html:text property="${courses[firstIndex.index]. dishes[nestedIndex.index]" />
<html:submit property="method" indexed="true">
..


The situation is that i need to add an item to the the levelOne object. But when submitting there's no way of grabbing the index and thus knowing which of the levelOne objects to add a new rows of nested object to.

Why don't you set up the "blank new item" before you get to the page? That way it'll be all nested for you. The slightly tricky part is that you'll need to know that it is a "new" item (and not an update) so for that you could do a couple of things that I've thought of, but before mentioning them, I'm not sure that's what the problem is yo are having:)



So far I've been using the unspecified method and searching the parameter names for a custom button name. So not really dispatching any thing. But If i wanted to go another level i would arrive at the same problem.

Ok, now again I'm totally confused:)

So far it looks like adding a nestedDispatchMethod or indexedDispatchMethod which also passes the index through.

Anyone else looked into this? It would seem a common enough problem.

I'm not sure what the problem is... I do think maybe stating the problem from the user requirement end might help me to get a better a grasp.



-- Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to