How to access Application.Resources resource by it's name?

<x:Array x:Name="NBresource" x:Key="nb" Type="{x:Type System:String}">
<System:String>10</System:String>
<System:String>15</System:String>
<System:String>20</System:String>
</x:Array>
In my application.Resources I have got an Array. In the code behind MainWindow I am trying to access this array but I don't find any way in doing so using it's name only? 
If I would have defined the resources in the MainWindow.xaml, I could easily access it using it's name only. 

>>The Resources property of both the Application class and the Window class is of type ResourceDictionary and ResourceDictionary
is a class that implements the IDictionary interface. This interface includes an [] operator that lets you access an element by its key and
nothing else.
If I would define it like this:
<Window.Resources>
<x:Array x:Name="NBresource" x:Key="nb" Type="{x:Type sys:String}">
<sys:String>10</sys:String>
<sys:String>15</sys:String>
<sys:String>20</sys:String>
</x:Array>
</Window.Resources>
Then it would have been possible to get the values like this:
PipeSizeNTD_comb.ItemsSource = NBresource.Items;
I was using it with its name, but now I want to move it from Window.Resources to Application.Resources so that it would be available to
the whole application and it's not possible to use its name. 

Similar Messages

  • How to access another resource in Groupwise

    Could anyone tell me or direct me to a sample of some code, that shows how to access another resource in Groupwise with VB.
    The main goal is to send a appointmentsfrom another resource by accessing this resource that you have authority from own mailaccount
    or from an account I have access to.
    This so far I have come:
    Dim objApp
    Dim objAccount As Account
    Dim objDraftMsg
    objApp = CreateObject("NovellGroupWareSession")
    ' objAccount = objAccount.ObjType.egwResource
    objAccount = objApp.Login("", "") 'My own account but want to access either the account that owns the resource or from my own
    ' objAccount = objApp.objtype.egwresource("Schema")
    objDraftMsg = objAccount.WorkFolder.Messages.Add("GW.MESSAGE.APP OINTMENT")
    Dim date1 As New Date(2013, 5, 2, 8, 30, 0)
    objDraftMsg.StartDate = date1
    objDraftMsg.Duration = 1.5 / 24 ' duration
    objDraftMsg.OnCalendar = True
    objDraftMsg.Subject.PlainText = "Testar schema" ' Subject
    objDraftMsg.BodyText.PlainText = "Hlsar Giggi" ' Body
    objDraftMsg.Recipients.Add("XX")
    objDraftMsg.Send()
    Thank you un advance
    Giggi

    On 4/30/2013 1:26 PM, giggi wrote:
    >
    > Could anyone tell me or direct me to a sample of some code, that shows
    > how to access another resource in Groupwise with VB.
    >
    > The main goal is to send a appointmentsfrom another resource by
    > accessing this resource that you have authority from own mailaccount
    >
    I don't have time to write code but as I recall you have to PROXY into
    the account. There's a proxy method IIRC that returns an Account from
    which you can send mail if you were granted rights to do so.

  • HT1491 How to access applications in AppStores other than that of my home country, as the apps i need are not available in home appstore

    How to access applications in AppStores other than that of my home country, as the apps i need are not available in home AppStore??!?

    What you want is Not possible...
    You must be within the Country with a Valid Billing Address and Credit Card for that Country to use the iTunes Store of that Country...

  • How to access android resource in java native extension....??

    hi..
    i want access android resource..
    for example, res/menu/menu.xml, res/values/strings.xml ... etc...
    - R.java -
    /* AUTO-GENERATED FILE.  DO NOT MODIFY.
    * This class was automatically generated by the
    * aapt tool from the resource data it found.  It
    * should not be modified by hand.
    package com.flash.extension.nativelib;
    public final class R {
        public static final class attr {
        public static final class drawable {
            public static final int icon=0x7f020000;
            public static final int notification_icon=0x7f020001;
        public static final class layout {
            public static final int main=0x7f030000;
        public static final class string {
            public static final int extension_app_name=0x7f040001;    -> "hi extension"
            public static final int extension_hello=0x7f040000;
    so i used getResourceId("string.extension_app_name");
    but it's not work.. throw NotFoundException error..
    so i used context.getString(R.string.extension_app_name);
    it's work, but return incorrect value.. -> return value is "0.0.0".. it's versionName in actionScript Client Project..
    why can't access android resource in native extension?
    how to get android resource in java natvie extension..??
    Is there anyone who has a sample source??
    help.. me.. please..

    Hello,
    I am facing the same issue with the native extension i am using follwing code to get the resource id
             Intent inte = new Intent(context.getActivity().getApplicationContext(),SecondActivity.class);
              inte.putExtra("layout",context.getResourceId("layout.secondactivity"));
              context.getActivity().startActivity(inte);
    i am getting this exception "android.content.res.Resources$NotFoundException:layout.secondactivity"
    I have included activity in the native manifest file as well as flex's manifest file for android.
    please help me with this or an example will be great thanks.

  • How to access applications in another computer

    how to make use of java programs to access applications or files in another computer across the same network or over the internet. can help???

    how to make use of java programs to access
    applications or files in another computer across the
    same network or over the internet. can help???Overly broad question. Next!
    No seriously; what do you want ? Do you want to execute something (a process); do you want to execute it here, or there ? Do you want to connect to some service to do it for you ? Do you want the service to be distributed ? Do you want the service to maintain state ? Do you want to do it transparently inside your code, or do you want to explicitly implement a client API ?
    Your choices range from:
    - nfs or smb (execute here, executable there)
    - rsh or ssh (execute there, if the remote part is UNIX)
    - cgi over http (very common, but stateless)
    - CORBA or rmi (transparent remote OO calling)
    Read up on all these, and provide yourself with answers !

  • How to access application server 10g, if client machine is proxy settings.

    hi,
    i have installed oracle application server 10gR2, on vertual machine, windows2003
    my forms are stored in forms folder , i can access the application/forms
    throuhg client machines, if proxy setting is unchecked, but if proxy is chacked can't access application.
    as there with the user machine is required with proxy setting. how
    to access the application. i mean what is the configuration.
    in application server so that any computer (client machine)
    can access weather it is having proxy setting or not.

    now i enabled the java console to see the trace, there i found. if proxy is checked in client brouser with 8080 port which is required by organisation.
    Oracle JInitiator: Version 1.3.1.22
    Using JRE version 1.3.1.22-internal Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\fresh
    Proxy Configuration: Manual Configuration
    Proxy: eproxy:8080
    Proxy Overrides:
    Jar cache disabled by user
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: hide console
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class oracle.forms.engine.Main not found.
    java.lang.ClassNotFoundException: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Where as if there if i remove proxy setting by uncheck. then application goes smoothly.

  • How to access JDBC Resource registered in Sun Java System App Server ?

    I want to create a stand-alone JDBC application with Java SE using Swing technologies and JNDI technology. The purpose of using JNDI technology is to avoid change of Java Source Code every time I move the database to different location. This Java application will be used in a standalone PC installed with Windows XP Professional with no LAN / WAN connection. Of course, Internet connection is available with the PC.
    I use JavaDB to store the data tables and the location of the database is D:\E-DRIVE\SAPDEV. Tomorrow, if I move this database to C:\SAPDEV or any network drive, I do not want to change the Java Source code. I want to use JNDI which, if I am not wrong, helps developers to avoid manual change of Java source code whenever the database location is changed. Changes have to be made only in the JNDI Name which contains all relevant information about the database in order to get connection no matter where the database SAPDEV is stored; it can be placed under D:\E-DRIVE directory or C:\ directory of the hard disk. To implement my intention, I started developing Java application as per the steps mentioned below:
    Step 1:
    To proceed, first, I sought the help of Sun Java System Application Server Admin Console. I created JNDI object for Connection Pool using the menu path Common Tasks->Resources->JDBC->Connection Pools.
    JNDI Name : ABAPRPY
    Resource Type : javax.sql.DataSource
    Datasource class : org.apache.derby.jdbc.ClientDataSource
    Description : ABAP Program Repository
    The Connection Pool creation has options for General, Advanced and Additional Settings tabs and I made all the settings relevant to the database I created in D:\E-DRIVE\SAPDEV.
    To confirm whether the above settings are correct, I pressed the Ping push button which is available in the General tab of the connection pool creation screen. The system responded with the message Ping Succeeded.
    Step 2:
    I created a JDBC Resource using the menu path Common Tasks->Resources->JDBC->JDBC Resources.
    JNDI Name : jdbc/SAPDEV
    Pool Name : ABAPRPY
    Description : Database Connection for SAPDEV database
    Status : Enabled
    I can see all the above settings recorded in the domain.xml which is placed in the folder
    C:\Sun\AppServer\domains\domain1\config
    Step 3:
    I have made sure that Sun Java System Application Server is up and running in the background with JavaDB server. I created a Java Program making sure the following JAR files are included in the classpath:
    appserv-admin.jar
    appserv-ee.jar
    appserv-rt.jar
    javaee.jar
    fscontext.jar
    Plus, the lib directory of JDK 1.6 & C:\Sun\AppServer\domains\domain1\config
    Source code of the program is as follows: I used NetBeans IDE to create my project file.
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.naming.*;
    import javax.activation.DataSource;
    public class JNDILookup {
    public static void main(String[] args) {
    try {
    InitialContext initCtx = new InitialContext();
    DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/sapdev>");
    } catch (NamingException ex) {
    Logger.getLogger(JNDILookup.class.getName()).log(Level.SEVERE, null, ex);
    When I attempted to compile the above program in NetBeans IDE ,no compilation error reported. But while executing the program, I got the following run-time error message:
    SEVERE: null
    javax.naming.NameNotFoundException: No object bound for java:comp/env/jdbc/sapdev> [Root exception is java.lang.NullPointerException]
    at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:224)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at SAPConnect.JNDILookup.main(JNDILookup.java:21)
    Caused by: java.lang.NullPointerException
    at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
    ... 3 more
    Now, I want to come out of this situation; at the same time, I want to preserve the settings I have made in the Sun Java System Application Server Admin Console. That is, I want to programmatically access the data source using Connection Pool created in Sun Java System Application Server Admin Console.
    I request dear forum members to provide me an appropriate solution.
    Thanks and regards,
    K. Rangarajan.

    jay44 wrote:
    Bare in mind I am attempting the context.lookup() from inside the container (my code is in a session bean). I have accessed the server and have my bean "say hello" first to verify the bean works OK, then I call a method with this rather standard code:
    String jndiDataSourceName ="Second_EJB_Module_DataBase";
    Logger.getLogger(DynamicPU.class.getName()).log(Level.INFO,"Programatically acquiring JNDI DataDource: "+ jndiDataSourceName);
    InitialContext ctx;
    try {
    ctx = new InitialContext();
    ds =(DataSource)ctx.lookup("java:comp/env/jdbc/"+jndiDataSourceName);
    } catch (NamingException ex) {
    Logger.getLogger(DynamicPU.class.getName()).log(Level.SEVERE, null, ex);
    return "Exception generated trying to preform JDBC DataSource lookup. \n"+ex.toString();
    But when I run the code the server log shows the initial context is created Ok, but an exception is thrown becasue the resource name is not found:
    (and i have tried vriations of ctx.lookup("jdbc/"+jndiDataSourceName) etc etc
    You are fine here. It works in container because the InitialContext properties have been supplied already. That was the link I forwarded earlier. The InitialContext you create locally needs to locate the container JNDI. That is what the properties specify.
    Where I am confused is where you indicate the stack below is from the server log. So, you initiate a standalone (java main method) application, create an InitialContext, and you see the results in your app server log?
    LDR5010: All ejb(s) of [EJB_Module_1] loaded successfully!
    Programatically acquiring JNDI DataDource: Second_EJB_Module_DataBase
    The log message is null.
    javax.naming.NameNotFoundException: Second_EJB_Module_DataBase not found
    at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
    at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
    at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:192)...
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
    This is strange since I can see this resource (a JDBC connection named Second_EJB_Module_DataBase) is configured on the server from the server's admin console.
    That is why you can obtain a lookup from within the container (app server).
    For this lookup to work it may be that one must map the name inside an ejb-jar.xml deployed with the application, but I have also read some resources like jdbc connection should have a default name. Does anyone know if my lookup() should work without using an ejb-jar.xml mfile to explcitly map the reource for my application?
    Both EBJ's and data sources can be referenced via JNDI. It's a remote lookup (that is normally optimized if it is running in the same JVM). You should not have any dependencies on a JDBC data source being set-up on ejb-jar.xml. That file can of course impact your EJB's. However, data sources are normally set-up on a container-specific basis (e.g., you probably did it through a console, but there is a spec somewhere about how to set up a data source via a resource the app server looks for; it varies from app server to app server). However, once you have that container-specific data source set-up, JNDI operates vendor-neutral. You should be able to take the code above and move it to JBoss or Weblogic or Tomcat or whatever (this is an ideal, in practice, the vendors sometimes put a data source in a name you would not expect, but again, you can use their JMX console to see what the JNDI name is).
    (As I stated above if I have to use a deployment discriptor to get at this JNDI datasource, then solution is not "programmatic" as newly configured datasources could not be accessed without redeploying the entire application).
    As JSchell alluded to, you will always have at least something vendor-specific. JNDI itself (the code you wrote) is totally portable. However, you have to set the various JNDI environment properties to a given vendor's spec. Ideally, you should not need a vendor's actual InitialContext application, but it's a possibility. Once you can safely cast to Context, you should be vendor-neutral (if not, demand your money back).
    So that is exactly where I am stuck, trying to get the lookup to work and wondering if it should work without and xml file mapping the resource for my app.
    What we ended up doing for standalone was to provide our own JNDI. If you look at the open source project JOTM, there are examples on how to use that with XBean (if integrating with Spring, as we did), you can easily set up a data source that runs standalone exactly as you get in the container. Another benefit is you get full JTA/JTS support and the ability to run XA transactions. (This might all be alphabet soup, but the app server gives it to you, and this is the way we ended up doing the same: JNDI + JTA + JTS + XA). It ends up the same application code uses a "vanilla" InitialContext and all we have to do is write one or two xml files (one for our app server, a couple for JOTM), and our actual code works the same.
    I still think you have a shot at getting to the container's JNDI, just not using their full-blown app server JAR.
    I think there must be a simple way to do this with an ejb-jar.xml, I am no expert in JNDI, I could be missing something simple, I will keep at it and post an answer here if I come up with it.
    Thanks, jayIt is simple to code. Getting it to integrate with your app server, yes, that can be challenging. But it has nothing to do with EJB's. Write a simple test. Using nothing but DataSource and InitialContext. Let us know where you get stuck.
    - Saish

  • How to access static resources in ear without specifing context-root

    Hello, i have a problem with my ear.
    The war's structure is like this:
    ---/jsp
    ---/css
    ---/images/ViewRisposte.gif
    ---/xsl/Request.xsl
    ---/Common/data.xsl
    /error.xsl
    /input.xsl
    xsl files reference css and images files that are contained in css and images dir.
    I can't use the "../" to specify css and images path into xsl and jsp due to security policy setting on the Http server (and I can't change this policy).
    In the ear's application.xml is specified the context root of the module web with the name SABEARWeb
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <application>
    <display-name>SABEARWeb module</display-name>
    <module>
    <web>
              <web-uri>SABEARWeb.war</web-uri>
              <context-root>SABEARWeb</context-root>
         </web>
    </module>
    </application>
    For example with this following code (Request.xsl), how can i replace the "../" notation to access xsl and image resouces without write the context root? How i can insert the images and css references into xsl and jsp files?
    <xsl:import href="../Common/data.xsl" />
    <img align="center" width="20" src="../images/ViewRisposte.gif" id="viewXslRisp" title="Visualizza Risposta">...</img>
    Thanks a lot

    >>As I understand I should change View1 by handling command of button “Edit”, and then View 2 should be displayed, then I change data and then View1 should be updated. How to do it?
    For information about how to handle a command, please refer to my blog post:
    http://blog.magnusmontin.net/2013/06/30/handling-events-in-an-mvvm-wpf-application/
    You could bind the Command property of the edit button to an ICommand property of VMMain. When this command is executed you could then send a message using an event aggregator or some kind of messenger. Please refer to my blog post for more information about
    how to for example use Prism's event aggregator class to pass events between view model classes:
    http://blog.magnusmontin.net/2014/02/28/using-the-event-aggregator-pattern-to-communicate-between-view-models/
    Andy has written an example of how to use MvvmLight's Messenger class:
    http://social.technet.microsoft.com/wiki/contents/articles/26070.communicating-between-classes.aspx
    The concepts are the same but you will have to download and reference either Prism:
    https://www.nuget.org/packages/Prism/
    ...or MvvmLight: https://www.nuget.org/packages/MvvmLight/
    You then subcribe to this event or message in the main view model and change the value of the CurrentPageViewModel property whenever you recieve an event. Note that the class must implement the INotifyPropertyChanged interface and raise its PropertyChanged
    interface for this to work:
    https://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
    This is how you are supposed to communicate between different view model classes.
    Hope that helps.
    Please remember to close your threads by marking helpful as answer and then start a new thread if you have a new question.

  • How to access application server path in sap

    Hi All,
      Could you please help me how we can navigate application serverpath; for example in my job the file is placing at this directory /usr/sap/interfaces/WAP/100/MM/OUT/SOFTCONQAG/ARCHIVE in application server, How can I go to that path to check weather file is avilable or not.
    Regards,
    Muralikrishna.

    Hi,
    U can access through AL11 transaction. But please note that not all will be having the access to perform this.
    Thanks & regards,
    Prakash Ghantasala

  • How to access application vars into JavaBeans or Java File?

    I have the application directory strcuture like this. I am using Apache Tomcat/6.0.14 and Eclipse IDE.
    -/MyFirstServlet
    -/MyFirstServlet/WebContent
    -/MyFirstServlet/WebContent/WEB-INF/web.xml
    -/MyFirstServlet/WebContent/web.jsp
    -/MyFirstServlet/Src
         - com.model.DAO/userDAO.java (java class within package)
    I have put following code into "web.xml".
    ==================================
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
         <display-name>
         MyFirstServlet
         </display-name>
         <context-param>
              <param-name>DBDriver</param-name>
              <param-value>com.microsoft.sqlserver.jdbc.SQLServerDriver</param-value>
         </context-param>
         <context-param>
              <param-name>connectionUrl</param-name>
    <param-value>jdbc:sqlserver://localhost:1433;databaseName=MyFirstServletDB;user=hitesh;password=hit
    esh;</param-value>
         </context-param>
         <welcome-file-list>
              <welcome-file>index.html</welcome-file>
              <welcome-file>index.htm</welcome-file>
              <welcome-file>index.jsp</welcome-file>          
              <welcome-file>default.jsp</welcome-file>
         </welcome-file-list>
    </web-app>
    I am easily able to access from "web.jsp"
    ===================================
    String DBDriver = application.getInitParameter("DBDriver");
    out.println("<br>DBDriver:==="+DBDriver);
    String connectionUrl = application.getInitParameter("connectionUrl");
    out.println("<br>connectionUrl:==="+connectionUrl);
    BUT when I try to access withing userDAO.java it gives "application is not resolved"
    ========================================================================
    String DBDriver = (String)application.getInitParameter("DBDriver");
    NOTE: I understand I need to import some inbuilt java package which will allow to use applcation vars
    within java class.
    What is that package? and how to do that?
    Is there any other easy method to use global/application vars which can be used in all
    JSP/JavaBeans/Java files?
    Thanks in advance.

    It might be easier to put that code somewhere else. JSP's are for presentation, not for accessing databases, business logic, etc.

  • How to access application module from ActionForm Execute?

    I've got a very simple ADF/UIX/Struts application where I'm trying to create a simple Login function. I have a /loginAction data action pointing to a login.uix page forward. The login.uix page has a <struts:form> on it with a user and a password field. There is a LoginBean with the corresponding get/set values. I have an ADF model created with a boolean login(String username, String password) function exposed as a client method.
    Eventually, when I have this basic part working, then I'll actually be using an ActionForward mapping to dispatch to different home pages, based on the particular login account (the name of the forward will be stored in the authentication table).
    I've tried overriding Execute(), since that is where you can return the appropriate ActionForward mapping, but that does not have a DataActionContext passed in -- so I can't get to the application module.
    I've also looked at processComponentEvents, but that doesn't have any ActionForward results nor a way to pass back ActionErrors (in case the login fails).
    How do I call my login client method when a user has entered a username/password and pressed the Submit button?

    Here is another solution as provided by Oracle Support in response to a TAR that I opened:
    I had described my need to access a login() function defined in my Application Module, returning true/false if the login succeeds/fails. Here is the reply, posted with permission:
    I have gotten the following information back from one of the development folks pertaining to the question you asked.
    His suggestions are as follows:
    1) Expose the method as a client method on the App module
    2) On the pageflow create a new DataAction
    3) Drag and drop the logon method from the AppModule operations node and drop it onto the new data Action
    3) Edit the set-property values that are created in the Struts metadata for this new DataAction to use the correct expressions to get the logon info to pass to the middle tier.
    e.g.
    <action path="/authenticateUser" className="oracle.adf.controller.struts.actions.DataActionMapping" type="AuthenticateUserAction" name="DataForm"
    unknown="false">
    <set-property property="modelReference" value="authenticateUserUIModel"/>
    <set-property property="methodName" value="authenticateUserUIModel.authenticateUser"/>
    <set-property property="resultLocation" value="${requestScope.methodResult}"/>
    <set-property property="numParams" value="2"/>
    <set-property property="paramNames[0]" value="${param.logonUsername}"/>
    <set-property property="paramNames[1]" value="${param.logonPassword}"/>
    <forward name="fail" path="/logon.do"/>
    <forward name="success" path="/menu.do"/>
    </action>
    So in this case the values of the logonUsername and logonPassword fields in the form that submitted to this DataAction are passed as the two parameters that my authenticateUser method on the AppModule requires.
    I have also overriden the data action class to customise the findForward() method to route the user depending on if the method call worked or not.
    And here's the code for the customized FindForward in the DataAction:
    protected void findForward(DataActionContext actionContext) throws Exception
    HttpServletRequest request = actionContext.getHttpServletRequest();
    HttpSession session = request.getSession();
    String target = "fail";
    //Get the result of the Model Method call
    JUCtrlActionBinding method = actionContext.getCustomMethod();
    boolean successfulLogon = ((Boolean)method.getResult()).booleanValue();
    if (!successfulLogon)
    // If the logon fails we need to do the following
    // 1. Increament the counter once this exceeds 3 any logon will fail
    // 2. Create an error message to display on the logon screen
    // note this is a non specific error to prevent hackers from
    // knowing that they at least got the username right or from
    // knowing that there is a Max attempts value if they are trying
    // an automated attack
    Integer attempts = (Integer)session.getAttribute("logonAttempts");
    int intAttempts = 0;
    if (attempts != null)
    intAttempts = attempts.intValue();
    session.setAttribute("logonAttempts", new Integer(++intAttempts));
    //The error message comes out of the ApplicationResources.properties file.
    actionContext.getActionErrors().add("general",new ActionError("logon.error.logonFailed"));
    this.saveErrors(actionContext.getHttpServletRequest(),
    actionContext.getActionErrors());
    else
    //If connection was OK do we need to save the username in a cookie?
    String remember = (String)request.getParameter("logonRemember");
    int cookieLife = 0; //Expire
    if ( remember != null && remember.length()>0 )
    cookieLife = 2592000;
    String name = (String)request.getParameter("logonUsername");
    Cookie userCookie = new Cookie("CARA_USER_COOKIE",name);
    userCookie.setMaxAge(cookieLife);
    actionContext.getHttpServletResponse().addCookie(userCookie);
    target = "success";
    actionContext.setActionForward(target);
    I hope this helps anyone looking to implement something similar. It also illustrates the "preferred" way of executing a client method and working with the result.

  • How to access application state from stateless web service?

    I have a beginner J2EE question. After reading through J2EE tutorial, I still don't know how to create an application that would run on J2EE server, and which would have a web service interface to other world, and which would have several threads running, which would connect to other enterprise applications via TCP? Because if I understand it correctly, web service requires a stateless session bean, which means that it can't access any stateleful session bean (except always create one and remove it instantly). So there seems to be no way to store application state and have running threads.
    I'm asking this because .NET seems to have a very simple Application dictionary, which can save all application objects, including threads, and it is very easy to access this Application state from a stateless web service. Isn't there any similar functionality in J2EE? And if not, how it should be done in Java world then?
    I guess that the Connector architecture could be the solution, but it is not documented in the tutorial.

    There's nothing in the J2EE spec that says that you have to use Web Services. Web Services by definition are stateless.
    If your requirements are that you have to use a session bean along with a Web Service, then the architecture needs to be rethought, because it doesn't seem to me that Web Services are what you want.
    That said, you can use a hybrid. You can expose some of the functionality of your application as Web Services while the remaining is implemented in a classic J2EE type framework that is stateful.
    I would also think that you could store your application state via entity beans. You could save and load them when the web service is accessed. An entity bean doesn't require a database... just some form of persistence (could be an XML file for instance).
    You need to decide which components of J2EE make sense when and where.

  • How to access Application from Home computer

    Masters,
    I am completely new to application recently joined a company that runs on Application 11.5.6. In order to practice I wanted to be able to log into the application from my home computer.I am hesitant asking my boss about it so thought to ask my seniors who can well understand my fate.
    Kindly let me know what all I'll need to access this ...
    Thanks in Advance
    paro

    It means making your Oracle Apps functionality accessible via the Internet to external users. This would require lots of work in terms of setup and configuration, and in case it is not yet implemented then I guess this scenario is not the best for you.
    For VPN, it is a form of communication over networks that are public in ownership, but emulate a private network in terms of security. In this scenario, your Network Administrator has to set up VPN and you need to install the client version on your HomePC. Once you are connected, your HomePC will be part of the intranet (Internal Network). So, you will be able to access the application as you are at office.

  • XML basic, how to access info by tag

    One quick question:
    I have an xml file, and at the very beginning there are these tags with data that i need to get. I have learned how to access nodes to retrieve information-like employee, name, age, id, but for these tags that appear only once, I am lost as how to process them. For instance here, I only want the string 15-09-2008.
    <JAVS>
    <TEST>15-02-2004</TEST> <---------- (how do i get just this line?
    <STAGE>3</STAGE>
    <MEETING_DT>15022004</MEETING_DT>
    <MEETING_DT_S>15FEB04</MEETING_DT_S>
    <DAY>MON</DAY>
    .<Employee>
    <Age>...
    <ID>...
    Thanks

    The main xml file holds employee data:
    .<Employee>
    <Name>...</Name>
    <Age>...</Age>
    <ID>...</ID>
    </Employee>
    .<Employee>
    <Name>...</Name>
    <Age>...</Age>
    <ID>...</ID>
    </Employee>
    which i can grab by getting:           NodeList nl = docEle.getElementsByTagName("Employee");
    and going from there getting the name, age, id stuff
    however, this <employee> information is preceded by other information such as <Day> and <meeting_dt> which i need. However, this is not repeating information and appears once. That is my problem. I try NodeList n2=NodeList nl = docEle.getElementsByTagName("JAVS"); and then looking for <Day> but this failed.
    <JAVS>
    <Day>15-02-2004</Day> <---------- (how do i get just this line?
    <STAGE>3</STAGE>
    <MEETING_DT>17022004</MEETING_DT>
    Entire xml file:
    <JAVS>
    <Day>15-02-2004</Day> <---------- (how do i get just this line?
    <STAGE>3</STAGE>
    <MEETING_DT>17022004</MEETING_DT>
    .<Employee>
    <Name>...</Name>
    <Age>...</Age>
    <ID>...</ID>
    </Employee>
    .<Employee>
    <Name>...</Name>
    <Age>...</Age>
    <ID>...</ID>
    </Employee>
    </JAVS>
    -----------------------

  • OAM11g - How to perform direct login without accessing protected resource?

    Hi,
    I think this should be a common requirement as website needs to provide a direct login page.
    The OAM Documentation seems focus on the flow of starting from accessing protected resource then redirect to login page.
    How can we perform direct login?
    I tried from my custom login page directly, but it always gives me *"PolicyEvaluationException: OAMSSA-06191: The runtime request contains no resource"* once the login form submitted.
    Anyone can advise? Thanks in advance.

    Thanks for the reply.
    We need to cater for both the scenarios:
    Scenario 1: User tries to access a protected page. He/she will be redirected to the login page. Once it is authenticated, he/she will be redirected back to the previously requested protected page
    Scenario 2: User clicks the "Login" link on the homepage where the homepage is definitely unprotected. He/she will be redirected to the login page. Once it is authenticated, he/she will be redirected back to homepage.
    I have tried to the "Success URL" parameter of the Authentication Policy. However, once "Success URL" is defined, Scenario 1 will NOT work...
    Yes. There are some work around solution I can think about.
    Example: use a intermediate page 'rediret.jsp' which is defined as the protected resource.
    The flow is: clicks the "Login" link on the homepage -> a intermediate page 'rediret.jsp' -> login page -> redirect back to 'rediret.jsp' -> 'rediret.jsp' will redirect user to the Homepage...
    But I think Scenario 2 should be very common and it should be a right solution for it. Please advise. Thanks

Maybe you are looking for

  • Looking for 27" monitor or larger under $350

    Looking for (2) 27" monitor or larger under $350 each. It will be a dual monitor for a new build. Used mostly for PP cs 5.5   Win 7, 64 bit 1920/1080 of course. Video card will be: ASUS ENGTX480/2DI/1536MD5 GeForce GTX 480 (Fermi) 1536MB 384-bit GDDR

  • Download a smartform on local disk based on transport request

    Dear Experts,         I want to given on selection screen  transport request and path .If in this tranport request there is any              smartform ,all download on  local disk. So what sud i have to do for this.Please give me a example for it. Th

  • Differentiation Attachment - Multiple Attachment Columns?

    In a list I have, users need to be able to upload documents.  On each item, they will attach several documents.  There are 3 types of documents they can attach.  What I want to accomplish is a way to easily differentiation what kind of document each

  • Printing For an XP

    Can I Printer to a LW 630 Pro from a XP?

  • [REQUEST] UEFI Bios for GTX 770

    Can you please send me the latest  bios that will allow me to boot MSI GTX 770 Twin Frozr 2GB o/c  with UEFI in Win 8.1 64bit using SSD. I have looked at the MSI website and the bios files for my card are not available for download.  Apparently only