Write Java Code in View Layer (cont.)

Complete Oracle ADF 12c Course for Beginners Write Java Code in Model and View Layer
16 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€65.14
List Price:  €93.07
You save:  €27.92
£55.73
List Price:  £79.62
You save:  £23.88
CA$95.61
List Price:  CA$136.60
You save:  CA$40.98
A$106.30
List Price:  A$151.87
You save:  A$45.56
S$94.64
List Price:  S$135.20
You save:  S$40.56
HK$546.91
List Price:  HK$781.33
You save:  HK$234.42
CHF 63.50
List Price:  CHF 90.72
You save:  CHF 27.21
NOK kr764.69
List Price:  NOK kr1,092.46
You save:  NOK kr327.77
DKK kr485.92
List Price:  DKK kr694.20
You save:  DKK kr208.28
NZ$117
List Price:  NZ$167.15
You save:  NZ$50.15
د.إ257.06
List Price:  د.إ367.25
You save:  د.إ110.18
৳7,661.98
List Price:  ৳10,946.16
You save:  ৳3,284.17
₹5,839.65
List Price:  ₹8,342.71
You save:  ₹2,503.06
RM331.75
List Price:  RM473.95
You save:  RM142.20
₦86,437.65
List Price:  ₦123,487.65
You save:  ₦37,050
₨19,492.21
List Price:  ₨27,847.21
You save:  ₨8,355
฿2,575.56
List Price:  ฿3,679.53
You save:  ฿1,103.97
₺2,262.43
List Price:  ₺3,232.18
You save:  ₺969.75
B$357.76
List Price:  B$511.10
You save:  B$153.34
R1,296.01
List Price:  R1,851.52
You save:  R555.51
Лв127.38
List Price:  Лв181.98
You save:  Лв54.60
₩95,113.23
List Price:  ₩135,881.87
You save:  ₩40,768.63
₪260.11
List Price:  ₪371.60
You save:  ₪111.49
₱3,999.61
List Price:  ₱5,713.97
You save:  ₱1,714.36
¥10,715.43
List Price:  ¥15,308.41
You save:  ¥4,592.98
MX$1,185.45
List Price:  MX$1,693.57
You save:  MX$508.12
QR254.79
List Price:  QR364.01
You save:  QR109.21
P955.69
List Price:  P1,365.33
You save:  P409.64
KSh9,427.65
List Price:  KSh13,468.65
You save:  KSh4,041
E£3,355.67
List Price:  E£4,794.02
You save:  E£1,438.35
ብር3,989.43
List Price:  ብር5,699.43
You save:  ብር1,710
Kz58,616.62
List Price:  Kz83,741.62
You save:  Kz25,125
CLP$66,326.02
List Price:  CLP$94,755.52
You save:  CLP$28,429.50
CN¥506.51
List Price:  CN¥723.62
You save:  CN¥217.11
RD$4,049.59
List Price:  RD$5,785.38
You save:  RD$1,735.78
DA9,420.19
List Price:  DA13,457.99
You save:  DA4,037.80
FJ$157.70
List Price:  FJ$225.30
You save:  FJ$67.59
Q542.62
List Price:  Q775.21
You save:  Q232.58
GY$14,613.08
List Price:  GY$20,876.73
You save:  GY$6,263.64
ISK kr9,792.30
List Price:  ISK kr13,989.60
You save:  ISK kr4,197.30
DH706.05
List Price:  DH1,008.69
You save:  DH302.63
L1,239.86
List Price:  L1,771.31
You save:  L531.44
ден4,010.92
List Price:  ден5,730.13
You save:  ден1,719.21
MOP$562.15
List Price:  MOP$803.11
You save:  MOP$240.95
N$1,302.54
List Price:  N$1,860.85
You save:  N$558.31
C$2,571.43
List Price:  C$3,673.63
You save:  C$1,102.20
रु9,317.58
List Price:  रु13,311.40
You save:  रु3,993.82
S/262.81
List Price:  S/375.46
You save:  S/112.65
K268.53
List Price:  K383.63
You save:  K115.10
SAR262.51
List Price:  SAR375.03
You save:  SAR112.52
ZK1,879.71
List Price:  ZK2,685.42
You save:  ZK805.70
L324.19
List Price:  L463.14
You save:  L138.95
Kč1,629.65
List Price:  Kč2,328.17
You save:  Kč698.52
Ft25,373.17
List Price:  Ft36,248.95
You save:  Ft10,875.77
SEK kr758.75
List Price:  SEK kr1,083.98
You save:  SEK kr325.22
ARS$61,468.94
List Price:  ARS$87,816.53
You save:  ARS$26,347.59
Bs482.36
List Price:  Bs689.12
You save:  Bs206.75
COP$272,946.91
List Price:  COP$389,940.87
You save:  COP$116,993.96
₡35,623.88
List Price:  ₡50,893.45
You save:  ₡15,269.56
L1,732.95
List Price:  L2,475.75
You save:  L742.80
₲523,151.84
List Price:  ₲747,391.81
You save:  ₲224,239.96
$U2,683.09
List Price:  $U3,833.15
You save:  $U1,150.06
zł281.85
List Price:  zł402.67
You save:  zł120.81
Already have an account? Log In

