managed bean configuration
Hi experts,
In what two places you configure controlled beans?
A. in the definition of page file
B. in the faces-config file. XML
C. in the adfc-config. XML
D. in the Properties Inspector
E. in the workflow definition files
Thank you
In the faces-config file. XML
. In the config.xml file - adfc
Tags: Java
Similar Questions
-
Workflow managed bean with dynamic class
Hello
I am trying to create an Adaptive workflow, which is generic and can be reused. The problem I have is trying to define the bean managed support. Ideally I'd like a different class of bean to be used in various circumstances, but with the same name. I don't know what class to use until the output of the task is called.
I can't use for EL do know
<managed-bean id="__1"> <managed-bean-name>RegionBacking</managed-bean-name> <managed-bean-class>${pageFlowScope.regionBackingClass}</managed-bean-class> <managed-bean-scope>pageFlow</managed-bean-scope> </managed-bean>
(regionBackingClass is a java.lang.String parameter passed in the taskflow with the class path).
At this point, I need to use different classes have the same method names in their breast, just different code in methods, but that could change in the future.
Thank you.
Hello
use a model approach. The managed bean configured as managed bean is simply a wrapper and instantiated dynamically the class that you want to manage the logic. Thus, you can for example pass the class name as input argument for the workflow in the managed bean and admire you the name then create the instance of the class to send all requests to.
Frank
-
The flow of work, Servlet, popup and a managed Bean validation
Hello
We try to display a PDF file in a pop-up window by calling a Servlet in a JSF page using a workflow in JDeveloper 11 g R2.
The relevant part of JSF:
The /pdfservlet points to a Servlet with a method doGet as follows:<af:inlineFrame id="if1" shortDesc="Report" source="/pdfservlet" styleClass="AFStretchWidth"></af:inlineFrame>
The Servlet is trying to get the FacesContext, but we met with the following exception:protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.reset(); OutputStream out = response.getOutputStream(); FacesContext context = this.getFacesContext(request, response); OracleReportBean bean = context.getApplication().evaluateExpressionGet(context, "#{reportBean}", OracleReportBean.class); bean.run(context, out); removeFacesContext(); out.close(); }
We have removed the following lines to the getFacesContext() method:Caused By: javax.faces.FacesException: Cant instantiate class: oracle.adfinternal.view.faces.component.AdfViewRoot.
This avoids the exception above, however... We try to get the settings of the form that was submitted. Here is an example of the form element:UIViewRoot view = facesContext.getApplication().getViewHandler().createView(facesContext, ""); facesContext.setViewRoot(view);
When the Servlet calls the Bean managed to retrieve the value, it uses:<h:inputHidden value="MyMedicationList_Report" id="system_REPORT_RESOURCE"/>
Where getRequestParameters() tries to get the external context to retrieve the map of query parameter values:Map<String, String[]> requestParameters = getRequestParameters(); Parameters p = getParameters(); for( String key : requestParameters.keySet() ) { for( String value : requestParameters.get( key ) ) { int i = key.indexOf( ':' ); if( i >= 0 ) { key = key.substring( i + 1 ); } p.put( key, value ); } }
The card is empty.return getExternalContext().getRequestParameterValuesMap();
I tried after http://www.oracle.com/technetwork/developer-tools/adf/learnmore/oct2010-otn-harvest-183714.pdf by assigning the web.xml file:
And set the data bindings on:<!-- JspFilter must be configured before adfBindings. --> <filter-mapping> <filter-name>JpsFilter</filter-name> <servlet-name>PDFServlet</servlet-name> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>REQUEST</dispatcher> </filter-mapping> <filter-mapping> <filter-name>adfBindings</filter-name> <servlet-name>PDFServlet</servlet-name> <dispatcher>FORWARD</dispatcher> <dispatcher>REQUEST</dispatcher> </filter-mapping>
The Servlet is running, called the managed bean instantiated, but cannot read the query parameters.<pageMap> <page path="/pdfservlet" usageId="ca_bcpra_promis_reporting_view_PDFServletPageDef"/> </pageMap> <pageDefinitionUsages> <page id="ca_bcpra_promis_reporting_view_PDFServletPageDef" path="ca.bcpra.promis.reporting.view.PDFServletPageDef"/> </pageDefinitionUsages>
Is the button used to start the workflow in a dialog box:
By using a workflow, the user input are validated before the opening of the pop-up window. We want to keep this behavior. The PDF file opens and then returned with a NullPointerException:<af:commandButton text="Run Report" id="submitReport" useWindow="true" windowEmbedStyle="inlineDocument" windowModalityType="applicationModal" windowHeight="500" windowWidth="700" action="runReport"/>
http://pastebin.com/raw.php?i=PaM64jL4
The Servlet, through the managed bean, made a request to the report server to pass parameters and generate a PDF file. The PDF is sent to the browser via the Servlet.
What other steps can we take to:
1. send user and system parameters.
2. generate a PDF file on a remote server.
3 distribute the PDF file to the user in a pop-up window.
Thank you.Here you go
https://www.EverNote.com/shard/S48//sh/ae8f58be-c4d3-4AB9-8F94-3e01d0e967d0/923ab115aca22fd1e2fccbf6321cbf09Timo
-
Generate PDFS using Managed Bean with custom HTTP headers
Background
Generate a report in various formats (PDF, delimited, Excel, HTML, etc.) using JDeveloper 11 g Release 2 (11.1.2.3.0) when you click on an af:commandButton. See also the version StackOverflow about this issue:
http://StackOverflow.com/q/13654625/59087
Problem
The HTTP headers are sent twice: once by the framework and once by a bean.
Source code
The source code includes:
-Action button
-Managed Bean
-Task flow
Action button
The action of the button:
< af:commandButton text = 'Report' id = 'submitReport' action = "Execute" / >
Managed bean
The managed Bean is relatively complex. The code "responseComplete" get called, however, it does not seem to be called early enough to avoid the framework application writes the HTTP headers.
Substitution of HTTP response header
/**
* Defines the HTTP headers must indicate to the browser that the
* the report must be downloaded (not displayed in the current
* window).
*/
protected void setDownloadHeaders() {}
HttpServletResponse response = getServletResponse();
response.setHeader ("Content-Description", getContentDescription());
response.setHeader ("Content-Disposition", 'attachment filename ='
(+ getFilename());
response.setHeader ("Content-Type", getContentType());
response.setHeader ("Content-Transfer-Encoding',
getContentTransferEncoding());
}
Question answer full
The bean indirectly says infrastructure that the answer is managed (by the bean):
getFacesContext () .responseComplete ();
Bean, run and configure
public void run() {}
try {}
Report = getReport();
Configures (Report.GetParameters ());
Report.Run ();
} catch (Exception e) {}
e.printStackTrace ();
}
}
private void configuration (parameters p) {}
p.put (ReportImpl.SYSTEM_REPORT_PROTOCOL, "http");
p.put (ReportImpl.SYSTEM_REPORT_HOST, "localhost");
p.put (ReportImpl.SYSTEM_REPORT_PORT, "7002");
p.put (ReportImpl.SYSTEM_REPORT_PATH, "/ reports/rwservlet" "");
p.put (Parameters.PARAM_REPORT_FORMAT, 'pdf');
p.put ("report_cmdkey", getReportName());
p.put ("report_ORACLE_1", getReportDestinationType());
p.put ("report_ORACLE_2", getReportDestinationFormat());
}
Workflow
The workflow calls Execute, which refers to the 'run()' of the bean method:
entry-> Home-> run-> ReportBeanRun
Where:
<-l' call the method id = "ReportBeanRun" >
< description > running a report < / description >
Report to run < display name > < / display-name >
< method > #{reportBean.run} < / method >
< result >
success of < fixed-result > < / fixed-results >
< / results >
< / method >
The bean is assigned to the scope of the "demand", with a few managed properties:
< rule of flow control = "__3" id >
hand < of-activity-id > < /-activity-id >
< control-flow-case id = "ExecuteReport" >
run < from outcome > < / de-results >
ReportBeanRun < to-activity-id > < / to-activity-id >
< / control-flow-case >
< / control-flow-rule >
< managed-bean id = "ReportBean" >
< description > running a report < / description >
< display name > ReportBean < / display-name >
application of < managed-bean-scope > < / managed-bean-scope >
...
< / managed-bean >
The "success < fixed-result > < / fixed-result > ' strikes me as wrong - I don't want to not the method call to return to another task."
Restrictions
The report server receives requests from the web server only. The URL of the report server cannot use browsers to download directly, for security reasons.
Error messages
The error message is generated:
Duplicate received headers from the server
349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION) error: multiple headers received separate Content-Disposition. It is not allowed to protect themselves against HTTP response splitting attacks. Nevertheless, the report is generated. Prevents the framework to write headers HTTP would solve this problem.
Question
How can define you HTTP headers in ADF using a workflow to generate a PDF file by calling a managed bean?
Ideas
Some additional ideas:
-Substitute the listener of the Phase of the lifecycle of Page ("ADFPhaseListener" + "PageLifecycle")
-Develop a customized web server Servlet
Related links
-http://www.oracle.com/technetwork/middleware/bi-publisher/adf-bip-ucm-integration-179699.pdf
-http://www.slideshare.net/lucbors/reports-no-notes#btnNext
-http://www.techartifact.com/blogs/2012/03/calling-oracle-report-from-adf-applications.html?goback=%2Egde_4212375_member_102062735
-http://docs.oracle.com/cd/E29049_01/web.1112/e16182/adf_lifecycle.htm#CIABEJFB
Thank you!The problem was that the HTTP headers have been actually written twice:
1. the report server returns the HTTP response headers.
2. the bean was his own (as mentioned in the question) HTTP response headers.
3. the bean was copy all the contents of the report server response, including headers, to the output stream.Firefox has ignored the header in double, but not Google Chrome errors.
-
JDeveloper 11 g managed bean &; resource bundle mysteries
Hello
I literally fight JDeveloper to make the location of my application. I want to set the locale of all my pages to a value of a managed bean (which gets the database for all users), so I put < f: view local = "#{Configuration.language}" > and get all the labels and strings in my UI to a resource group.
Two issues were raised:
1. I created a bean managed and recorded as 'Configuration' in faces-config. XML with scope. The managed bean is a private channel 'language' with accessors. When I use the "expression builder" on any page, it creates the following expression: "#{applicationScope.Configuration.language}". Unfortunately, it returns nothing. Manual change of the expression "#{Configuration.language}" finally returns! Why isn't he created like this by the generator expressions in the first place? I did sth. evil?
2. I created a resource 'view.resources.UIresources' group and registered as "res" in faces - config.Xml. reference manually as #{res ['arbpl.titel ']} works fine. When the regional settings of the page are changed, strings are loaded from the appropriate resource bundle. As there is a lot of hits, I would use the wizard 'Select a resource text' or enter the values directly in the designer.
However, the Assistant to "Select a text resource" refers to some crazy #{viewcontrollerBundle ['arbpl.titel']} and add "< c:set var ="viewcontrollerBundle"value="#{adfBundle['view.resources.UIresources']}"/ >" under the jsp:root. What is everything? The problem is that this way always the default resource group appears to be responsible no matter what locale are defined in the f: view.
Who can help me see clear here?
Thank you
MattMatt,
Step 1 - really think you so that it is within reach of the session - if it is different for each user, it should be.
In addition, on the generator, you are using the node called JSF managed Beans and navigate directly on your beans?
John
-
Using @Interceptors with ADF managed beans
Hi Experts,
I am using the annotation javax.interceptor.Interceptors on my methods of ADF managed beans, but my methods of interception are not get called.
Is it possible to use it with controlled beans? Has anyone tried this before?
JDev: 11.1.1.7
Java: 1.7
MyInterceptor.java
=========
public class MyInterceptor {}
public MyInterceptor() {}
Super();
}
@AroundInvoke
public object intercept (InvocationContext context) throws Exception {}
System.out.println ("MyInterceptor - logging BEFORE calling method:"+ context.getMethod () .getName () ");
Object result = context.proceed ();
System.out.println ("MyInterceptor - logging AFTER calling method:"+ context.getMethod () .getName () ");
return the result;
}
}
=========
SomeBean.java
=============
public class SomeBean {}
@Interceptors (MyInterceptor.class)
{} public void doReset (ActionEvent actionEvent)
do something
System.out.println ("In reset");
}
}
=============
Thank you
Soham
As far as I KNOW, JSF(and ADF) can't stand the interceptors.
Maybe you can try this in 12.2.1 jdev because with this version is packaged 2.2 JSF (which should support the CDI)
Dario
-
How to call a function with parameters in jsf managed Bean
Hello
1. I created a Bean managed to manage chains of jsf to 11.1.1.7 WebCenter spaces:
public class ManageStrings {}
/ * Converts all characters in a string to uppercase. */
public String getToUpperCase (String str) {}
Dim retVal = str.toUpperCase ();
Return retVal;
}
}
2. I registered managed Bean:
" < managed-bean id ="swc_3"xmlns =" http://xmlns.Oracle.com/ADF/controller "> "
< id managed-bean-name = "swc_2" > tools < / managed-bean-name >
< managed-bean-class id = "swc_1" > cat.badalona.webcenter.utilities.ManageStrings < / managed-bean-class >
< managed-bean-scope id = "swc_4" > backingBean < / managed-bean-scope >
< / managed-bean >
3 to code jsf, I tried different options, but they do not work
" < = xmlns:af af:outputText ' http://xmlns.Oracle.com/ADF/faces/rich "value="#{backingBeanScope.utilities.getToUpperCase['hello']}"/ > "
...
" < = xmlns:af af:outputText ' http://xmlns.Oracle.com/ADF/faces/rich "value="#{backingBeanScope.utilities.toUpperCase['hello']}"/ > "
..
" < = xmlns:af af:outputText ' http://xmlns.Oracle.com/ADF/faces/rich "value =" #{backingBeanScope.utilities.getToUpperCase ('hello')} "" / >
What I am doing wrong?
Thaks in advance
Hello Carles,
I did it with the content presenter where I need to pass the ID of the component selected in backing bean. Please try below option
Now add following code in your binding
Private RichOutputText outputText1;
then the getter for this outputtext set.
and in your action method to read the value of the output text.
Hope this helps with your problem.
Thank you
Amey
-
Difference between the managed bean scopes.
Hello.
I have jdeveloper 11g and I wanted to know what is the difference between the scopes when managed beans (FlowScope, request, Backed Bean, etc.).
Kind regards.
Refer
-
Hi all
I have a question, I am a beginner with ADF and learn a lot through these forums and Google
Using Jdeveloper 11.1.1.7
is the question I have, I have a cluster/HA environment (2 knots) and move my application to use HA.
I changed the ADF - config.xml to add the following line:
" < adf-controller-config xmlns =" http://xmlns.Oracle.com/ADF/controller/config "> "
< adf-scope-ha-support > true < / adf-scope-ha-support >
< / adf-controller-config >
I currently have a managed bean (ViewScope) and it has all my actionListeners/valueChange etc... etc... It also has my UIComponent links and I have also several methods that define specific attributes on these components and then do:
AdfFacesContext.getCurrentInstance () .addPartialTarget ("ComponentRefHere");
I am aware that I have to put my beans managed to implement Serializable I also understand that the UI components are not serializable.
I use the ComponentReference method that is to say:
private ComponentReference<RichPanelBox> iframePB; public void setIframePB(RichPanelBox component) { iframePB = ComponentReference.newUIComponentReference(component); } public RichPanelBox getIframePB() { return uiComponentBean.getIframePB(); }
is the question I have, I can leave it like that? or will I move them to a different managed bean?
If so, how should I put the bean, it must also implement serializable, and how do I access them from my managed bean viewScope.
Thank youYou don't have to. Https://docs.oracle.com/javaee/6/tutorial/doc/gjbbk.html documentation
The beans that use the scope of the conversation, application, or session must be serializable, but beans that use the scope of the request need not be serializable.
I personally always add the serializable interface as the bean has never should be selected for serialization, it should not control. It is easier to tell everyone to add it anyway. In this way, you can use the same class in all scopes.
Timo
-
Hallo,
I have a fragment for which I created a managed bean extended backingBean.
My doubt is where I save this bean.
In the main stream task without terminals? Or in the stubborn workflow in which the frament is used?
Thank you
Federico
In the BTF where the fragment is used!
-
character of JSF managed bean error encoding page
My request is internationalized, and then I need special characters (accents of Spanish, copyright symbol,...). I test if I get the string to a managed bean that does not work.
JSF page:
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE html> <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"> <af:document title="Test" id="d1"> <af:form id="f1"> <af:panelGroupLayout id="pgl1"> <af:outputText id="ot1" value="áéióúñ © it works" /> <af:outputText id="ot2" value="#{myBean.text} it doesn't work" /> </af:panelGroupLayout> </af:form> </af:document> </f:view>
Bean
public Class MyBean { public MyBean() { } public String getText(){ return "áéióúñ ©"; } }
I found this old post:
But this solution is for the JSPX pages:
< jsp:directive.page contentType = text/html"; Charset = UTF - 8 "/ >
How can I solve this problem for ADF 12 c + JSF pages / Fragments of JSF Page. ?
It should work.
Check the compiler settings in the project properties (and also check: Tools-> preferences...-> environment)
Also check the encoding in the file pageDef (if you have one).
Dario
-
Hallo,
I have a request based on VO.
The query contains a where clause clause and a bindi variable.
In a managed bean I would like to access the iterator of VO setting the value of the bind variable and read the result.
I found this code it is good start, but I do not know how to set the variable binding.
BindingContext bctx = BindingContext.getCurrent(); BindingContainer bindings = bctx.getCurrentBindingsEntry(); DCIteratorBinding iter = (DCIteratorBinding ) bindings.get("MyVO1Iterator"); iter.execute();
You kindly help me?
Also, I would like to know if it is generally advisable to use VO directly in controlled beans or whether it would be best to create in the AppModuleImpl methods that do this and return the result.
In my case for example of the VO will return max 1 plug so I'm in doubt, if the creation of a method in the AM that returns a custom class, which attributes contain values of the line of VO.
Sorry if these questions may seem artificial, but I am a beginner, I have many doubts and so I would be happy to receive some tips regarding best practices.
Thank you
Federico
You can use:
iter.getViewObject().setNamedWhereClauseParam("yourBindVar", value);
Note that this approach is used if you have bind variable in the where clause.
To set variables bind to ViewCriteria, you must use VarableValueManager.
This post may be useful for you: binary: how to set the Bind variable values at run time?
Also, I would like to know if it is generally advisable to use VO directly in controlled beans or whether it would be best to create in the AppModuleImpl methods that do this and return the result.
You must set "use VO directly.
For example, from the point of architecture, is probably best to use the method in the model project which will set the bind variable and execute the query.
Or you can use the ExecuteWithParams operation in your the view layer.
In my case for example of the VO will return max 1 plug so I'm in doubt, if the creation of a method in the AM that returns a custom class, which attributes contain values of the line of VO.
Not to complicate your life
All VO lines are represented as ViewRowImpl class if you already have "custom class".
Finally, you can generate your own ViewRowImpl class if it is necessary for this.
Dario
-
Several fragments of the page pointing to the same managed bean
Hi all
Jdev version 11.1.1.7.1
I wanted to know if we can point to several jsff developed o your managed bean?
While I'm trying to do, I don't get the option to create a new property or use an existing property of the bean while creating a link.
Is this possible, if so what should be the scope of these beans.
Hi Ashish,
The field itself has been disabled for me, what I did was save the bean in the scope of the Session in the config of the adfc. Now its working fine for me.
-
Hi all
I use jdeveloper 11.1.2.4.0
Can someone help on how to get the dbsequence managed bean?
Kind regards
Steve
How to use the trigger in the doDML?
You cannot use db trigger, but you can implement the logic of your trigger, something like:
protected void doDML(int operation, TransactionEvent e) { if(operation==DML_INSERT) BigDecimal yourSeq = new SequenceImpl("Learner_seq",getDBTransaction()).getSequenceNumber(); java.util.Date sysdate = new java.util.Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); String yourStudentNo = sdf.format(sysdate) + yourSeq.toString(); this.setStudentno(yourStudentNo); } super.doDML(operation, e); }
And in your bean you can retrieve the value of the current row.
One of your previous answers, something like:
AttributeBinding attrStudentno = (AttributeBinding) bindings.getControlBinding ("Studentno"); String studentNo = (String) attrStudentno.getInputValue (); Dario
-
jdev 11.1.1.6
I created a defined task with two jspx files browse.jspx and more.jspx flow(task-flow.xml)
Click on the more button in browse.jspx, I'm supposed to be accessed at more.jspx. the code is as follows:
< managed-bean id = "__21" >
< id managed-bean-name = "__23" > TestBean < / managed-bean-name >
< managed-bean-class id = "__22" > com.poc.bean.TestBean < / managed-bean-class >
< managed-bean-scope id = "__20" > session < / managed-bean-scope >
< / managed-bean >
< id = 'Browse' view >
Browse.jspx < page > < / print this page >
< / view >
< id of the view 'Plus' = >
More.jspx < page > < / print this page >
< / view >
< rule of flow control = "__2" id >
<-activity-id id = "__3" > Browse < /-activity-id >
< control-flow-case id = "__4" >
< result id = "__6" > goMore < / de-results >
<-activity-id id = "___5" > more < / to-activity-id >
< / control-flow-case >
< / control-flow-rule >
..
...
Browse.JSPX:
< af:commandButton text = "More" id = "cb4".
action = "#{TestBean.browseAction}" / >
TestBean.java:
public String browseAction() {}
return "Gomoré";
}
Click on the button, I get the exception:
javax.faces.el.EvaluationException: inaccessible identifier, target, "TestBean" resolved to null
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
Please notify
Replace:
action = "#{TestBean.browseAction}" / >
with:
action="#{pageFlowScope.TestBean.browseAction}"/ >
Maybe you are looking for
-
No will can comunicar con el (servidor DNA) main
No will can comunicar con el (primary DNS server) what is you can hacer?
-
problem with the CD/DVD ROM device
Windows nofified it is problem with my CD ROM havin - two of them! I tried Windows troubleshooting. He tried to reinstall the driver but it failed.Then I tried Windows Update to see if I can find an update of the driver but he could not find any upda
-
IBM ThinkPad T42 would not connect to my home network secure wireless
Configuration IP of Windows __An internal error has occurred: a device attached to the system is not functioning. __Please contact support services technical microsoft for more help. Others have had a similar problem, but I tried the solutions that h
-
To remove programs that you rarely use in Vista
How to identify programs that are rarely used in Vista Panel (in XP it was simply described as often/rarely etc...)
-
Unable to see or add Xbox 360 to the list of devices 'Play To' on the Surface of RT
I am not able to see my Xbox in the list of options to play from applications such as the application of video on the Surface RT. On the side of the Xbox, I have ensured that the 'Play To' option is enabled under settings--> system-->--> connected de