Access jsp's application object from an .java file?

Hi,
I hava a .jsp page and an import statement to a .java file. How can I access the application object in this .java file?
I want to make an initialization function that I want to be called in every .jsp of the WEB application and to store this function in a .java file.

The only way to get a hold of the application object would be to pass it to java code as a parameter to a method.
ie public class Util{
public void initialiseJSPPage(ServletContext application){
  // do stuff in ServletContext
}and then in the JSP call it via
<% Util.initialiseJSPPage(application); %>
You could manually include this code on every JSP.
A better alternative is that in web.xml you can configure an automatic include (See JSP.3.3.5)
What is it you are trying to accomplish by doing this?
Would a Filter be a more appropriate tool in this case? That would let you run java code before selected requests are handled.
Cheers,
evnafets

Similar Messages

  • View Object to read data from a java file

    Hi,
    I am using JDeveloper 11.1.1.4 and ADF-BC in my application.
    For one of my view objects , I want the data to be read from a java file which exposes some method to return a collection.
    I cannot use a static view object in this case.
    Please suggest the best way to implement this requirement.Basically build a view object that should read data from a java file.
    Thanks,
    Praveen

    Depending on your use case you can either use a programmatic VO or directly expose the JV class as a data control.
    http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_36/jdtut_11r2_36.html

  • How to Use AccessibleObjectFromWindow API in VBA to Get Excel Application Object from Excel Instance Window Handle

    I need to get the Excel.application object from a window handle using AccessibleObjectFromWindow. I can't seem to make the code work. First, I successfully search for the XLMAIN windows. Then, when I get a handle, I execute the AccessibleObjectFromWindow
    function. It seems to return a value of -2147467262 in all cases. Therefore, I believe that it is returning an error value. I can't figure out how to determine the meaning of this value.
    If it is an error value, I believe that one or more arguments are in error. My best guess at present is that the GUID argument is incorrect. I have tried two GUID values: {00020400-0000-0000-C000-000000000046} and {90140000-0016-0409-0000-0000000FF1CE}.
    I have seen both used in conjunction with OBJID_NATIVEOM. Neither one seems to work. I really would prefer not to use the second one as it has an Excel major and minor version number. I would hate to have to change this code, if a new minor version appeared.
    The attached code has been commented to show which parts have been shown to work and which not. I'm at my wits end and really need help.
    Thanks
    'This module is located in Access 2010, but this is an Excel question.
    Option Compare Database
    Option Explicit
    ' Module-Level Declarations
    'The GetDesktopWindow function and FindWindowEx function work just fine.
    Public Declare Function GetDesktopWindow Lib "user32" () As Long
    Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
    (ByVal hWnd1 As Long, _
    ByVal hWnd2 As Long, _
    ByVal lpsz1 As String, _
    ByVal lpsz2 As String) _
    As Long
    'I'm not getting the expected output from this function (see below)
    Private Declare Function AccessibleObjectFromWindow& Lib "oleacc.dll" _
    (ByVal hwnd&, _
    ByVal dwId&, _
    riid As GUID, _
    xlwb As Object)
    Type GUID
    lData1 As Long
    iData2 As Integer
    iData3 As Integer
    aBData4(0 To 7) As Byte
    End Type
    Function ExcelInstances() As Long
    ' Procedure-Level Declarations
    ' Value of OBJID_NATIVEOM verified by checking list of Windows API constants _
    on this site: http://www.lw-tech.com/q1/base.htm
    Const OBJID_NATIVEOM = &HFFFFFFF0
    Dim hWndDesk As Long 'Desktop window
    Dim hWndXL As Long 'Child window
    Dim objExcelApp As Object 'Final result wanted: Excel application object
    'Following variable (xlapp) to be set by AccessibleObjectFromWindow function
    Dim xlapp As Object
    Dim IDispatch As GUID 'GUID used in call to AccessibleObjectFrom Window function
    'Set up GUID to be used for all instances of Excel that are found
    Dim tmp1 As Variant 'Return value from AccessibleObjectFromWindow
    ' Executable Statements
    SetIDispatch IDispatch
    IDispatch = IDispatch
    'Get a handle to the desktop
    hWndDesk = GetDesktopWindow 'This seems to work
    Do
    'Get the next Excel window
    'The following statement seems to work. We are finding and counting _
    correctly all the instances of Excel. hWndXL is non-zero for each _
    instance of Excel
    hWndXL = FindWindowEx(GetDesktopWindow, hWndXL, "XLMAIN", vbNullString)
    'If we got one, increment the count
    If hWndXL > 0 Then
    'This works. We correctly count all _
    instances of Excel
    ExcelInstances = ExcelInstances + 1
    'Here is the problem. The following statement executes and returns a value of _
    -2147467262. xlapp, which is passed by reference to AccessibleObjectFromWindow, _
    is set to nothing. It should be set to the object for Excel.application. _
    I believe that this value is not an object. I tried to reference tmp1. in the _
    immediate window. There was no Intellisense.
    'I think that the function in returning an error value, but I can't figure _
    out what it is. I believe that AccessibleObjectFromWindow returns error _
    values, but I don't know where to find their values so I can interpret the _
    function's results.
    'As best I can tell, the hWndXL parameter is correct. It is the handle for _
    an instance of Excel. OBJID_NATIVEOM is set correctly (see constant declaration _
    above). xlapp is passed by reference as a non-initialized object variable, which _
    will be set by AccessiblObjectFromWindow. IDispatch may be the problem. It is set _
    as shown below in the procedure SetIDispatch(ByRef ID As GUID). This procedure _
    appears to work. I can see that IDispatch is set as I intended and correctly _
    passed to AccessibleObjectFromWindow.
    tmp1 = AccessibleObjectFromWindow(hWndXL, OBJID_NATIVEOM, IDispatch, xlapp)
    'Need to write code to test tmp1 for error. If none, then set objExcelApp = _
    object. Also, I exect xlapp to be set to Excel.application
    End If
    'Loop until we've found them all
    Loop Until hWndXL = 0
    End Function
    Private Sub SetIDispatch(ByRef ID As GUID)
    'Defines the IDispatch variable. The interface _
    ID is {90140000-0016-0409-0000-0000000FF1CE}.
    'NOT USING {00020400-0000-0000-C000-000000000046}, _
    which could be the problem
    '9 is release version - first version shipped (initial release)
    '0 is release type - retail/oem
    '14 is major version
    '0000 is minor version
    '0016 is product ID - MS Excel 2010
    '0409 is language identifier - English
    '0 is x86 or x64 - this is x86
    '000 reserved
    '0 is debug/ship
    '000000FF1CE is office family ID
    With ID
    .lData1 = &H90140000
    .iData2 = &H16
    .iData3 = &H409
    .aBData4(0) = &H0
    .aBData4(1) = &H0
    .aBData4(2) = &H0
    .aBData4(3) = &H0
    .aBData4(4) = &H0
    .aBData4(5) = &HF
    .aBData4(6) = &HF1
    .aBData4(7) = &HCE
    End With
    End Sub
    DaveInCalabasas

    I don't think you can return a reference to Excel's main window like that as you are attempting to do.
    Ref:
    http://msdn.microsoft.com/en-us/library/windows/desktop/dd317978(v=vs.85).aspx 
    It's relatively straightforward to return any workbook's window in any given instance, and in turn it's parent Excel app. Try the following and adapt as required (and include error handling) -
    Option Explicit
    Private Declare Function FindWindowEx Lib "User32" Alias "FindWindowExA" _
    (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
    ByVal lpsz2 As String) As Long
    Private Declare Function IIDFromString Lib "ole32" _
    (ByVal lpsz As Long, ByRef lpiid As GUID) As Long
    Private Declare Function AccessibleObjectFromWindow Lib "oleacc" _
    (ByVal hWnd As Long, ByVal dwId As Long, ByRef riid As GUID, _
    ByRef ppvObject As Object) As Long
    Private Type GUID
    Data1 As Long
    Data2 As Integer
    Data3 As Integer
    Data4(7) As Byte
    End Type
    Private Const S_OK As Long = &H0
    Private Const IID_IDispatch As String = "{00020400-0000-0000-C000-000000000046}"
    Private Const OBJID_NATIVEOM As Long = &HFFFFFFF0
    Sub test()
    Dim i As Long
    Dim hWinXL As Long
    Dim xlApp As Object ' Excel.Application
    Dim wb As Object ' Excel.Workbook
    hWinXL = FindWindowEx(0&, 0&, "XLMAIN", vbNullString)
    While hWinXL > 0
    i = i + 1
    Debug.Print "Instance_" & i; hWinXL
    If GetXLapp(hWinXL, xlApp) Then
    For Each wb In xlApp.Workbooks
    Debug.Print , wb.Name
    Next
    End If
    hWinXL = FindWindowEx(0, hWinXL, "XLMAIN", vbNullString)
    Wend
    End Sub
    'Function GetXLapp(hWinXL As Long, xlApp As Excel.Application) As Boolean
    Function GetXLapp(hWinXL As Long, xlApp As Object) As Boolean
    Dim hWinDesk As Long, hWin7 As Long
    Dim obj As Object
    Dim iid As GUID
    Call IIDFromString(StrPtr(IID_IDispatch), iid)
    hWinDesk = FindWindowEx(hWinXL, 0&, "XLDESK", vbNullString)
    hWin7 = FindWindowEx(hWinDesk, 0&, "EXCEL7", vbNullString)
    If AccessibleObjectFromWindow(hWin7, OBJID_NATIVEOM, iid, obj) = S_OK Then
    Set xlApp = obj.Application
    GetXLapp = True
    End If
    End Function
    Note as written if an instance does not have any loaded workbooks a reference will not be returned (though a workbook can be added using DDE, but convoluted!)
    FWIW there are two other very different approaches to grab all running Excel instances though something along the lines of the above is simplest.
    Peter Thornton

  • Problem with return a ColdFusion query object from a Java class

    Hi!
    I need to return a ColdFusion query object from a Java class
    using a JDBC result set ( java.sql.ResultSet);
    I have tried to pass my JDBC result set in to the constructor
    of the coldfusion.sql.QueryTable class with this code:
    ColdFusion code
    <cfset pra = createObject("java","QueryUtil").init()>
    <cfset newQuery = CreateObject("java",
    "coldfusion.sql.QueryTable")>
    <cfset newQuery.init( pra.getColdFusionQuery () ) >
    My java class execute a query to db and return QueryTable
    Java code (QueryUtil.java)
    import coldfusion.sql.QueryTable; // (CFusion.jar for class
    QueryTable)
    import com.allaire.cfx //(cfx.jar for class Query used from
    QueryTable)
    public class QueryUtil
    public static coldfusion.sql.QueryTable
    getColdFusionQuery(java.sql.ResultSet rs)
    return new coldfusion.sql.QueryTable(rs);
    but when i run cfm page and coldfusion server tries to
    execute : "<cfset pra =
    createObject("java","QueryUtil").init()>" this error appears:
    Object Instantiation Exception.
    An exception occurred when instantiating a java object. The
    cause of this exception was that: coldfusion/sql/QueryTable.
    If i try to execute QueryUtil.java with Eclipse all it works.
    Also I have tried to return java.sql.ResultSet directly to
    coldfusion.sql.QueryTable.init () with failure.
    Do you know some other solution?

    ok
    i print all my code
    pratica.java execute a query to db and return a querytable
    java class
    import java.util.*;
    import java.sql.*;
    import coldfusion.sql.*;
    public class Pratica {
    private HashMap my;
    private String URI,LOGIN,PWD,DRIVER;
    private Connection conn=null;
    //funzione init
    //riceve due strutture converite in hashmap
    // globals
    // dbprop
    public Pratica(HashMap globals,HashMap dbprop) {
    my = new HashMap();
    my.put("GLOBALS",globals);
    my.put("DBPROP",dbprop);
    URI = "jdbc:sqlserver://it-bra-s0016;databaseName=nmobl";
    LOGIN = "usr_dev";
    PWD = "developer";
    DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    try{
    // Carico il driver JDBC per la connessione con il database
    MySQL
    Class.forName(DRIVER);
    /* Connessione alla base di dati */
    conn=DriverManager.getConnection(URI,LOGIN,PWD);
    if(conn!=null) System.out.println("Connection Successful!");
    } catch (ClassNotFoundException e) {
    // Could not find the database driver
    System.out.print("\ndriver non trovato "+e.getMessage());
    System.out.flush();
    catch (SQLException e) {
    // Could not connect to the database
    System.out.print("\nConnessione fallita "+e.getMessage());
    System.out.flush();
    //funzione search
    //riceve un hash map con i filtri di ricerca
    public QueryTable search(/*HashMap arg*/) {
    ResultSet rs=null;
    Statement stmt=null;
    QueryTable ret=null;
    String query="SELECT * FROM TAN100pratiche";
    try{
    stmt = conn.createStatement();// Creo lo Statement per
    l'esecuzione della query
    rs=stmt.executeQuery(query);
    // while (rs.next()) {
    // System.out.println(rs.getString("descrizione"));
    catch (Exception e) {
    e.printStackTrace();
    try {
    ret = Pratica.RsToQueryTable(rs);
    } catch (SQLException e) {
    e.printStackTrace();
    this.close();
    return(ret);
    // ret=this.RsToQuery(rs);
    // this.close(); //chiude le connessioni,recordset e
    statament
    //retstruct CF vede HashMap come struct
    //METODO DI TEST
    public HashMap retstruct(){
    return(my);
    //conversione resultset to querytable
    private static QueryTable RsToQueryTable(ResultSet rs)
    throws SQLException{
    return new QueryTable(rs);
    //chiura resultset statament e connessione
    private void close(){
    try{
    conn.close();
    conn=null;
    catch (Exception e) {
    e.printStackTrace();
    coldfusion code
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
    Transitional//EN">
    <html>
    <head>
    <title>Test JDBC CFML Using CFScript</title>
    </head>
    <body>
    <cftry>
    <cfset glb_map =
    createObject("java","java.util.HashMap")>
    <cfset dbprop_map =
    createObject("java","java.util.HashMap")>
    <cfset glb_map.init(glb)> <!---are passed from
    another page--->
    <cfset dbprop_map.init(glb["DBPROP"])>
    <cfset pra =
    createObject("java","Pratica").init(glb_map,dbprop_map)>
    <cfset ourQuery
    =createObject("java","coldfusion.sql.QueryTable").init(pra.search())>
    <cfcatch>
    <h2>Error - info below</h2>
    <cfdump var="#cfcatch#"><cfabort>
    </cfcatch>
    </cftry>
    <h2>Success - statement dumped below</h2>
    <cfdump var="#ourQuery#">
    </body>
    </html>
    error at line <cfset pra =
    createObject("java","Pratica").init(glb_map,dbprop_map)>
    An exception occurred when instantiating a java object. The
    cause of this exception was that: coldfusion/sql/QueryTable.
    -----------------------------------------------------------------------

  • How to read messages in message pool from a java file

    Hi All,
    I want to read a message that is defined in a message pool of a webdynpro component.
    This reading should be done from a java file present in the "src" folder.
    How can I get the handle to the IWDComponent?
    Or is there any other way?
    Or is there any way of reading localized messages in a java file of a webdynpro component?
    Can you kindly guide me out of this issue?
    Thanks and regards
    RB

    Hello,
    my approach is more simple: how can I read within component A the message pool of another webdynpro component B ? Component A has a usage relation to component B .
    I tried this within component A:
    <b>this.wdThis.wdGetBInterface().wdGetAPI().getComponent().getTextAccessor().getText("ANY_TEXT");</b>
    I got the exeption:
    <b>java.lang.UnsupportedOperationException: Embedded Components are black boxes. You should not access parts which are not in their interface</b>.
    Is there any way to share message pools ?
    Thanks
    Kerstin

  • How to make a jar file from a java file?

    how to make a jar file from a java file, is there any one tht can help me thank you;

    You can study this.
    http://java.sun.com/docs/books/tutorial/jar/basics/index.html

  • Trying to compile a .java file from another .java file

    Hello,
    I'm trying to compile a .java file from another .java file using Runtime.exec...
    String c[]=new String[3];
    c[0]="cmd.exe"; c[1]="/c" ; c[2]="javac Hello.java";
    Process p=Runtime.exec(c);
    If anyone can help me in atleast getting the command prompt when Runtime.exec("cmd.exe") is executed...that would be great...I tried out notepad.exe, calc, explorer instead of cmd.exe...all the commands display their respective windows..except cmd.exe...the command prompt doesnt appear...
    Please help me ASAP....
    Thanks for your help in advance...
    Regards.
    AKhila.

    try this. ur code will be compliled and will get .class file. but console won't appear. is it a must for u?
    public class Exec{
         public static void main(String a[]) throws Exception{
              String c[]=new String[3];
              c[0]="cmd.exe"; c[1]="/c" ; c[2]="javac Hello.java";
              Process p=Runtime.getRuntime().exec(c);
              // or Runtime.getRuntime().exec("javac Hello.java");

  • Open a web page and pass values from a java file

    Hi,
    I need to open a web page and pass values in the text boxes.
    Finally submit needs to be triggered. All this needs to be done from a java file. i.e instead of entering my values in a web page and submit, i need to do it from my java file..
    Any inputs so that I proceed in the right direction..or is there any alternate way to achive this ??
    Thanks in advance..
    Sid

    I hava found a lines of jaa that can open a URL , lets say www.net.java
    You can open it writable or not.
    It is half of the job you need.
    If you are interested.
    I am wrinting a program to print a URL , and have developed this small
    code.
    Angel Portal

  • Accessing an UIComponent object from a .java

    Hello,
    I have i new problem here, i have fetch in the java-doc but in vain ...
    Does somebody have an example on the syntax of the code that i have to put in my java file to access an UIComponent object ?
    Thanks :-)
    In fact here is what i'd like to do:
    I would like to have in my jsp, a select list with values defined in my backing bean according to a parameter. For example, a product can have 2 status: sold out or available. If available i want the select list to have values as 1,2 and if sold out 2,3 ...

    No in fact what i want is:
    I want a select list with 4 options:
    - Choice 1
    - Choice 2
    - Choice 3
    - Choice 4
    if the status is 1, then i want my select list to contain :
    - Choice 1
    - Choice 2
    In this case, i want to remove from my backing bean, the choice 3 and choice 4
    if the status is 2:
    - Choice 1
    - Choice 2
    - Choice 3
    So in this case, i want to remove choice 4...
    I need to do that from a bean.

  • How can access MS Outlook Calender information  from my Java application.

    People schedule meeting with some data on regular basis.
    I need to access the Exchange server from my Java application and get the meeting dates along with other data pertaining to meeting.

    I had the same problem, and I dont think (as far as my knowledge goes) there is any freeware that will enable Java to access Exchange server. But there are some commercial products that are available.
    Chk this link as an example: http://www.compoze.com/products_hme_desc.html
    good luck in the research
    -kms

  • Retrieving a UDT object from a Java Stored Procedure

    I am really having trouble returning a UDT object (AttributeUDT) from a Java stored procedure. I am using Oracle 8.1.6 and JDeveloper 3.2.2. I have successfully used JPublisher to create the Java source code files for my UDT, now I would like to use that in coordination with my Java stored procedure. I've loaded the Java stored procedure into the database using the Deployment option in JDeveloper. However, when it loads the procedure, it translates the 3rd parameter to an OBJECT type, thus making the stored procedure invalid. I can use SQL Navigator to correct the package by changing the OBJECT reference to AttributeUDT (my UDT data type). Unfortunately, my Java stored procedure still does not work. Any help would be greatly appreciated! Thanks in advance for your time!
    In the example below, could anyone please tell me:
    1. How do I register the OUT variable for the UDT?
    2. Is it correct to use the casted call to getObject to retrieve my UDT object?
    3. Is it valid to use the UDT data type in the java stored procedure method signature?
    The call to the Java stored procedure:
    OracleCallableStatement cs3 = (OracleCallableStatement)conn.prepareCall( "{ call sandbox.getQualifiersV3( ?, ?, ?) }");
    cs3.registerOutParameter( 1, Types.VARCHAR);
    cs3.registerOutParameter( 2, Types.VARCHAR);
    cs3.registerOutParameter( 3, ???????);
    cs3.execute();
    System.out.println( "ID: " + cs3.getString( 1));
    System.out.println( "Prompt: " + cs3.getString( 2));
    AttributeUDT attributes = (AttributeUDT)cs3.getObject( 3);
    System.out.println( "Table id: " + attributes.getLogicalTableId());
    System.out.println( "Element id: " + attributes.getElementId());
    cs3.close();
    ===========================================
    The Java stored procedure:
    public static void getQualifiersV3( String ids[], String prompts[],
    AttributeUDT attributes[]) throws SQLException {
    OracleConnection conn = (OracleConnection)new OracleDriver().defaultConnection();
    Statement stmt = conn.createStatement();
    OracleResultSet rs = (OracleResultSet)stmt.executeQuery(
    "SELECT * "
    + "FROM VPS_ABOK_QUALIFIERS "
    + "WHERE qualifier_id = 2001");
    rs.next();
    ids[0] = rs.getString( 1);
    prompts[0] = rs.getString( 2);
    attributes[0] = (AttributeUDT)rs.getCustomDatum( 3, AttributeUDT.getFactory());
    rs.close();
    stmt.close();
    null

    Sounds like your C2 REF TYP1 attribute may be null. Unfortunately you neglected to say where in your code the NullPointerException occurs.

  • Error in accessing the sample application content from the OBIEE 11g

    I installed OBIEE 11g + Oracle 11g database on one machine. Everything went smoothly with no issues.
    I can connection to the database from SQLPLUS.
    Then I followed instructions to deploy sample app. After everything is done, when I try to access the dashboards, reports etc from the OBIEE 11g home page , I get the error below.
    I am stuc kand dont know how to proceed. I verified tnsnames.ora and everything seems good.
    In the SampleAPp.RPD, I set DB_SID as "ORCL" and DB_HOST as my computer name (along with domain name). No idea how to proceed from here..
    I really appreciate any help.
    Odbc driver returned an error (SQLExecDirectW).
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 17001] Oracle Error code: 12541, message: ORA-12541: TNS:no listener at OCI call OCIServerAttach. [nQSError: 17014] Could not connect to Oracle database. (HY000)
    Thanks

    Thanks for the replies.
    1) Was the oracle installed in multiple instances ? if yes set the Variable path correctly pointing to your right folder
    Yes, oracle had multiple instances. I tried copying the tnsnames.ora from my oracle home to the Oracle_BI1/network/admin directory as 11g apparetnly comes with a Oracle client as BIFACTs suggested in his/her reply. I put the same in the path variable
    2) Try to ping the service_name tnsping service_name(SID) from command prompt
    This works.
    3) check whether you may have "white spaces" in tnsnames.ora file at starting of entry
    No white spaces appeated
    I still see the same issue! I logged in as developer credentials as mentioned the sample app documentation.
    I get the same "cannot connect to database" error.
    I once in a while see an issue with javahost not starting. Not sure what is the impact of javahsot not running and all the other managed processes running.
    Please help....

  • Slow applications start from win 2012 file server using win 7 workstations

    I hope someone can help me with why applications are slow to load i have replaced a 8 year old server running  win 2003 and replaced it with dell t620 running win 2012 r2 it is like 20 times faster but it is slower than the old server. the office has
    7 win 7 x64 machines all our applications are running from win 2012 file server. The server is set up as following the server runs with two hyper-v machines one machine runs ad, file server, dhcp, dns and printer server and the other is domino server and remote
    desktop. 
    the machine is more than capable but it is not so i started reading after i run out of ideas. i looked every where but the issue is with the server after trying everything else i did a simple test If i go to the application folder and click on it apps load
    instantly if i then type a unc path it takes from instant load to 3 and a bit seconds the same as the workstations. The same speed if I use ip address.
    network cards are intel
    i would really appreciate if somebody has suggestions that i could try
    thank you

    Hi,
    Do you mean that applications in the application folder start slowly when you access the application folder on the Windows 2012 R2 file server from Windows 7 workstations using UNC path or IP address. Do all the files in the application folder have the same
    issue? Please create a shared folder on the file server, then access the shared folder from Windows 7 workstations to check if the issue still exists.
    You could disable SMBv3 on server 2012 to check if the issue related to SMB protocol. 
    How to enable and disable SMBv1, SMBv2, and SMBv3 in Windows Vista, Windows Server 2008, Windows 7, Windows Server 2008 R2, Windows 8, and Windows Server 2012
    http://support.microsoft.com/kb/2696547/en-us
    Warning: We do not recommend that you disable SMBv2 or SMBv3. Disable SMBv2 or SMBv3 only as a temporary troubleshooting measure. Do not leave SMBv2 or SMBv3 disabled.
    Best Regards,
    Mandy 
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Create File Object from a remote file

    Hi,
    I would like to know about how to create a new File object from a file in a remote machine, it is a web application, i have the remote route of the file, and if I need the ip of the remote machine, I would like to know how to get it too.
    File fileobject = new File(�What do I have to put here or before or whatever?);
    Thank you very much.
    J.

    First, from the technical point of view you can't create a File object unless it's a file on the computer where the code is running. It doesn't matter if you have an IP address or something, if you haven't mapped a drive to it you can't create a File object.
    But more importantly, you can't just reach out from your server and grab a file from the client's computer. That's an obvious security violation and if you didn't realize that you shouldn't be designing web applications yet. If you want a file uploaded then you have to provide the client with an HTML form where they select a file to be uploaded.

  • Reading an Array of Objects from a .bin file!

    Hey, at the moment I'm creating a program whereby I write a set of objects onto a bin file, in this case an array of objects with a String name/county, and int population/area.... I'm not trying to read it back from the bin file and encountering trouble! I've managed to get it working using plain objects, however I want to be able to read in arrays of objects. The file itself compiles, however during running I get this error
    java.lang.NullPointerException
    at RecordFiles.CoastalRead.main(CoastalRead.java:33)
    at RecordFiles.__SHELL16.run(__SHELL16.java:6)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at bluej.runtime.ExecServer$3.run(ExecServer.java:774)
    Here is the program itself,
    import java.io.*;
    public class CoastalRead {
        public static void main(String[] args) {
            CoastalTowns towns[] = new CoastalTowns[50];
              towns[0] = new CoastalTowns();
              towns[1] = new CoastalTowns();
              towns[2] = new CoastalTowns();
              towns[3] = new CoastalTowns();
              towns[4] = new CoastalTowns();
              String name, county;
              int population, area;
            try {
                FileInputStream fileIn =
                        new FileInputStream("CoastalTownsBin.bin");
                ObjectInputStream in = new ObjectInputStream(fileIn);
                for (int i = 0; i < towns.length; i++){
                 towns[i] =(CoastalTowns) in.readObject();
                   System.out.println("Deserialized File...");
                       System.out.println("Name: " + towns.name);
              System.out.println("County: " + towns[i].county);
         System.out.println("Population: " + towns[i].population);
              System.out.println("Area: " + towns[i].area);
    in.close();
    fileIn.close();
    } catch (IOException i) {}
    catch (ClassNotFoundException c) {}
    +I'd appreciate a fast reply!+ And if someone needs the writing class I've used, I can post it asap.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    CoastalTowns towns[] = new CoastalTowns[50];
    towns[0] = new CoastalTowns();
    towns[1] = new CoastalTowns();
    towns[2] = new CoastalTowns();
    towns[3] = new CoastalTowns();
    towns[4] = new CoastalTowns();Why create an array with a size of 50 and then only fill 5 elements?
    Why bother filling any elements at all when you are reading the objects from a file?
    What happens if there are less than 50 objects in your file?
    I will assume CoastalTowns holds info about a single town, so why is it pluralised? Do you have a class called Dog or Dogs, Chair or Chairs, Person or People?
    } catch (IOException i) {}
    catch (ClassNotFoundException c) {}DO NOT swallow exceptions. At the very least put in a call to printStackTrace so you know if/when an exception occurs.
    I'd appreciate a fast reply!I typed as fast as I could but unfortunately I'm still and hunt and peck guy.

Maybe you are looking for

  • Select option in Dialog program screen

    Hi friends, do we have any way to get a select option displayed in dialog programming ? or create a screen field with the properties of a select option in dialog screen ? or any standard function module to support this scenario ? Thanks and Regards S

  • User Exits for FI transaction at time of 'Save'

    Hi All, I'm looking User Exits for the FI transaction - FBD1. I used CMOD to identify the user Exits available for the 'FBAS' package: F050S001 - FIDCMT, FIDCC1, FIDCC2: Edit user-defined IDoc segment    F050S002 - FIDCC1: Change IDoc/do not send    

  • Problem with zipping directory

    Running 10.6.8 Directory has EVERYONE R/W access when I try to COMPRESS , I receive a message: The operation can't be completed because you don't have permission to access ".DS_Store". with OK button. It is so annoying and its NOT OK getting this mes

  • Communicating USB using Labview VISA

    I have a USB RAW device that I am trying to communicate with using labview VISA. I have had success with setting up the driver and I am able to get information from the device such as serial number, etc. When I try to use the VISA read and write comm

  • Exception in thread "main" java.util.NoSuchElementException

    Hello there, I need to store resultset values in arrays. Following is my code: (Note : The function uses the jdbc connection with mysql that is return from other function.) public static void getResultSetInArray(Connection con) throws Exception Map l