Transcript

Hello let's now try to write some code in zap view object and see how we can create a bag bean for the page and how you can start writing your own code. here as I can get take on the example we have two page department and in between let's run it and see how it does this page is and after that, we can see what exactly is the code which we can write. Okay, so we have this department page and once you press in mind buoy, it will navigate to another page if you select this it will back again. Okay, so what we can do I can try to write make here benilde step Okay, and I will show you once you select the tab if you want to write some code and it's a second tab, I will add the department as an four. So that we can do some programmatically to the form.

Because we need once you select this department we can write some code behind this selection. And for navigation, we can write some code to navigate instead of just select his outcome from action. And I think I can display some some message from back pain. Okay, so the first step let's try to create here at two steps and and it's believed that the board meeting set of tables will be in as informed. So here is a department page which we have little since a body has been a collection it's select inside this body Your faces that I need to tap now maybe the stable form okay. So I will add a drag this tips table tips table and they can from the data control drag a department size for a shoe navigation, that's fine and Okay.

Here we can track some operation like if we need to create roll from the Department of operation Create insert add do can track commit and rollback okay disable from commit and rollback because we need it always to be enabled okay. So I just created this I can add a new column here sorry a new button here I can all say go to boo wheeze okay. Normally we selected from action here outcome in between temp so that we can go straightaway to be with him because actually the speeches are the same Big flow. If you open here the big flow you find here department and inventory which is department and in between or looks no this is this department in blue so it is the same BG flow which has an outcome called MP temp and the temp. So I can easily select here. And actions select as it will go to the import if case if you want to make some code before you navigate.

So, how you we'll show you how you can write code without selecting it here like this. Okay, so let's start with was, was this action, I need to navigate to another page. But I don't want to write outcome here is action. I need to write to execute some code First and depending on the condition I will decide if I will never get or not. So is that case in section here, you selected it. Okay.

Here you should select the Manage been dimension which is a Java class which you should write your code so you don't have any magic beans you select new and you can see the beat name is the US, Tim and the class name is the use Tim bean and I will put it in the package view to be what is the difference between been under the plus name me name and the class name class name is the main Java class name, but the bean name is a prefix which will be used in the big level 2.2 Java class I will show you it is by default the scope is request I prefer this scope to be request you have another scopes what I need to request because we need to clear the memory wants we need once the object is loaded after the user leave it It should be deleted.

If you want it as a session or in other things you can put the variable in the session as we will see now. Okay now I will create one bean this bean I will make it for this bitch if you need another to access another black bean for another big when can eat its own beat and all beans will be in this package. Okay. So now it will create the class. Okay, here's the method, which you want. I will here navigate Action okay wonders Okay, so let's have a look.

