Using (HttpServletResponse) externalContext.getResponse() in ADF aplication

Hi,
I have written following code in my ADF aplication, inside bean, in a hope to generate HTML response, but it doesn't ruturn anything: public void pozoviServlet() {
try {
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
PrintWriter pw = response.getWriter();
pw.write("<html>");
pw.write("<h2>Hello World</h2>");
pw.write("</html>");
pw.flush();
pw.close();
FacesContext.getCurrentInstance().responseComplete();
} catch (IOException e) {
FacesContext.getCurrentInstance().addMessage("helloWorldButtonId",new FacesMessage("Error:" + e.getMessage()));
This code is executed on button press. In debuging mode everything pass good without exceptions, but HTML page doesn't render. Any help, thx

I created bean:
public class CallServletClass {
public CallServletClass() {
public void asqServlet() {
try {
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
PrintWriter pw = response.getWriter();
pw.write("<html>");
pw.write("<h2>Hello World</h2>");
pw.write("</html>");
pw.flush();
pw.close();
FacesContext.getCurrentInstance().responseComplete();
} catch (IOException e) {
FacesContext.getCurrentInstance().addMessage("helloWorldButtonId",new FacesMessage("Error:" + e.getMessage()));
And on jsf page I use command button with action #{CallServlet.asqServlet}
Edited by: MarcusO on 2012.10.26 02:51

Similar Messages

  • Use of Prepared Statement in adf

    Hi Experts,
    I am confused with the Use of prepared statement in adf.
    My use case is ,
    I have to update a table from every page in my application under certain conditions.
    My question is ,
    whether I have to create the VO iterator binding in every page and by calling the createinsert and insert the data in to the table or
    use a common method in the Application module impl
    which is using a prepared statement,(which is not even creating the ViewObject ) like
    PreparedStatement st = null;
    String sql = "INSERT INTO hr.departments (DEPARTMENT_ID,    DEPARTMENT_NAME,   MANAGER_ID,   LOCATION_ID) VALUES (seq,?,?,?)";
                st=getDBTransaction().createPreparedStatement(sql,0);
                st.setString(1, name);
                st.setString(2, mgr_id);
                st.setString(3, Loc_id);
                st.execute();
    getDBTransaction().commit();which is the best approach?
    Studio Edition Version 11.1.1.2.0
    Ranjith

    Ranjith,
    Without further understanding the use case, there's not really much difference between the two approaches. In both cases, you'd have a binding in the page definition (either an iterator binding for the VO or a method binding for the AM service method). Both will use bind variables. The main difference I can see is that, depending on how you have configured your AM pooling settings, the VO method will incur fewer parses in the DB because the AM will cache prepared statements for you.
    John

  • Using SAML secured webservice in ADF Application

    I am looking for some tutorial/docs to use SAML secured webservice in ADF application. In my adf application, I am using the webservices using WebProxy and WebServiceDataControls.
    Any pointers in this direction will be helpful.
    Thanks,
    Rajdeep

    Take a look at the following blog posts - which provides some information regarding the SAML security in ADF
    http://biemond.blogspot.com/2009/05/sso-with-saml-adf-security.html
    http://biemond.blogspot.com/2009/05/sso-with-weblogic-103-and-saml.html
    Thanks,
    Navaneeth

  • Using multiple select lists in ADF

    Hi,
    I am trying to use a multiple select list in my JSP page, and have a method in the ApplicationModule be called when the Struts action is called. I am following the example ADF tutorials, where the method is added to the ApplicationModule class, then dragged onto the Stuts Flow diagram (to associate it with an action).
    I am able to create a dyna form bean for the page that contains the multi select as a type "java.lang.String[]" (string array). I am able get that values that were selected in a normal action's "execute" method. For example:
    msf = (DynaActionForm) form;
    String[] statusSelection = (String[]) msf.get("multSelectList");
    However, I cannot seem to get the "multSelectList" values into a method in my Application Module class. The "multSelectList" is defined in my dynaFormBean as a String[] type. I am passing it in as an argument like the following....
    public void setParams(String multSelectList[]) {
    This results in the method not being called at all. I am not sure why. Does this have something to do with a String[] not being serializable??
    However, if I just attempt to pass other types form items to the method, it works. For example:
    public void setParams(String simpleCheckbox) {
    Does anyone know how to use multiple select lists in conjunction with ADF?
    P.S.
    my multSelectList looks something like this:
    <select name="multSelectList" multiple size="5">
    <option value="ALL">Select All</option>
    <option value="preferred">Preferred</option>
    <option value="standard">Standard</option>
    <option value="approved">Approved</option>
    <option value="interim">Interim</option>
    </select>

    I got this working by changing the signature of the Application Module method to use ArrayList rather than String[], then you can marshal the Struts FormBean contents into an ArrayList to pass up.
    To do this, subclass the DataAction by using "Go To Code" off of the context menu and then override the initializeMethodParameters() method:
      protected void initializeMethodParameters(DataActionContext actionContext, JUCtrlActionBinding actionBinding)
        //Get the String Array from the Form Bean
        String[] selection = (String[])((DynaActionForm)actionContext.getActionForm()).get("multiSelect");
        //convert that to an ArrayList
        ArrayList selectionArr = new ArrayList( Arrays.asList(selection));
        //Add that object to the Arg List for the AM method
        ArrayList params = new ArrayList();
        params.add(selectionArr);
        actionBinding.setParams(params);
      }

  • How to use jquery.hotkeys.js in ADF application

    Hello all,
    I am developing an ADF application where i am trying to use jquery.hotkeys.js file. I have created a folder js inside ViewController\Web Content\js and i have added jquery.hotkeys.js file inside that folder.
    Now i have created a jspx page and inside that i have 3 input text and 1 submit button now I am trying to use keyboard shortcuts say ALT+F8 to clear the form fields. Here is my full jspx form
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:inputText label="First Name" id="it1" value="#{MyBean2.firstName}">
    <af:clientListener method="clearAll" type="keyDown"/>
    </af:inputText>
    <af:inputText label="Last Name" id="it2" value="#{MyBean2.lastName}">
    <af:clientListener method="clearAll" type="keyDown"/>
    </af:inputText>
    <af:inputText label="EmailID" id="it3" value="#{MyBean2.emailId}">
    <af:clientListener method="clearAll" type="keyDown"/>
    </af:inputText>
    <af:commandButton text="Submit" id="cb1"
    action="#{MyBean2.callSubmit}"
    binding="#{MyBean2.cb1}">
    <af:clientListener method="clearAll" type="keyDown"/>
    </af:commandButton>
    </af:form>
    <f:facet name="metaContainer">
    <af:resource type="javascript" source="/js/jquery.hotkeys.js"/>
    <af:resource type="javascript">
    function clearAll() {
    $("*").bind('keydown', 'Alt+F8', function (evt) {
    clearForm();
    evt.stopPropagation();
    return false;
    function clearForm() {
    alert('3');
    curElm = document.activeElement;
    var frm = $(curElm).closest('form');
    var frmname = ($(frm).attr('name'));
    document.forms[frmname].reset();
    document.getElementById('frmname::content').reset();
    document.getElementById('f1::content').reset();
    $("input:visible:enabled:first").focus();
    </af:resource>
    </f:facet>
    </af:document>
    </f:view>
    </jsp:root>
    But that is not working. Can anyone help?
    Thanks

    My requirement is the form should get cleared on pressing ALT + F8.
    Here is my updated jspx page:-
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:inputText label="First Name" id="it1" value="#{MyBean2.firstName}">
    </af:inputText>
    <af:inputText label="Last Name" id="it2" value="#{MyBean2.lastName}">
    </af:inputText>
    <af:inputText label="EmailID" id="it3" value="#{MyBean2.emailId}">
    <af:clientListener method="clearAll" type="keyDown"/>
    </af:inputText>
    <af:commandButton text="Submit" id="cb1"
    action="#{MyBean2.callSubmit}"
    binding="#{MyBean2.cb1}">
    <af:clientListener method="clearAll" type="keyDown"/>
    </af:commandButton>
    </af:form>
    <f:facet name="metaContainer">
    <af:resource type="javascript" source="/js/jquery.hotkeys.js"/>
    <af:resource type="javascript" source="/js/jquery-1.4.4.min.js"/>
    <af:resource type="javascript">
    function clearAll() {
    jQuery('*').bind('keydown', 'Alt+F8', function (evt) {
    clearForm();
    evt.stopPropagation();
    return false;
    function clearForm() {
    curElm = document.activeElement;
    var frm = $(curElm).closest('form');
    var frmname = ($(frm).attr('name'));
    alert(frmname);
    document.forms[frmname].reset();
    $("input:visible:enabled:first").focus();
    </af:resource>
    </f:facet>
    </af:document>
    </f:view>
    </jsp:root>
    But still I am not able to get the desired functionality. Am i missing something here?
    Thanks

  • How to use ActionForm validate() method in ADF/Struts project

    Hi
    We are developing a project using ADF/Struts. We are not planning to use entity level validation. Rather we prefer to have it at Struts Form Bean level. So we need to have validate() method in Form Bean.
    That mean we need to have seperate bean for all the actions /jsp. The ADF's DataForm form bean is not gonna work for us. Is that correct.
    Please let me know...am I in the right direction.
    That could be a different discussion why we don't prefer entity level validation

    You can use the Struts validator plug-in (there's a howto on doing that on OTN) and it will handle the basics for you through XML definitions.
    If you want to specifically have a Form bean with a Validate() then the issue is that the current "DataForm" is a generic bean driven of the databinding files, so yes you'd have to write a bean per screen to use instead and loose that benefit of having a universal Bean. (Internally the DataPage and DataActions will respect the ActionForm APIs so you can pluf your own ActionForm subclass in with no problem.
    Plan B might be to leave the DataForm Bean in place and instead override the lifecycle of the datapage, probably in prepareModelUpdates()

  • How to use sum analytic function in adf

    Hi
    jdev 11.1.1.5
    oracle 11g r2
    I want to use analytic function (sum,count,avg and ...) .
    I see [url http://andrejusb.blogspot.co.uk/2013/02/oracle-analytic-functions-for-total-and.html]Oracle Analytic Functions for Total and Average Calculation in ADF BC
    and use it in my vo and jsf page,my vo have too much record and I want to have sum in table footer on demand (because of performance) and if user do not want to see the sum in footer of table it do not calculate sum,
    what is your idea?

    Before I read that blog I use another vo for sum but after that blog decide to use analytic fuction becuase we have some page that have to many dvt graph and table and know we use seperate vo for them and it has not good performance and too many query must run in database ,I want to have 1 vo with some analytic function for graph and tables

  • Using UCM data controls in ADF application

    Using *.6 Jdeveloper/UCM/Protal Application/UCM
    Calling all the experts in Webcenter/Spaces/UCM/ADF.
    We have a requirement to design search inteface for Documents stored in UCM for Webcenter Portal and Spaces application.
    Our approach is
    Design simple ADF application (no security/templates)
    Bounded task flows using fragments.
    Framents to use UCM data controls (provided by oracle)
    UCM data control definition is extended to use custom metadata.
    package the application.
    Added as ADF library jar to portal application
    Added as Shared Library to Spaces application.
    Question.
    Is this approach sound?
    Does UCM data controls provide all the functionality, for example if we want to read a option list for custom metadata or need custom metadata in return table?
    Can we add other methods to UCM data control provided by Oracle or should we create different one?
    Is there good documentation for such requirements. We have acces Webcenter developers guide which throws some light on UCM data controls.
    Let me know if more clarity is needed...
    Regards

    Hi.
    One of my last components was a custom "Document Explorer" and I used for first time JCR Data Control (Custom UCM Data Control provided by Oracle).
    Sharing my experience I did something similar to you:
    1) Create a ADF Bounded Task Flow and test it individually.
    2) Add generated ADF JAR Library to WebCenter Spaces shared-lib.
    3) Add your Task Flow to Resource Catalog.
    Challenges that I found using custom Data Control:
    1) When items retrieved are content/files all custom metadata can be retrieved OOTB.
    2) When retrieving folders don't provide custom metadata like files. I used RIDC with JCR Data Control to provide all the information relative to folders. If you don't need more information about folders than the name, URI and icons then is OK :).
    3) Using JCR Data Control registers in DataControls.dcx UCM Connection name used when generate JCR Data Control. After deploy your ADF JAR Library in WebCenter Spaces you'll have problems if you don't have a WebCenter Content Connection created with the same name. (Not talking about export UCM Connection with ADF JAR Library, Data Control uses a Connection name by itself :)).
    I added extra functionallity with RIDC (not extending JCR Data Control).
    I hope this help you.
    Regards.

  • How TO use configurable Database connection with ADF BC

    I have developed a simple JSF/ ADF BC web application that connects to a database and read/display data from the db tables. I have successfully deployed the application to Tomcat 5.5.17. However, now i need to change the database the application is connecting to. My question is How can I change the Database connection without having to change the application modules or rebuild the war file ??? In other words, is there a specific file (xml) where the database connection can be changed?

    If you set up the application with a data source (I am not sure if this is possible using another app server, I use OC4J), then you would just change it there. However if you created a database connection in the JDEV and pointed your data model to that, then you will have to change and rebuild.
    You might be able to edit the xml file that contains the setttings, I am not sure my CM guys dont allow this, all of our changes have to go through our code repository.

  • Can I use the dbms_application_info package with ADF BC?

    Hi,
    I am executing a PL/SQL package from my ADF BC Application module and need to set some audit information within the PL/SQL. The package does some intensive background processing that would be time consuming to do in ADF. Can I use the dbms_application_info pakage to store session information for the user?
    I am not sure if the application module has a true database session with the database or is it pooled/shared with other users that may be logged on to the application?
    I want to use dbms_application_info.set_client_info and dbms_application_info.read_client_info.
    thanks,
    Brenden

    >
    If I created the new user what are the privileges shoud I grant him.You should grant EXPORT FULL DATABASE for exporting and IMPORT FULL DATABASE for importing.
    >
    I created one user testdba and granted DBA privileges as well full_export_database.
    after that I run catexp.sql with sys credential.
    While running the schema level export using testdba I am getting the below error:
    My Export scripts is
    exp testdba/password FILE=ALLEDW_edw2.dmp log=ALLEDW_edw2.log owner=ALLEDW grants=y indexes=y direct=y compress=y
    EXP-00008: ORACLE error 4068 encountered
    ORA-04068: existing state of packages has been discarded
    ORA-04063: view "TESTDBA.V_$OPTION" has errors
    ORA-06512: at "SYS.DBMS_AW", line 151
    ORA-06512: at "SYS.DBMS_AW_EXP", line 225
    ORA-06512: at line 1
    EXP-00083: The previous problem occurred when calling SYS.DBMS_AW_EXP.schema_inf
    o_exp
    EXP-00008: ORACLE error 980 encountered
    ORA-00980: synonym translation is no longer valid
    ORA-06512: at "SYS.DBMS_RULE_EXP_RULES", line 133
    ORA-06512: at line 1
    EXP-00083: The previous problem occurred when calling SYS.DBMS_RULE_EXP_RULES.sc
    hema_info_exp
    . exporting foreign function library names for user ALLEDW
    . exporting PUBLIC type synonymsDo You have any invalid objects in database?
    recompile them with $OARCLE_HOME/rdbms/admin/utlrp.sql

  • How to close a popup using a function key in adf + Jquery

    Hello All,
    I want to display some error message using function key so I have used javascript function
    *function showText(event) {*
    var k = event.getKeyCode();
    *if (k == 115) {*
    ------------------------------------------CODE-------------------------------------------
    This is working fine on click of F4 it is invoking a popup and inside that popup in dialog it is showing some error messages. The property modal of dialog is true. So that user should not be able to navigate to main form until error message is closed.
    Now on click of F6 I want that error message to be closed. When I added af:clientListener on popup or dialog type="keyDown" is not available.
    So I thought using jquery for this. I have created a form.js file inside that I have written:
    *$(function first()*
    *               jQuery('*').bind('keydown', 'F6', function (evt){closePopup();evt.stopPropagation();return false;});*
    *function closePopup(){*
    *     alert("Do you want to close the error message");*
    I have also added jquery.hotkeys.js and jquery-latest.js file.
    My question here is How can i find that popup or dialog inside that jquery function and close it?
    On click of F6 I am getting that alert Do you want to close the error message but after that how can I find the popup or dialog and close it?
    I am new to jquery still I tried using some code:
    var dialog = event.getSource();
    var popup = dialog.findComponent("p1");
    popup.close();
    and
    var output1 = AdfUIComponent.findComponent("p1");
    output1.close();
    and
    curElm = document.activeElement;
    var frm = curElm.close();
    But none of them worked.
    Please help
    Thanks

    Hi,
    this whitepaper: http://www.oracle.com/technetwork/developer-tools/jdev/1-2011-javascript-302460.pdf has an example of registering keyboard keys on a global level (see page 36). So you would define a key to close dialogs in general. The paper also explains how to search and find components. Note that you should always work with the ADF Faces client side API and never against the generated markup or DOM (which in fact your code does)
    Frank

  • Use dvt map component into adf mobile

    Hello,
    I'm just wondering if it's possible to use the dvt map component into an adf mobile application or if there's another way to display a map coming from mapviewer.
    Does anybody know it there are any limitations?
    Thanks and regards

    Currently DVT Map component is not supported for ADF Mobile. Alternatively you could look at embedding Google Maps or just invoke Google Maps from your app. On iOS and Android, if you create a link with something like ("http://maps.google.com/maps?q=<Text or EL Expression containing the value of the address you want to search>"), then native Google Maps application would be launched to display that address. You can also embed a Google Map in your page as an image as well - check Google Map's site for details of how to issue an URL that could return an image containing Google Maps and search results.
    Thanks,
    Joe Huang

  • Using more than 1mb size java aplication on my nok...

    i want to use 1.2MB size java aplication on my nokia 6300 phone.but my phone support only softwares smaller than 1 MB.so how i use this aplication on my phone?
    If i update my nokia 6300 phone software,will it solve this problem?

    No.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • Using select one choice in ADF...Interesting!!!!!!!!!!

    Hi All,
    I am developing web page using ADF frame work and using a component <af:selectOneChoice> and using its inline style inlineStyle="width:400px;".
    this keeps the sizeof combo fixed for 25 characters, inorder to maintain the cosmatics of the page.
    Now when combo has values having 100 character only 25 characters are visible making it difficult for end user to select the appropriate choice. so is there any way that on mouse over we get a tooltip stating the complete statement . in few of the web pages i have seen such option.
    Any idea how to implement it for ADF core component?
    Or if any one has some innovative idea please let me know

    Hi,
    the shortDesc property defines the tooltip. So you could use EL to have the tooltip getting populated with the current selection using PPR
    Frank

  • Is it possible to use AJAX for onblur method -- ADF

    Is it possible to execute a javascript action method for (onblur,onclick etc.,) using AJAX?
    For example according to the selection made in a list box, some fields are hidden or rendered. This is done with out any javascript code written in ADF using AJAX.
    Like wise for onblur etc., can we use AJAX?
    I want to save the record when I tab out from the last field of the record.
    Please let me know how I can do this.
    Thanks,
    venki

    Hi,
    I think the easiest way out of this is to use a commit button on the page, give it an ID and then look it up using document.getElementById("form:Id");. submit this handle (note that buttons are rendered as links). This doesn't require an Ajax call
    Frank

Maybe you are looking for

  • IPhone 3GS  blocked and disabled

    Hi everyone I got an iPhone 3GS but it's blocked and disabled, I don't know why it's blocked I just bought it like that because it was cheap, anyway I forgotten my password and now it's disabled, I can I get it working without losing any of my photo,

  • PSE 10 organizer not starting - never worked

    Hi, I have installed PSE 10.0 on my PC running Windows 7 Pro SP1.  I can happily edit images in PSE, but I cannot start the Organizer.  When I start PSE the initial screen is displayed giving me options Orgainize and Edit, when I click on Organize th

  • Cannot import LDAP group through Import Wizard.

    Hello, We have a issue where we are unable to import Ldap group if we use cluster name while logging into Import Wizard. we are able to import the LDAP users/groups if we use the primary CMS name while logging into Import Wizard Is this a known issue

  • VF01 and VF02

    Hi all, I have defined same output type for VF01 and VF02 and with same parameters. My user settings are set to my default printer PRINT. However when i do an issue output to, it picks up PRINT when done thru vf02 but picks up LOCL when done thru vf0

  • Does BPIM configuration require any licensing ?

    Dear All, We are involving system study of Business process interface monitoring (BPIM) in our landscape and BPA also,Our Interfaces are from systems ECC, PI, even some of the Legacy etc. In this kind of setup of BPIM, does any licensing is involved?