Scott Van Wart wrote:

Michael Jouravlev wrote:

I suggest to look at your issue from another perspective. Do you
really need the functionality you are asking for? First, a small
clarification. There is no input page for an action, "input" attribute
is poorly named, it should be called "error" or "errorTarget", because
Struts forwards to that location if input data does not validate. Your
request is always sent to action/actionform.

That might be it then... it might just be a matter of having to separate things out a little more. So let's say I had a page that edits an entity. I might call this edit_entity.jsp, with an EntityForm, and a SaveEntityAction. I found things got a little cumbersome in the .jsp, so I separated it out into a create_entity.jsp and edit_entity.jsp. These two forms submit to the same action. Obviously, they have a lot of code in common, but I thought of factoring that out into tags. Perhaps I should do the same thing to the action class (CreateEntityAction and UpdateEntityAction rather than all-encompassing SaveEntityAction; any code duplication can go into base classes or utility classes).

The other side of this is that I also have a ShowEntityForm and ShowEntityAction. The action is mapped to /showEntity, and there are three forward mappings from there. Two are "success"-like forwards called "create" and "edit", which forward to create_entity.jsp and edit_entity.jsp. The 3rd one, the "failure" forward's destination would depend on who called /showEntity in the first place. The ShowEntityForm has validation, to ensure the given entityId is a number, and the "failure" forward gets hit when the entityId can't be found in the database table. While I can break the "failure" out into multiple forwards, I can't do the same with input.

So the question is, then, do I break up my ShowEntityXxxxx classes into things like NewEntityAction->create_entity.jsp->CreateEntityAction and EditEntityAction->edit_entity.jsp->UpdateEntityAction? It's starting to sound like a lot more classes, but if I'm on the right track, and if that's how Struts is designed, then perhaps that's the point.

Or I could be completely off my rocker.

:)

- Scott

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


Scott,

I think your approach, if I understand it right, should be fine. In our application, we start with a query page that allows entry of data for a query or has a link to create a new object. If they enter query information we go to a query action which generates a results jsp or returns them to the query jsp if no matchs are found. On the results page on each line displaying a item, we have 3 links that either show them the details for the item, allow them to update the item or delete the item. Links are displayed based on the role that the user might have.

HTH,

Al


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

Reply via email to