Let's have a look here in the view to pin it create a class. This class now has an action called navigate to action and in the big level here is action. Here you will find go to the action here it select your beam you will find the message here navigate select it and the rest okay. So you will find here, this is the name which we will write once we create is a managed beans This is been named here, navigate to action. If you want to know how you can navigate from how you can know which bean and navigate to the action straight away you can go to the source here. Good source refunds action you can risk control from the keyboard and the receipt which will navigate to the message.

So once now the user press on this go to employee it will call this method. So we can write just to be sure that okay okay. So, here I want to navigate to in belief for example. Let us see here is employee okay if the department ID is equal 70 I need to be able to navigate to the MBE otherwise, always it is the ultimate is 70 don't navigate to Zimbabwe otherwise you can navigate this is an example how to do that So first I need to get the department ID. So, now before we start doing this, let us try to run and see the beach how it is I just now create a bundle step and I add the department as important. So let's run again just to have an idea about the beach how it looks like and I can explain what exactly we need to do okay is this a department table workmen form because both of them has the same iterator so once you select this row 70 wants you here you should be in the same department which you are select, okay.

Okay, so what I need to do is I need to once I Go to the MVP now if I press go to the MVP, I should see now called to navigate them from there it is called this misheard and printed this Okay, so I need now if the department ID equals 70 I should display an error message you can go to this inbox and if I select any other department here and go to employee, I should check if the department not equal to 70 if it is not equal 70 I will navigate you to make this code this business is the code so first thing I need to get the value of the department ID in my bag bean. So to get attribute value from a traitor because we are now one of the department a traitor, I have a method called get attribute from my traitor.

So here I will write our my if you tell dot Okay, I wouldn't be It dot get attribute from iterate This is return an object. So I will write object you should be have an you should have a basic knowledge of Java used to understand what I am talking now. So I right now object call divorced meant ID equal my if you tell the Java class which I created to get attribute from my trader. So, first we need to get the iterator name how you will get a traitor name you will get it from the big definition. So, you go to the big definition, this is a iterator name okay. Okay What is that attribute name which you want to get from this a treat or you should go to the View object goodwill attribute and I need this attribute this is attribute name.

This is how you can get the return name and attribute. Now, let us see the current dip is department ID. Okay we need to check if this department ID if it is not equal to 70 you can navigate otherwise don't navigate and display error message. So I will write if deport meant ID booked equal 70 if is equal to 70 I need to display error message and I should not never get to the But we don't show error message sorry you can we get to be please for the 70 and return no to stop okay if it is most of NT we should return what we should have turns out come here in Tim I would come which we normally set it here commercial a normal city uses MTM instead of sitting straight away here No I will navigate to the back pain and the forms the back pain I will return the outcome.

Okay, so let's have a look in this. How in this code now we know understand how You can first create a management, how you can map one of the button action to the function in between how you can get value from my traitor to check it and how you can display your message and how you can navigate to one or bitchu it does now try to this this, see how it all works? Okay so select now bill is 70 apartment couldn't be we now sorry you can navigate to me to you for the passivity. See now you will display an error message and you will not be able to navigate. But if we select any other department and try to press here, it will navigate correct. So this is an example how to can get value from the current a traitor how to get to this Because it's a table once you select the row the traitor will be marked as a as a current row because here in the table there are here in the behavior there are selection listener.

So, it will make zero as a current throw in a listener at iniquity of component it means it is something related to the backbone you can you can run a Java code to make this to handle this listener. So, it once you drag any table I just give you an example if you sit at the mark as single row, it will enable that once you select a row this row will be marked as a current row for a traitor. So, is the bag been once you sit get a tribute from a traitor. It will gets the current row value. So now I need after this example, as I said, you know able to override the actions or the Actions button, you can display your message you can get value from the current draw of the iterator, you can navigate to another page. So, from the negativity I'll give you another example.

So see you next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.