Japanese learning notes

Source: Internet
Author: User

1. Control the Output Time
<Div>
<P> This part is cached for 10 seconds. Note the timeout spec with invoke overrides cachefor annotation. </P>
'A controllers. More. portlets. panel2 (B), "10 s"
</Div>
<P> the text is displayed for 10 seconds and then enters panel2action.

2. Log: log directives are used to print a line of information to the console. It can take an argument of string
'Log
'Log A + I
'Log "a message"
The log command is used to output a line of information on the console. You can add parameters later. The output result is as follows:
Japidviews/templates/log.html (line 5 ):
Japan views/templates/log.html (line 14): A10
Japidviews/templates/log.html (line 18): a message

3. Stopwatch M outputs the time required to render to the template

4 .~ I directly outputs the I value

5. 'ach posts | string P is equivalent to 'for string P: posts,
' for string P: Posts

index: $ _ index, parity: $ _ parity, is odd? $ _ Isodd, is first? $ _ Isfirst, is last? $ _ Islast, total size: $ _ size


call a tag: 'tag sampletag P
'
output index: 6, parity: even, is odd? False, is first? False, is last? True, total size: 6
another format
'For (final post P: Posts) {
another notation for invoking actions:
'invoke application. echopost (p)
'}

6. If-else loop Syntax:
'If expr' if (asboolean (expr )){
Xxx
'Else if expr'} else if (asboolean (expr )){
YYY yyy
'Else'} else {
Zzz
''

7. 'reressnull on if the following error occurs, as shown in figure
'A = NULL;
Safe to do a. Something too: $ A. Length ()
Output safe to do a. Something too:

8. dontredirect (); controls to stay on the original page without redirecting to the page.

Note:

When a listener is running on play, an HTTP redirection is required to call an action.

If the supervisor does not want to redirect, it must call japidcontroller. dontredirect () to avoid

9. $ {},~ A, $ A and $ {escape (a)} And ~ {A} the values of these expressions are equal.

10. An error occurred while reading the page.
'For (error E: errors ()){
<P> $ E. getkey (): $ e </P>
'}

11. The "Elvis operator" is short for the Java three-object operator. A convenient method is to return a reasonable default value if the expression value is false or null. Well, the Elvis operator I implemented is indeed not the same as in Java :) what I added? : The combination symbol only works in the $ {} tag.
Name? : "Empty"

12. 'dobody M: return to the original interface with parameters. The parameter list in this command must match the parameter declaration after "|" at the call, and the Dobody must pass the matching parameter to the template.

13. Join (strings, "|"): strings is a list. This method adds "|" to each element in the list to form a string.

14. The results returned by 'invoke and 'a triggered actions are directly inserted into the original interface as part of interface parameters. Note: The action starting from invoke does not jump to the page.

15. renderjapan ID (object... objects): Jump to the original interface with Parameters

16. renderjapjapidwith (string template, object... ARGs): Jump to the specified template with parameters, You can render multiple templates in an action.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.