Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to navigate to navigate to another jsff page and then execute a method

User_Q9C3JAug 10 2022

Hello, my JDeveloper version is Studio Edition Version 12.2.1.4.0 and I am relatively new to all of this, so please bear with me.
Basically, I want to navigate from one .jsff view to another .jsff view and then execute a function from a managed bean immediately.
My setup: on the first .jsff view there is an af:table with a certain column containing links. If I click on a link in one row, I want to navigate to another .jsff view, open up a specific af:showDetailItem in an af:panelTabbed, and select a certain row in the af:table inside this af:showDetailItem that corresponds to the row I clicked in the first .jsff view.
I know it is built into the task flow framework to allow a method call and then a switch to a view, but I need the other way around because this method needs to be able to interact with the components on the second page (opening a tab and selecting a row in the table).
I looked around a lot online and a lot of people reference https://blogs.oracle.com/aramamoo/entry/an_epic_question_how_to in response to similar questions, but it seems this article is no longer active or I do not have access to it. I also have read it is possible to navigate to a view and then have an invisible field in the UI have a 'rendered' property that will call a function in the bean and you can execute your functionality there. I was wondering if there is a more standard way to solve this that is more built into the framework. If I am also going about this the wrong way, please let me know.
If anyone has encountered something similar, any help would be appreciated.
--Scott M.

This post has been answered by User_Q9C3J on Sep 12 2022
Jump to Answer

Comments

843793
Well, this was a shot in the dark, but I tested it and it seems to be the problem: remove the parens around i.next()!

After doing so, running the code in your post instead provides a "NoSuchElementException" from the iterator (completely expected). I'm not sure if this a bug in the compiler, or if it has something to do with the way the code gets expanded. Maybe if someone thinks about it long enough they'll be able to come up with a reason.
843793
Why would you expect to use those parens like that anyway?
843793
Why would you expect to use those parens like that
anyway?
I can see that the parens are redundant - and as the other responder pointed out, the error goes away when they are removed...however, I'm still curious...

Firstly, is it actually an error to use the parentheses in that way?

Secondly, although the offending line is executed in the example I gave, the code that I pulled the example from is a bit stranger - when I try to instantiate a class (call it B), that contains a method with the redundant parentheses, I get the same error - even though the offending line isn't executed (I can post the code tonight if anyone is interested).

Gareth
843793
Here's the code:

import java.util.*;
class A {
public static void main (String argv[]) {
B bb = new B();
}
}

class B {

void methodC() {
ArrayList<Boolean> B = new ArrayList<Boolean>(10);
Iterator<Boolean> i = B.iterator();
boolean b = (i.next()).booleanValue();
}
}

843793
This is definitely a bug in the compiler. The bytecode generated for B.methodC() is:

Codeview "bytecode" for void B.methodC():
#3/Test.java:12 - new class java.util.ArrayList
#4/Test.java:12 - dup
#5/Test.java:12 - bipush (byte)10
#6/Test.java:12 - invokespecial public java.util.ArrayList(int)
#7/Test.java:12 - astore_1 lv_1
#8/Test.java:13 - aload_1 lv_1
#9/Test.java:13 - invokevirtual public java.util.Iterator java.util.AbstractList.iterator()
#10/Test.java:13 - astore_2 lv_2
#11/Test.java:14 - aload_2 lv_2
#12/Test.java:14 - invokeinterface public abstract java.lang.Object java.util.Iterator.next()
#13/Test.java:14 - invokevirtual public final boolean java.lang.Boolean.booleanValue()
#14/Test.java:14 - istore_3 lv_3
#15/Test.java:15 - return

and it's clear that between instruction #12 and instruction #14 a typecast is missing.

I'll add this to my list of known prototype compiler bugs at
http://cag.lcs.mit.edu/~cananian/Projects/GJ/
1 - 5

Post Details