Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -36,7 +36,7 @@ 36 36 {{code language="velocity"}} 37 37 #handleRequest($success) 38 38 #if ($success) 39 - #if ($request.action == 'get' || $request.xpage 39 + #if ($request.action == 'get' || $request.xpage== 'plain') 40 40 ## JavaScript call here. 41 41 Action was successful. 42 42 #elseif ("$!request.xredirect" != '') ... ... @@ -63,7 +63,6 @@ 63 63 ... 64 64 #elseif ("$!request.xredirect" != '') 65 65 ## No-JavaScript here. Redirect and forward error message. 66 - #set ($errorMessageKeyPrefix = "myModule.error.") 67 67 $request.session.setAttribute("${errorMessageKeyPrefix}${request.xredirect}", 'Action was NOT successful') 68 68 $response.sendRedirect($request.xredirect) 69 69 #end ... ... @@ -75,7 +75,6 @@ 75 75 {{code language="velocity"}} 76 76 ... 77 77 #set ($xredirect = $doc.getURL($context.action, $!{request.queryString})) 78 - #set ($errorMessageKeyPrefix = "myModule.error.") 79 79 #set ($errorMessage = $request.session.getAttribute("${errorMessageKeyPrefix}${xredirect}")) 80 80 #if ("$!errorMessage" != '') 81 81 ## Clean the error and display the message. ... ... @@ -90,6 +90,4 @@ 90 90 1. it's already there in both the UI (for sending it as parameter) and the background service (received as parameter) 91 91 1. it acts like a namespace, ensuring that the error will only be displayed for the current page/request. 92 92 93 -Using a prefix as above allows you to have multiple components (wiki macros, gadgets, etc.) in the same page using the same mechanism without collisions. 94 - 95 95 This method works together with the whole purpose for which we are doing the redirect in the first place (so that the user can refresh the page without re-sending the action or re-posting a form), ensuring that after the first display, on a refresh, the error goes away.