Flipkart Search

Saturday, 20 April 2013

logout in oracle ADF / expiring session in ADF

One of the way of logging out user is ::

public String logout() throws IOException {
    ExternalContext ectx=FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse resp = (HttpServletResponse)ectx.getResponse();
HttpSession sess = (HttpSession)ectx.getSession(false);
sess.invalidate();
  resp.sendRedirect("login.jspx");
return null;
}

Sunday, 3 March 2013

get user's details / Browser's details in Oracle ADF

        RequestContext rCtx = RequestContext.getCurrentInstance();
        FacesContext fctx=FacesContext.getCurrentInstance();
        Agent agnt = rCtx.getAgent();
  1.         //Get user's Browser's engine name
        String browser = agnt.getAgentName();

     2.   //Get user's Browser's engine version
        String browser_version = agnt.getAgentVersion();

    3. //Get user's IP address
        String userIpAddress =                      ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRemoteAddr();
     4.   //Get user's Platform
        String platform = agnt.getPlatformName();
      
      5. //Get user's Platform's version
        String platformVersion = agnt.getPlatformVersion();
        Map reqHeader=
FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap();
     6. // Get the User agent
 System.out.println(reqHeader.get("User-Agent"));

Sunday, 25 November 2012

Static list in ADF the other way

The manage bean property of ADF can also provide the static list without a actual managed Bean{Interesting ??}. Let's do with an Example.
Inside your adfc-config.xml or your page-flow.xml register this list as below

  <managed-bean id="__3">
        <managed-bean-name>StaticBean</managed-bean-name>
        <managed-bean-class>java.util.HashMap</managed-bean-class>
        <managed-bean-scope>application</managed-bean-scope>
        <map-entries>
            <map-entry>
                <key>rahulkaitian</key>
                <value>http://rahulkaitian.blogspot.in</value>
            </map-entry>
            <map-entry>
                <key>rahulkumar07</key>
                <value>http://rahulkumar07.blogspot.in</value>
            </map-entry>
        </map-entries>
    </managed-bean>







and access the pair  in EL as #{StaticBean['rahulkaitian']}

Sunday, 11 November 2012

Get and set task-flow input parameter value in managed bean

1. Method to get the value of TaskFlow inputParameter value 
public static Object getPageFlowParamVal(String tf_paramName){
  ADFContext adfContext = ADFContext.getCurrent();
  return adfContext.getPageFlowScope().get(tf_paramName);
  }
2.  Method to set the value of TaskFlow inputParameter value 
public static void putPageFlowVarVal(String pageFlowScopeVarName,
 Object pageFlowScopeVarVal) {
     ADFContext adfContext = ADFContext.getCurrent();
     adfContext.getPageFlowScope().put(pageFlowScopeVarName,pageFlowScopeVarVal);
  }

Sunday, 28 October 2012

Refresh a Web Service Data Control without Deletion

read..
http://docs.oracle.com/cd/E21043_01/web.1111/b31974/web_services.htm

Read

13.3.4 How to Refresh a Web Service Data Control



Using Resource Bundle in adf managed bean

After configuring  ResourceBundle in faces-config.xml {Should be in working condition}, you can access (key,value) in manage bean as

ResourceBundle res = ResourceBundle.getBundle("Resource_base_name");
String value1=res.getString(" key1");