How to get ServletContext from HttpServletRequest when there is no session?

Does anyone know of a way to be able to pull the ServletContext from an HttpServletRequest if there is not a session available?

You could always just do:
request.getSession(true).getServletContext()The true argument to getSession() creates a session if there isn't one. Alternatively, you can store the ServletConfig object you receive in the Servlet's init() method, and get the ServletContext through that.
Brian

Similar Messages

  • How to get values from resultset when using subquery???

    Hi ,
    I have a problem in executing sql query from java.
    I am executing an sql query which return a intersection of values from 3 tables.
    Here is the query I am using
    select id from dps_user where id in (select b.id from dps_user b,laserlink c
    where c.userid='univ.'||b.login and c.status in(1,3,8,9,10)
    intersect
    select b.id from dps_user b,laserlink c
    where c.userid=b.login and c.status in(1,3,8,9,10)).
    this query is working fine from sql .
    when I am trying to excute the same query from java nothing is coming into resultset.
    String ISP_AND_EMAIL="select id "+
                             " from dps_user where id in (select b.id from dps_user b,laserlink c "+
                                  "where c.userid='"+"univ.'"+" ||b.login and c.status in(1,3,8,9,10)"+
                                  " intersect "+
                                  " select b.id from dps_user b,laserlink c"+
                                  " where c.userid=b.login and c.status in(1,3,8,9,10))";
              System.out.println(ISP_AND_EMAIL);
              rs=stmt.executeQuery(ISP_AND_EMAIL);
    How to use concatinate string (|| ) in java.
    can anyone help to retrieve the values from this resultset...
    Thanks

    concatnation is done using + in java.
    I am doubtful about the following line where there may be error
    "where c.userid='"+"univ.'"+" ||b.login and c.status in(1,3,8,9,10)"+
    I don't know if the univ. is a string or some variable.I need more clarification on this line,then i may help u.
    thx

  • HT4859 how to get pictures from icloud when Iphone is stolen

    how to pictures and music from Icloud when phone is stolen

    Photo stream photos can only be access from another iOS device or computer signed into your iCloud account with photo stream enabled.  Camera roll photos (and videos) are contained in the iPhone backup, assuming you have one.  If you backed up to your computer using iTunes, you can extract the photos from the backup using 3rd party software such as iPhone Backup Extractor.  If you backed up to iCloud, your these photos can only be accessed by restoring the backup to another iOS device.
    Music isn't included in the backup; it should be in your iTunes library.  Music purchased from iTunes can be redownloaded again for free (http://support.apple.com/kb/HT2519), but music from other sources, if not in your iTunes library, cannot be recovered.

  • How to get sound from phone when bluetooth connected

    Easily paired my Plantronic bluetooth headset - piece of cake.  However, if I'm not on the phone, I don't keep it on my ear.  Sounds, except phone ringing, only come thru the headset whe it is on.  I would like to hear the other sounds (i.e. notifications, text message alerts, other alerts) from the phone when my bluetooth headset is connected.  It would be a pain to have to turn the headset on/off just to hear anything from the phone.  I actually missed a meeting as the phone made no noise for my calendar reminder.
    I would like the option of routing the tones/alert sounds to either phone or headset or just have it automatically do both.
    Thanks
    lawashbu

    Im afraid that disconnecting your blue tooth devise would be the only answer to your problem im afraid that is the only way
    Hope this helped
    Freddie

  • Get postion from vacancy when transfer applicant data

    Dear all,
    Pls tell me how to get postion from vacancy when transfer applicant data? At the Initial data entry, i chose the advertisement that determine vacancy. But when transfer data, i have to choose the position again.
    Best reagrds,
    Quanglv

    Hi,
    IN PB40 enter additional data you assign applicant to position or vacancy, and when u will transfer data to pa position will come automatically...
    Regards,
    Kapil

  • When I turned my 4s on today all of my contacts are gone. They are backed up in iCloud but I don't know how to get them from there to my phone. Aren't they suppossed to sync automatically over wifi?        Can someone help?

    Hello. When I turned on my Ipone 4s today all of my contacts were gone. They are backed up in iCloud but can't figure out how to get them from there back to my phone. Aren't them supposed to sync automatically over wifi? Can someone please help me?

    Hello jllew333
    Check to make sure that Contacts is toggled on to sync by going to Settings > iCloud. Also go to iCloud.com to see if the contacts are showing up there to see if it syncing those contacts.
    iCloud: Change iCloud feature settings
    http://support.apple.com/kb/PH2613
    Regards,
    -Norm G.

  • I see how to delete songs from iPad, but there are some that won't give me the option to delete when I swipe it. Why won't it let me?

    I see how to delete songs from iPad, but there are some songs that don't give me the option to delete when I swipe them. Why can't I get rid of these songs?

    Do they have a cloud icon next to them? If they do, they aren't on the iPad so you can't delete them. They are in iCloud ready for you to download them if you want to and they are visible in the music app for this purpose.
    If you don't want to see these songs that are in iCloud, go to Settings> iTunes & App Store>Show all>Music>Off.

  • How to get photos from mac to iPhone 6? when i try it just comes up iCloud instead of my photos

    how to get photos from mac to iPhone 6? when i try it just comes up iCloud instead of my photos

    Make sure Settings > iCloud > Photos > iCloud Photo Library (Beta) = "Off"
    Then sync your iPhone using iTunes and make sure your sync settings for photos are set correctly in iTunes.

  • How do I keep emails from being deleted on my iPhone 6? Emails get deleted from phone when I startup desktop computer and they are downloaded from sever. Is POP3 no longer supported on IOS 8.1?

    How do I keep emails from being deleted on my iPhone 6? Emails get deleted from phone when I startup desktop computer and they are downloaded from sever. Is POP3 no longer supported on IOS 8.1?

    Have you seen this?
    Using a POP account with more than one device - Apple Support
    A better solution is if your email provider uses IMAP. IMAP sync email folders between multiple devices. Meaning any device will receive the email, all sent email can be seen on the devices. If you delete email from one device the email is deleted from all the other devices. Check with your email provider to see if they offer IMAP services.
    If they do not your choices are to 1) configure email on the PC to keep Mail on the mail server or 2) change email providers to something like Gmail or Outlook.com (as examples). FWIW I use Cox IMAP email and fully sync email between a Win 8.1 Update 1 laptop, a Win 7 desktop, an iPad 4, an iPhone 4 and an iPhone 5S.

  • How to get UTF-8 encoding when create XML using DBMS_XMLGEN and UTL_FILE ?

    How to get UTF-8 encoding when create XML using DBMS_XMLGEN and UTL_FILE ?
    Hi,
    I do generate XML-Files by using DBMS_XMLGEN with output by UTL_FILE
    but it seems, the xml-Datafile I get on end is not really UTF-8 encoding
    ( f.ex. cannot verifying it correct in xmlspy )
    my dbms is
    NLS_CHARACTERSET          = WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET     = AL16UTF16
    NLS_RDBMS_VERSION     = 10.2.0.1.0
    I do generate it in this matter :
    declare
    xmldoc CLOB;
    ctx number ;
    utl_file.file_type;
    begin
    -- generate fom xml-view :
    ctx := DBMS_XMLGEN.newContext('select xml from xml_View');
    DBMS_XMLGEN.setRowSetTag(ctx, null);
    DBMS_XMLGEN.setRowTag(ctx, null );
    DBMS_XMLGEN.SETCONVERTSPECIALCHARS(ctx,TRUE);
    -- create xml-file:
    xmldoc := DBMS_XMLGEN.getXML(ctx);
    -- put data to host-file:
    vblob_len := DBMS_LOB.getlength(xmldoc);
    DBMS_LOB.READ (xmldoc, vblob_len, 1, vBuffer);
    bHandle := utl_file.fopen(vPATH,vFileName,'W',32767);
    UTL_FILE.put_line(bHandle, vbuffer, FALSE);
    UTL_FILE.fclose(bHandle);
    end ;
    maybe while work UTL_FILE there is a change the encoding ?
    How can this solved ?
    Thank you
    Norbert
    Edited by: astramare on Feb 11, 2009 12:39 PM with database charsets

    Marco,
    I tryed to work with dbms_xslprocessor.clob2file,
    that works good,
    but what is in this matter with encoding UTF-8 ?
    in my understandig, the xmltyp created should be UTF8 (16),
    but when open the xml-file in xmlSpy as UTF-8,
    it is not well ( german caracter like Ä, Ö .. ):
    my dbms is
    NLS_CHARACTERSET = WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET = AL16UTF16
    NLS_RDBMS_VERSION = 10.2.0.1.0
    -- test:
    create table nh_test ( s0 number, s1 varchar2(20) ) ;
    insert into nh_test (select 1,'hallo' from dual );
    insert into nh_test (select 2,'straße' from dual );
    insert into nh_test (select 3,'mäckie' from dual );
    insert into nh_test (select 4,'euro_€' from dual );
    commit;
    select * from nh_test ;
    S0     S1
    1     hallo
    1     hallo
    2     straße
    3     mäckie
    4     euro_€
    declare
    rc sys_refcursor;
    begin
    open rc FOR SELECT * FROM ( SELECT s0,s1 from nh_test );
    dbms_xslprocessor.clob2file( xmltype( rc ).getclobval( ) , 'XML_EXPORT_DIR','my_xml_file.xml');
    end;
    ( its the same when using output with DBMS_XMLDOM.WRITETOFILE )
    open in xmlSpy is:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <S0>1</S0>
    <S1>hallo</S1>
    </ROW>
    <ROW>
    <S0>2</S0>
    <S1>straޥ</S1>
    </ROW>
    <ROW>
    <S0>3</S0>
    <S1>m㢫ie</S1>
    </ROW>
    <ROW>
    <S0>4</S0>
    <S1>euro_€</S1>
    </ROW>
    </ROWSET>
    regards
    Norbert

  • How to get those Char Description when i record please give a solution

    Hi Experts
    when i try to extend using BDC the meterial all data is getting copied to new plant but in MRP3 Configure varients is not getting copied in bdc i am getting all the values from parent plant but these values are not getting displayed in new plant for only *MRP3 Configure varients
    how to get those values please give a solution
    and
    when i am trying to make the BDC recording of creation of meterial in this process
    in MRP3 when i give configurable meterial  = Lamp  or CT or VOLTMETER and when
    i go for configurevariants button it's not displaying any Char Description  for the perticular meterial
    but in general when i creat a material process  there Char Description  are coming where i can give the values
    how to get those Char Description when i record please give a solution

    Hi Maen Anachronos
    i am Getting popup where i can give any value
    but in creation of meterial for a perticular config meterial there is will be 1 templete in which we will get some constant  Char Description where we'll have some options to give the value
    but when it 's done in BDC Recording  it's not displaying any values Char Description then how can we decide the values to what to give when Recording

  • How to get acknowlgmnt from EFT (debt card swap) machine from swing app.

    Hi,
    Please some 1 let me know how to get acknowlegdement from EFT ( debit card Swap) machine once it is connected to the computer.
    I have a code which seems to have no errors ut it I am not sure whether the EFT machine will be able to send or recieve the data once the car is swaped. because i dont know what is the response of the EFT machine when connected to the computer though a java swing class.
    I know it will be quite tidious job for you to go through my program but this is all i can do...or atleast give me a link where i can refer to such case.......I am using eclipe Ide....and have searched alot on google too......

    Vish_1x1 wrote:
    Hi,
    Please some 1 let me know how to get acknowlegdement from EFT ( debit card Swap) machine once it is connected to the computer.What do you mean by "acknowledgement"? You realise it needs some sort of authorising host in order to authorise, right?
    I have a code which seems to have no errors ut it I am not sure whether the EFT machine will be able to send or recieve the data once the car is swaped. because i dont know what is the response of the EFT machine when connected to the computer though a java swing class.Mumbo-jumbo
    I know it will be quite tidious job for you to go through my program but this is all i can do...or atleast give me a link where i can refer to such case.......I am using eclipe Ide....and have searched alot on google too......Where did you get this "EFT machine" (whatever that is)? Do you mean a card reader? An EMV terminal? A PDQ? What? Where did it come from? Start there. If you need to get this thing working, you must be part of an enterprise, which has access to resources such as hardware vendor support, merchant banking services and EFT software vendors. If you're not, then you might as well abandon all hope of using this machine to take cards on your own, because you can't. End of story
    And, no, nothing to do with Java

  • How to get BOOLEAN from STORED FUNCTION

    We are calling legacy PLSQL stored procedures and functions via named queries. This has worked fine so far, but there are some functions which return the type 'BOOLEAN'. e.g.
    FUNCTION some_function( some_argument IN NUMBER) RETURN BOOLEAN;
    Where the return type is BOOLEAN calling the named query fails with
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    A couple of threads have hinted that what we are trying to do is not possible:
    How to get BOOLEAN from STORED PROCEDURES
    Re: Creating Named Query: from OracleCallableStatement
    This would possibly be due to 'restriction in the OCI layer'. Can anyone help? Is there really now way to call a valid PLSQL stored function via a named query when the return type is BOOLEAN?
    thanks

    I can't comment on possible issues you might have with the driver, but if it can be done in JDBC, it should be possible in TopLink.
    TopLink has the StoredFunctionCall which extends the StoredProcedureCall but adds an unnamed ouput parameter in the first spot of its parameter list. You will need to get the databasefield and set its type to BOOLEAN ie:
      DatabaseField returnField = (DatabaseField)yourStoredFunctionCall.getParameters().firstElement();
            returnField.setName(name);
            returnField.setSqlType(Type.BOOLEAN);Be sure not to use the setType() method, as I believe TopLink will try to use the Type.BIT when a boolean class is used as the classtype.
    Best Regards,
    Chris

  • Issue using extractval to get the node value when there is namespace

    I created the db with a XMLType column:
    CREATE TABLE mytable1 (key_column VARCHAR2(10) PRIMARY KEY, xml_column1 XMLType);
    Then inserted one row:
    INSERT INTO mytable1 (key_column,xml_column1) VALUES ('test', XMLType('<MY_TEST xmlns="http://xmlns.oracle.com/ku" version="1.0">
    <SCHEMA>SYSTEM</SCHEMA>
    <NAME>TABLE41</NAME>
    <TEST_GROUP>TEST_GRP_RMP</TEST_GROUP>
    <TEST_NAME>DEPARTTEST</TEST_NAME>
    <FUNCTION_SCHEMA>SYSTEM</FUNCTION_SCHEMA>
    <TEST_FUNCTION>EXCLUDE_TABLE</TEST_FUNCTION>
    <STATEMENT_TYPE_LIST>
    <STATEMENT_TYPE_LIST_ENTRY>
    <NAME>SELECT</NAME>
    </STATEMENT_TYPE_LIST_ENTRY>
    </STATEMENT_TYPE_LIST>
    <UPDATE_CHECK>Y</UPDATE_CHECK>
    <ENABLE>Y</ENABLE>
    <STATIC_POLICY>N</STATIC_POLICY>
    <TEST_TYPE>DBMS_RLS.DYNAMIC</TEST_TYPE>
    <LONG_PREDICATE>N</LONG_PREDICATE>
    </MY_TEST>'));
    Then I ran:
    select extractValue(xml_column1,'MY_TEST/TEST_NAME') policy from mytable1;
    There is nothing returned.
    If i do not have "xmlns="http://xmlns.oracle.com/ku" " in MY_TEST node, then the correct value returned.
    Please advise how could I get the node value when there is namespace? Thanks.

    This is a known issue. In the third parameter of extractvalue, set the namesapce. Then it works.

  • How to get CLOB from stored procedure via StoredProcedureCall

    hi all
    I got "sp" on server : procedure get_text(p_in in varchar2, o_list out clob);
    in code:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("get_text");
    call.addNamedArgumentValue("p_in", new String("MyList"));
    call.addNamedOutputArgument("o_list"); // <- out CLOB
    Vector v = (Vector)this.m_UnitOfWorkt.executeSelectingCall( call ); // <- here I got error
    but if o_list is varchar is all ok
    so how to get data from clob?
    Please help
    Regards
    Krzysztof

    Post Author: achaithanya
    CA Forum: Data Connectivity and SQL
    I'm connecting to database through stored procedure only.We have sybase installed on our local system so that we are given permissions only to access the stored procedures.When u see the fields in CR XI i.e Field explorer you are able to see only 1st result fileds.I connected to sybase and there i'm able to see the output of 1st & 2nd Result set.
    Regards,
    Chaithanya.

Maybe you are looking for