Use of Contains

Hello ....
I am using forms and using one field for user to input data ... depending on this data , i need to fetch the records ...
Enter Info :- Computer science in Aurangabad
Now, i need to search the info which contains any of this words....
my select statement...
select id from data
where contains(info , 'Aurangabad | computer | science ')> 0
This is working Fine ....
But i need to do this runtime .... i.e for any input ....
so , how should i construct the where contains clause....
is there any other way of doing this .... or i should use substr to first seprate the words....
Thanks..

You can replace each ' ' with ' | ' either before passing the variable or after, as shown below. You may also need to remove any leading trailing or double spaces.
select id from data
where contains (info, REPLACE (:entered_info, ' ', ' | ')) > 0;

Similar Messages

  • In bpm(abstract message used in container)

    hi expects,
    for what purpose we are using abstract message in container).

    Hey Rohit,
    To give an exact picture of  the use of container variables you can refer them as direction less interfaces.
    When we Create Message Interfaces We define <b>Category</b> (Inbound, Outbound, Abstract) , <b>Mode</b> (Synchronous , Assynchronous).
    <b>Inbound</b> refers to Incoming message to the XI server.
    <b>Outbound</b> refers to Outgoing Message from XI server
    <b>Abstract:</b>
    When the concept of integration process comes into picture it has to refer to interfaces defined in its own s/w component version. It can only refer to Abstract interfaces as they are direction less and when used in integration process they are assigned direction dynamically. EX: if you have a defined a container variable XYZ  which refers to some abstract interface ABC and call this XYZ container variable in in receieve step of the int pro then it can as inbound.
    For further clarification please refer <a href="http://help.sap.com/saphelp_nw04/helpdata/en/78/62373f58502e48e10000000a114084/content.htm">Defining Data Process  in Containers</a>
    Hope itz clear.
    Cheers,
    *Raj*
    *Reward Point If Found  Usefull*

  • How to get custom PF status in ALV using cl_salv_table (Using  a container)

    I created a screen and inside that a container.I tried for an ALV display using CL_SALV_TABLE in the cvontainer. It's working. when I opted for default PF status.It's working. But when I tried for custom PF status using SET_SCREEN_STATUS method, it's throwing some exception. But it's working if I don't use a container .
    In both the cases I copied PF status into my program from some standard program.Then added some functionality.

    I f you are using Screen and container use CLass:
    CL_GUI_ALV_CONTAINER
    CL_GUI_ALV_GRID
    METHOD-->SET_TABLE_FOR_FIRST_DISPLAY    " to display Alv.
    Create PF-STATUS in PBO of screen.
    [Change standard PF|https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/change%252balv%252bstandard%252btoolbar%252band%252brespond%252bit]
    EXCLUDE Certain buttons on standard toolbar:
    DATA: lt_exclude TYPE ui_functions,
          ls_exclude TYPE ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_sum.
      APPEND ls_exclude TO lt_exclude.
      CLEAR ls_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_filter.
      APPEND ls_exclude TO lt_exclude.
      CLEAR ls_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_sum.
      APPEND ls_exclude TO lt_exclude.
    pass lt_exclude to METHOD-->SET_TABLE_FOR_FIRST_DISPLAY
    Regards,
    Gurpreet

  • How to display 3 alv with top-of-page using splitter container

    Hi,
    I want to display 3 different alv in a single container corresponding to the 3 check boxes on selection screen.
    i.e.
    If user selects 1 check box only one alv should be displayed, if 2 checkboxes selected by user 2 alv should be displayed and same for 3.
    I cannot use 3 different containers bcoz if second checkbox is not selected then that place remains blank. So I am using single container and using splitter container dividing it into the no of rows corresponding to the no. of checkboxs selected by user.
    Now I also want to display top-of-page for each alv. Please guide me how to achieve this.
    Thanks & regards,
    Harshada

    create with some IF_ELSE conditions as i have done below. in my case the same things are required. if error table is there only then it will be displayed, else only output will be displayed.
    * First Main Container
      CREATE OBJECT obj_main1
        EXPORTING
          container_name = 'CC_CONTAINER'
          style          = cl_gui_custom_container=>ws_maximizebox.
    * create top-document
      CREATE OBJECT obj_dyndoc_id
        EXPORTING
          style = 'ALV_GRID'.
      IF pr_view EQ c_x OR pr_stat EQ c_x.
    * First Splitter Container
        CREATE OBJECT obj_splitter1
          EXPORTING
            parent  = obj_main1
            rows    = 2
            columns = 1.
    * Place obj_parent_html in First row First column
    * for Top_of_page
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 1
            column    = 1
          RECEIVING
            container = obj_parent_html.
    * Place obj_container1 in Second row First column
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 2
            column    = 1
          RECEIVING
            container = obj_container1.
    * Set the height of Top of page
        CALL METHOD obj_splitter1->set_row_height
          EXPORTING
            id     = 1
            height = 24.
      ELSEIF pr_email EQ c_x.
    * First Splitter Container
        CREATE OBJECT obj_splitter1
          EXPORTING
            parent  = obj_main1
            rows    = 3
            columns = 1.
    * Place obj_parent_html in First row First column
    * for Top_of_page
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 1
            column    = 1
          RECEIVING
            container = obj_parent_html.
    * Place obj_container1 in First row First column
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 2
            column    = 1
          RECEIVING
            container = obj_container1.
    * Place obj_container2 in Second row First column
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 3
            column    = 1
          RECEIVING
            container = obj_container2.
    * Set the height of Top of page
        CALL METHOD obj_splitter1->set_row_height
          EXPORTING
            id     = 1
            height = 24.
      ENDIF.
    Please note there is no need to create a hEADER in the container, but create it for the 1st table only which is always displayed
    ags.
    Edited by: ags on Nov 4, 2009 4:49 PM
    Edited by: ags on Nov 4, 2009 4:50 PM

  • "HttpParam is undefined" JS error when using dynamic container in portal

    I am using dynamic container tag "*dc:container*" within an iterator in a pageflow portlet & I'm sending different parameter in each iteration, it worked well in IE7, but in FireFox, some of the rows were rendered & for the rest I received the following exception:
    DynamicContentXmlHttpServlet: Error dispatching request to requested action: '/src/com/loadFriendRatePlan'.
    java.lang.NullPointerException
         at com.bea.apps.groupspace.servlets.DynamicContentXmlHttpServlet.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
         at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
         at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
         at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
         at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
         at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
         at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
         at selfcare.portal.shared.web.security.sso.ClearTrustPreAuthenticatedProcessingFilter.doFilterHttp(ClearTrustPreAuthenticatedProcessingFilter.java:132)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
         at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    Note: every time i refresh the page different rows are rendered, which means that the non rendered rows have nothing to do with the parameter sent in each iteration.
    I've added the portlet to portal, & now nothing is rendered in both IE7 & FireFox, & "HttpParam is undefined" JavaScript error is displayed in both browsers.
    Note : my portlet "Async Content rendering" property is set to ajax, & the portal "Asynchronous Model" property to enabled.
    <h3>Here's sample of my tag code:</h3>
    <dc:executeContainerAction action="loadFriendRatePlan" dcContainerId="${container.index}"
         var="ratePlan"/>           
    <dc:container dcContainerId="${container.index}">     
         <dc:containerActionScript action="loadFriendRatePlan" initial="true"
              onErrorCallback="displayMessageNotAvailable">
              <dc:containerActionParam name="friendAccount" value="${container.item.accountNumber}"/>
              <dc:containerActionParam name="friendContractType" value="${container.item.contractType}"/>                         
         </dc:containerActionScript>
    </dc:container>
    <script type="text/javascript">
         ${ratePlan}
    </script>
    Any clue how can I solve both errors?

    Just so there is a record of this on the Adobe site...
    IF you are running Apache and have virtual hosts, be sure to add the line
    Alias /CFIDE "c:/inetpub/wwwroot/CFIDE"
    to the virtual host list. Of course change the path c:/inetpub/wwwroot/CFIDE" to whatever is set up in the CF Administrator.
    Otherwise, none of your cfform stuff will work properly, AJAX will croak,  and you will get a 'Coldfusion' is undefined error.

  • How to do Finder Search using Name Contains in 10.8.2

    I just purchased a MacBook Pro with 10.8.2 installed.  I used Migration Assistant to move my account from my old MacBook Pro which was running 10.7.8. On my old MacBook, a search for a file in a finder window dropped down to let you select "name contains", so you could type in just a bit of the filename to find a file.  On my new MacBook, when I do the same thing, all I get is "name matches", which is much less useful.  How do I get back to being able to use "name contains" or maybe even other options like "name starts with"??

    As OS X Mountain Lion is registered to your Apple ID, you have to install the OS X version that came with your Mac or Mac OS X Snow Leopard, so he will be able to purchase Mountain Lion from the App Store.
    To do it, just follow these specs:
    1. Back up the data you need.
    2. Insert the Snow Leopard DVD and press C key while your Mac is starting to start from the disc.
    3. Go to Utilities menu > Disk Utility, select the hard disk at the top of the sidebar, go to Erase tab and erase the disc.
    4. Close Disk Utility and reinstall Mac OS X. When the installation has finished, press the mouse while your Mac is starting to eject the DVD, and turn off the Mac.
    You could also give him the Mac with Mountain Lion, but as he's using a different Apple ID, it's not legal and he could have problems if he needs to reinstall OS X, because the Mac won't allow him to reinstall it

  • Can I use Docking container in Subscreen

    Hi Friends,
       I have used Docking container in subscreen,its instance is getting created ,but i am unable to view it .
    So,can I use docking container in Subscreen?

    Hi Bujji,
    here is the code is have used for creating docking container.
    pls,check it once
      IF ref_members_container IS INITIAL.
        lt_fldcat = ref_matrix->mt_sxxx_keys.
        CREATE OBJECT ref_members_container
          EXPORTING
          PARENT                      =
          REPID                       =
            dynnr                       = c_screen-new_member
            side                        = lc_dock_side
          extension                   = 300
          lifetime                    = 1  " Life time screen
            ratio                       = '95'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            others                      = 6.
        CREATE OBJECT ref_members_grid
          EXPORTING
            i_parent          = ref_members_container
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            others            = 5.
        ls_layout-zebra = c_true.
        ls_layout-sel_mode = 'A'.   " Multiple Selection
        CALL METHOD ref_members_grid->set_table_for_first_display
          EXPORTING
       I_BYPASSING_BUFFER            =
       I_BUFFER_ACTIVE               =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
            is_layout                  = ls_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
          CHANGING
            it_outtab                = <lt_keys>
            it_fieldcatalog          = lt_fldcat
       IT_SORT                       =
       IT_FILTER                     =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
      ELSE.
        CALL METHOD ref_members_grid->tables_display_refresh
          CHANGING
            it_outtab = <lt_keys>.
      ENDIF.

  • Using Layout container

    Hi,
    Can anyone tell me steps for using layout container after drag n drop of layout contained i am unable to arrange chat and analysis table over the Layout container.
    Thanks Aman

    Also my problem is that when editing the rows and columns properties of the Container Layout there are no values (apart from default) in the drop down for SUBORIDNATE WEB ITEM property.
    I have added the CHART web item and ANALYSIS web item into the Container Layout, but I don't get the option for subordinate web items. So how do I do this?
    aman

  • How we can use Business Contained Variable

    Hi All,
    I want to use Business Contained Variables which is already using in other BW report, can any body tell me navigation Part.
    Thanks & regards
    Premansh Gupta

    Hi,
    you said that the same variable is already being used in other queries?
    where are you searching for variable list?
    after opening the Query,find the characteristic in the left window (from dimension tree) and expend it and expand 'charateristic value variables'..here you will find all the variables associated with the char.
    what is the characteristic? and whats the variable you are looking for?

  • Restrict resizing while using Docking Container

    All,
    How can we restrict the resizing the docking container with class GL_CUI_DOCKING_CONTAINER. Currently it is displaying in full screen. but donot want user to resize the SCREEN.
    create object g_docking_container
        exporting
          repid     = g_repid
          dynnr     = '300'
          extension = 99999
          side      = cl_gui_docking_container=>dock_at_right.

    Hi,
    Don't know how to do this for docking container but you can use splitter container instead and remove the option for resizing it.
    r_split_container->set_row_sash( id    = 1
                                               type  = me->r_split_container->type_movable
                                               value = me->r_split_container->false ).
    Regards
    Marcin

  • Setup Cluster using Solaris Container data service

    We have a two-node cluster that we would like to use to create either a zone cluster or use the Solaris Container data service that would create a scalable (or multiple master) data service of two zones, one on each node. We have an app running in the zone, CiscoWorks, that has a local database of jobs that are scheduled to run to configure Cisco switches. I was curious how we setup the storage. If each zone is running on local disks, how do the zones stay in sync and the database updated with job information? Would I setup a device group of the disks where the zones will reside on each node? Can I use SAN as the local disk so the zones can be replicated to a Disaster Recovery location?
    Thanks for any help,
    Chuck

    Chuck,
    Sadly, I think I'm going to make your implementation decisions a lot more complicated because there are three ways you can use zones within Solaris Cluster.
    1. Create a failover zone using the HA Solaris Container Data Service. Here the zone root moves between the cluster nodes as the zone fails over.
    2. Create static zones between with resource groups can migrate. Each zone root is local the the physical node. However, the configuration of the zones can be subtly different.
    3. Create a virtual cluster using static zones within which resource groups can migrate. Each zone root is local the the physical node. However, the configuration of the zones are forced to be the same.
    Note also, that a ZFS zpool can only be mounted on one node or zone at anyone time, although it can be mounted read/write in one zone and read-only in other zones on the same node (IIRC).
    I would be inclined to put your database into an HA configuration, i.e. one that runs on one node at any one time. I would then constrain that in a zone cluster that is bound to a project with restricted resources, i.e. CPUs and memory. Any other tiers of the application, could then be placed either in the global zone (main cluster) or placed in another zone cluster and equally constrained.
    I don't know if that's any help. I can recommend a good book on the subject <shameless plug "Oracle Solaris Cluster Essentials"/>. The example chapters should be of help.
    Regards,
    Tim
    ---

  • Using Standard Container Variables in Email Alerts from BPM

    Dear All
    While creating alert categories from ALRTCATDEF we have a Long Text Tab where we can use Container  Variables like  SXMS_MSG_GUID ,SXMS_RULE_NAME, SXMS_ERROR_CAT , SXMS_ERROR_CODE etc create the mail contents.  We can also display the message passed by the BPM by using the variable
    ALERTDYNAMIC_SHORTTEXT , ALERTDYNAMIC_LONGTEXT .
    In my case when I call the alert category from the BPM , the message passed by the BPM is displayed through the ALERTDYNAMIC_LONGTEXT in the alert inbox , but I am not able to utilize the other container variables (like SXMS_MSG_GUID ,SXMS_RULE_NAME, SXMS_ERROR_CAT ) for displaying the messageid ,error category etc. Using these variables for alerts invoked from BPM results in Blank Values for all the container variables.
    If the alert is not invoked from BPM these variables are getting populated.
    My question is is there a way by which we can utilize these variables for Alerts thrown from BPM.
    regards
    Nilesh .

    hi check the below links for reference:
    http://help.sap.com/saphelp_nw04/helpdata/en/d0/d4b54020c6792ae10000000a155106/content.htm
    http://rant03.ranffm.de:50000/rwb_mdt/detailsservlet?objectName=name=is.00.rant03,type=XIIntegrationServer&rwb=true&XIDomain=domain.00.rant03&archive=false&selectMessage=%SXMS_MSG_GUID%
    note:reward points if solution found helpfull.....
    regards
    chandrakanth.k

  • Problem using multiline container in Alert Category

    Hello, experts!
    Could you please suggest me how to solve the following issue.
    I have userdefined multiline container MY_CONTAINER with two elements FIELD (stores name of field) and VALUE (stores value of field). This container is filled in runtime by means of BADI extension. So in transaction ALRTDISP filled container looks like:
      MY_CONTAINER
          MY_CONTAINER[1]
              FIELD    SystemCode
              VALUE    42
          MY_CONTAINER[2]
              FIELD    Key
              VALUE    0292383728232
          MY_CONTAINER[3]
              FIELD    State
              VALUE    1
          ...and so on. Number of filled elements of container is unknown.
    I need to add the contents of this container to Long text of Alert Category in form of:
          SystemCode: 42
          Key: 0292383728232
          State: 1
    ...and so on.
    I added MY_CONTAINER on the Containers tab of my alert category. And in Long text included the following expression:
          &MY_CONTAINER[].FIELD[]&: &MY_CONTAINER[].VALUE[]&.
    But in long text it looks like:
          SystemCode Key State ...: 42 0292383728232 1 ...
    If the expression is like
          &MY_CONTAINER[].FIELD& - &MY_CONTAINER[].VALUE&
    then long text contains only the first element:
          SystemCode: 42.
    Does anybody know how to solve this problem?
    I think I need to use expressions (something like FOR-loop) for filling Long Text in Alert Categories. Is it possible?
    BR,
    Vika

    Hi Experts,
    still trying to work out but couldn't understand the behaviour.
    <b>If the Long text :</b>
    Error: &SXMS_ERROR_CODE& <b>of category &SXMS_ERROR_CAT&</b> was found in a message &SXMS_MSG_GUID& from the service &SXMS_FROM_SERVICE&  <b>and  Interface &SXMS_FROM_INTERFACE&</b>
    to test I am running the program <b>RSALERTTEST</b>
    <b>Msg got thru E-mail is </b>
    Error:  and category:<b> &SXMS_ERROR_CAT&</b> was found in a message  from the service  and Interface
    <b>
    And when I change the Long text</b>
    Error: &SXMS_ERROR_CODE& <b>and &SXMS_ERROR_CAT&</b> was found in a message &SXMS_MSG_GUID& from the service &SXMS_FROM_SERVICE& and Interface &SXMS_FROM_INTERFACE&
    After running the program <b>RSALERTTEST</b>
    <b>
    E-mail msg</b>
    Error:  and was found in a message  from the service  and Interface <b>&SXMS_FROM_INTERFACE&</b>
    coudn't able to understand why it is displaying the container variable as is in the mail.
    checked all the Alert Framework configuration, Everything looks good.
    Thank you,
    <b>MK</b>

  • Link Webi Report to External URL using URL contained in Dim Object

    I am trying to create a link in my WebI report to an external URL which is stored in a Dimension object.
    The object is simply a string format which contains a link to a Lotus Notes database
    Example:
    Notes:///CA2573920000079B/0B4D8972EDD5DE7CCA257109000682B7/32250ACFEAF2B80FCA2573AB00831255
    When I put the link into Internet Explorer I get the appropriate Lotus Notes databse, however, when trying the same in WebI using the following formula:
    ="<a href=[Notes url1] target='_blank'>Test</a>"
    I get the following URL when clicking the link from InfoView
    http://auyhoz04.an.orica.net:8080/businessobjects/enterprise115/desktoplaunch/viewers/cdz_adv/[Notes%20url1]
    If I hardcode the URL into WebI
    ="<a href='Notes:///CA2573920000079B/0B4D8972EDD5DE7CCA257109000682B7/32250ACFEAF2B80FCA2573AB00831255' target='_blank'>Test</a>"
    It works without a problem.
    I'm sure I'm missing something simple...is anyone able to help?

    Nathan,
    When you build a URL on the fly it requires a certain way to encapsulate everything.  Here is another way for you to try it:
    ="<a href="+Char(34)+[Notes url1]+" target='_blank'>Test"+Char(34)+"</a>"
    Plz note the use of Char(34) which generates a double-quote.  This method should help you with getting a dynamic product delivered to your audience.
    Thanks,
    John

  • Using a container to load several swf files and play them

    I need some help. I want to use several swf files and have them be called upon in a container file and play them in sequence. It's a presentation that needs to play thru but still have the ability to stop, click on items, open a popup and then continue on in the presentation. I am building all the individual "chapters" and their "sub-chapters" as swf files, with the hope that I can load them in order. I am relatively new to AS3. Help?

    If you will be loading swf files into a container then you will use the Loader class to accomplish that, so give that a looking over in the help documents and see what you can do.  If you have a problem getting it to work, post your code and describe what you have done.

  • Using j_security_check container authentication with JSF

    Hi All,
    After quite a bit of looking around, we resorted to using a plain login JSP page with a ServletFilter on j_security_check to have container managed authentication in our JSF based web-site using IBM Websphere 5.1
    So, basically every other page but the login page is JSF and just the login page is simple JSP with j_username & j_password.
    Recently, I started looking in the direction of trying to directly/programmatically invoke j_security_check using URLConnection object. There are various discussions on this on google groups:
    1. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1a2768da559e43ae/243982a33f02ab80?q=URLConnection%20j_security_check&_done=/groups?q=URLConnection%20j_security_check&hl=en&lr=&sa=N&tab=wg&&_doneTitle=Back%20to%20Search&d=&
    2. http://groups-beta.google.com/group/weblogic.developer.interest.security/browse_thread/thread/a375370efec24566/b81dc8320bcbc304?q=URLConnection+j_security_check&_done=%2Fgroups%3Fq%3DURLConnection+j_security_check%26hl%3Den%26lr%3D%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Search&&d#b81dc8320bcbc304
    My current code snippet is as follows:     public String submit(){
              String retVal = "";
              String j_username = getUserId().getValue().toString();
              String j_password = getPassword().getValue().toString();
              ExternalContext externalContext = getFacesContext().getExternalContext();
              String jsessionid = ((HttpSession)externalContext.getSession(false)).getId();          
              // Only if sanity checks and validations on j_username & j_password pass, proceed further.
              ApplicationParameter.getLogger().debug("Current jsessionid=" + jsessionid);
              ApplicationParameter.getLogger().debug("submitting login details (userId: " + j_username + " & password: " + j_password + ") to /j_security_check ...");
              try {
                   URL jSecurityCheckURL = new URL("http://localhost:9080/raweb/j_security_check;jsessionid=0000" + jsessionid + ":-1&j_username=" + j_username + "&j_password" + j_password);
                   HttpURLConnection jSecurityCheckURLConnection = (HttpURLConnection)jSecurityCheckURL.openConnection();
                   jSecurityCheckURLConnection.setRequestMethod("POST");
                   jSecurityCheckURLConnection.setInstanceFollowRedirects(false);
    //               jSecurityCheckURLConnection.addRequestProperty("j_username", j_username);
    //               jSecurityCheckURLConnection.addRequestProperty("j_password", j_password);
    //               jSecurityCheckURLConnection.setRequestProperty("j_username", j_username);
    //               jSecurityCheckURLConnection.setRequestProperty("j_password", j_password);
                   jSecurityCheckURLConnection.connect();
                   ApplicationParameter.getLogger().debug("j_security_check returned: " + jSecurityCheckURLConnection.getResponseCode() + ": " + jSecurityCheckURLConnection.getResponseCode());
                   if (null != externalContext) {
                        String remoteUser = externalContext.getRemoteUser();
                        ApplicationParameter.getLogger().debug("Authenticated username: " + remoteUser);
                        HttpServletRequest httpServletRequest = (HttpServletRequest)externalContext.getRequest();
                        Principal principal = httpServletRequest.getUserPrincipal();
                        if (null != principal) {
                             String userName = principal.getName();
                             ApplicationParameter.getLogger().debug("Authenticated username: " + userName);
                   } else {
                        ApplicationParameter.getLogger().debug("Unable to obtain Faces ExternalContext and hence the remote user details.");
              } catch (MalformedURLException ex) {
                   ApplicationParameter.getLogger().error(ex);
                   retVal = "";
              } catch (IOException ex) {
                   ApplicationParameter.getLogger().error(ex);
                   retVal = "";
              return retVal;
    The above code yields the following output:[DEBUG]: (Newlogin.submit:81) - Current jsessionid=H1QMk3TuyW_W8nSPnOtW-xi
    [DEBUG]: (Newlogin.submit:82) - submitting login details (userId: skhanna & password: password) to /j_security_check ...
    [DEBUG]: (Newlogin.submit:93) - j_security_check returned: 302: 302
    [DEBUG]: (Newlogin.submit:97) - Authenticated username: null
    Anyone have any idea why j_security_check returns 302 and also the authenticated username seems to be null indicating that the authentication did not go through!
    -Sandeep Khanna

    Can you help me!
    I try this for two days....
    Tomcat 5.0.27
    I get this:
    Current jsessionid=00F61ABF316F9A1676A41A1EA05177B2
    Submitting login details (userId: admin & password: admin) to /j_security_check!
    java.net.ConnectException: Connection refused: connect
    I have this code in backing bean:
    import java.net.HttpURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.security.Principal;
    import javax.faces.context.ExternalContext;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpSession;
    public String commandButton_action()
    String retVal = "";
    String j_username = inputText1.getValue().toString();
    String j_password = this.inputSecret1.getValue().toString();
    URL jSecurityCheckURL = null;
    HttpURLConnection jSecurityCheckURLConnection = null;
    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    String jsessionid = ((HttpSession)externalContext.getSession(false)).getId();
    System.out.println("Current jsessionid=" + jsessionid);
    System.out.println("Submitting login details (userId: " + j_username + " & password: " + j_password + ") to /j_security_check!");
    try {
    jSecurityCheckURL = new URL("http://localhost:9080/raweb/j_security_check;jsessionid=0000" + jsessionid + ":-1&j_username=" + j_username + "&j_password=" + j_password);
    jSecurityCheckURLConnection = (HttpURLConnection)jSecurityCheckURL.openConnection();
    jSecurityCheckURLConnection.setRequestMethod("POST");
    jSecurityCheckURLConnection.setInstanceFollowRedirects(false);
    jSecurityCheckURLConnection.connect();
    System.out.println("j_security_check returned: " + jSecurityCheckURLConnection.getResponseCode());
    //System.out.println("Current jsessionid=" + jsessionid);
    if (null != externalContext) {
    String remoteUser = externalContext.getRemoteUser();
    System.out.println("Authenticated username: " + remoteUser);
    HttpServletRequest httpServletRequest = (HttpServletRequest)externalContext.getRequest();
    Principal principal = httpServletRequest.getUserPrincipal();
    if (null != principal) {
    String userName = principal.getName();
    System.out.println("Authenticated username: " + userName);
    } else {
    System.out.println("Unable to obtain Faces ExternalContext and hence the remote user details.");
    catch (MalformedURLException ex) {
    System.out.println(ex);
    jSecurityCheckURL = null;
    jSecurityCheckURLConnection = null;
    retVal = "";
    catch (IOException ex) {
    System.out.println(ex);
    jSecurityCheckURL = null;
    jSecurityCheckURLConnection = null;
    retVal = "";
    return retVal;
    I try all this URL:
    http://localhost:8080/jSecurityCheck/j_security_check?jsessionid=" + jsessionid + "&j_username=" + j_username + "&j_password=" + j_password
    http://localhost:9080/raweb/j_security_check;jsessionid=0000" + jsessionid + ":-1&j_username=" + j_username + "&j_password=" + j_password
    TWO DAYS ..... H E L P M E !!!

Maybe you are looking for

  • Is there any function module? Fiscal week no problem

    Hi friends, I want how to get physical week for given date. Ie for 01-04-2009 week no is 1. Is there any function module? Pls suggest Regards Moosa

  • Error: Cannot display Gantt chart in PWA 2010

    Hi, With a brand new instance of Project Web App 2010, I cannot display any project Gantt Chart: "Error: cannot display this view". NB: on the client Win 7 PC, there are several versions of  MS Office installed: 2003; 2007, 2010. I was told that this

  • Integration Process and Action

    Hi everyone, Can some one explain about why do we need to create Action and Integration Process in ESR and use this Integration Process in Configuration Scenario.what's the use of creating this?

  • Vista compatability ?

    I am having trouble with videos i put on my vista computer,they will not play smoothly,the picture quality is ok but it jumps on playback every second or so.It is totally unwatchable. A friend has windows 7 and he says it works fine on that. Any sugg

  • Cisco phones won't power up

    I have cisco 6945 phones connected to two Catalyst 6513-E switches in a VSS pair. This morning, 3 phones went offline on one of the blades on switch two (they went dark). When I do a show module, everything checks out fine --no errors on the blade. D