In this blog entry I am going to create a Hello World page in Apex. The page will be a little more sophisticated in that a user will be able to enter their name and submit it. The page will then say Hello to the user name.
To achieve this I'm going to complete the following steps:
- Create an application in Apex complete with a Page
- Create a region on the page
- Create a text entry field
- Create a submit button
- Create a display region to say Hello to the entered user name
Step 1, Create a new application in Apex complete with a page
In Apex 4.2, from the Home Screen click
- Application Builder
- Create
- Check the Radio Group Database
- Next
- Next
- Create Application
- Create Application
Step 2 create a region to hold the page items.
Click on the home page
In tree view, right click on regions and then click
- Create
- Select the HTML radio group
- Next
- Select the HTML radio group
- NEXT
- Enter a title of Region 1
- Click Create Region.
Now the region is created the edit screen is displayed.
Step 3, Create a text entry field
- Right Click on Region 1 and select Create Page Item
- Select the radio group Text Field and click Next
- Enter an item name of P1_ENTER_NAME then click Next
- In the label enter the text Enter Name, then click
- Next
- Next
- Create Item
Step 4, Create a submit button
- Right Click on Region 1
- Click Create Region Button
- Enter a name of P1_SUBMIT
- Set the label value to Submit.
- Click Create Item
Step 5, Create a display region to say Hello to the entered user name
- Right click region 1 and select Create Page Item
- Select Display Only, (not display image)
- Next
- Set item name to P1_RESULT
- Next
- Set label to Hello
- Next
- Next
- Set Source used to Always, replacing any existing value in Session State.
- Source Type to PL/SQL Expression
- In the Source value or expression enter :
These settings mean
- Always change the value of the field
- The source for the value of the filed will be derived from PL/SQL
- Set the value to the value of P1_ENTER_NAME as held in session state.
Step 6, Run the page
Click run on the page. Enter a name and press the submit button.
Summary of how the page works
- A user enters their name into the text box (P1_ENTER_NAME).
- When Submit is pressed the page is submitted, the values of all fields are placed in session state and the page is startes to re-render.
- The display only field is set to the same value as P1_ENTER_NAME through the call to apex_util.get_session_state ('P1_ENTER_NAME').
No comments:
Post a Comment