Changes for page Best Practices

Last modified by Vincent Massol on 2017/09/05

<
From version < 6.2 >
edited by Manuel Smeria
on 2013/01/24
To version < 6.1 >
edited by Vincent Massol
on 2012/11/17
>
Change comment: Guidelines for where to put code

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ManuelSmeria
1 +XWiki.VincentMassol
Content
... ... @@ -1,11 +2,7 @@
1 -{{box cssClass="floatinginfobox" title="**Contents**"}}
2 2  {{toc/}}
3 -{{/box}}
4 -
5 5  = Where to put code? =
6 6  
7 -Since xwiki allows you to put code both in wiki pages and in Java you might wonder where you should put your code. Here are some general guidelines:
8 -
4 +Since xwiki allows to put code both in wiki pages and in Java you might wonder where you should put your code. Here's some general guidelines:
9 9  * Don't put "business logic" code in wiki pages. Use Java for that. This gives you nice IDEs, the ability to easily debug the code and the ability to write automated unit tests. Generally speaking it makes it easy on maintenance.
10 10  * In general put the minimum amount of scripts in your wiki pages since that makes it harder to maintain.
11 11  * The only scripts that you may put in wiki pages are "presentation logic" code.
... ... @@ -32,7 +32,7 @@
32 32  {{/code}}
33 33  
34 34  {{info}}
35 -The 'if' tests first for the non existence. This is so that XWiki can extract the title from the //1 User Sheet//, which is a proper title to display when viewsing the sheet page, instead of the computed name which will usually display something wrong.
31 +The 'if' tests first for the non existence. This is so that XWiki extract the title from the //1 User Sheet//, which is a proper title to display when viewsing the sheet page, instead of the computed name which will usually display something wrong.
36 36  {{/info}}
37 37  
38 38  = Handling errors when using xredirect for non-Javascript UIs =

Get Connected