Marco Rolappe dijo:
well, it does work, I tried it out.
only one generator per pipeline, that's right (only one generator can be
set at pipeline setup time). but in this case, there is only one
pipeline, that is the ServerPagesGenerator. the redirect is to another
pipeline.
Sorry I dont know and I think that as you told. This is a ugly solution.
And I dont know if the code can be used in future releases of Cocoon.
Anyway I recomend to use the correct approach. Solutions are always many,
but we need to use the best.
The Cocoon gurus said that the XSP-Action for databases is not the best:
http://xml.apache.org/cocoon/userdocs/concepts/databases.html
Actions are especially great for inserting, changing, or deleting data.
Employing the pipeline-switching features of actions will simplify your
pages. Such actions are concerned with only one view: either the success
or failure of an operation.
ESQL is great when reading data from a database. However, it is less
attractive to use when it has to react to operation failures. This is due
to the fact that it adds a layer of complexity to an XSP file, making it
more difficult to understand and maintain.
Best Regards,
Antonio Gallardo
anyway, I can imagine the use of XSP actions for prototyping (apart from
generating and using XML fragments).
-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]Im
Auftrag von Antonio Gallardo
Gesendet: Dienstag, 21. Januar 2003 03:03
An: [EMAIL PROTECTED]
Betreff: Re: AW: XSP Redirection HELP!!!
This will does not work because you have one generator in the pipeline.
A strict rule in any version af Cocoon told:
Just ONE generator for pipeline
then the another generator on the target of the redirection will not be
loaded. I think it will throw a Exception. (Gurus, please shine us and
tell us what will happen). I never tried to do somethig like this. See
more comments down.
another alternative would be to use your xsp via the already mentioned
ServerPagesAction (if you must use xsp):
form action=save-form-data ...
in your sitemap:
map:match pattern=save-form-data
map:act type=serverpages src=save-form-data.xsp/
...
/map:match
for this, you must have the serverpages action declared in the
sitemap. then you can redirect via map:redirect-to in the sitemap or
you can redirect from within the xsp via action:redirect-to (action
logicsheet).
third alternative would be to directly code the action, invoke it in
your 'save-form-data' pipeline, after which you redirect.
I think this is a good aproach too. But I dont see why to waste a XSP
when any flavor of Database Action (Original or Modular) can do this for
you. Listen:
If you think you need your special XSP page because you need to validate
the form data that you received from the user request. The answer is:
Why reinvent the cool water? There is another fine action that can do
this for you, please check the following snip from my sitemap:
!-- catalog of Table --
map:match pattern=*-table.html
!-- Create --
map:match type=request-parameter pattern=cocoon-action-Create
map:act action=crear type=form-validator
map:parameter name=descriptor value=docs/{../1}-form.xml/
map:parameter name=validate-set value=add/
!-- Here data are safely validated --
map:act type=dbAdd
map:parameter name=descriptor value=docs/{../../1}-form.xml/
!-- At this point the data are already stored in the database --
map:redirect-to uri=where_ever_you want/
/map:act
!-- Here was wa problem. Data are not into the database, but validated
--
/map:act
!-- Here Data are not passed the validation check --
!-- You can let it empty, since if no other pipeline match it, the
handle error will take care of what happened --
/map:match
For more info about form Validation Action, please check:
http://wiki.cocoondev.org/Wiki.jsp?page=FormValidationUsingCocoon
I hope it will help you. ;-)
Antonio Gallardo
-
Please check that your question has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
Please check that your question has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]