Wish to write Javascript to redirect somewhere if user is NOT logged in...

I need to write a simple Javascript window.location routine to execute if a user comes to my main portal page but is not logged in.
It sounds odd, but the reason for this is that we use IBM's WebSEAL product to provide proxy and authentication - Portal is configured to work with this, but if a user bookmarks the main portal page (after logging in through the WebSEAL URL junction), and then closes the browser, re-opens the browser and tries to go to that bookmark, even though WebSEAL will challenge and authenticate, Portal will not know the user. The reason it works when you go thru the WebSEAL junction name is that we manually have the junction point to Portal's login link - For some reason even though we're authenticated thru WebSEAL, you have to click "login" in Portal to obtain that token. That's cumbersome, so with the direct WebSEAL URL, we do it for them. But the bookmark issue is real.
So basically, in a nutshell, I want to add some Javascript that says:
1. Is there a User logged in to Portal from Portal's perspective?
2. If yes, do nothing
3. If no, redirect to the WebSEAL URL
How would I do that? I can't read any span text or anything because the Login/Logout links do not have name/id parameters... Can I use #PORTAL.USER# inside Javascript?
Thanks!
Rick

There is a package and function available that you might be able to incorporate
in your JSP code to get the user that is currently logged in to Portal.
The following URL provides the reference material
http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1012/wwctx_api.html
The package and function is: wwctx_api.get_user.
Example Dynamc Page:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
<BODY>
<H2>Example of A Dynamic Page</H2>
<ORACLE>declare
theUser varchar2(30) := portal.WWCTX_API.get_user;
begin
if theUser = 'PUBLIC' then
htp.p('<H1>Welcome! Please login.</H1>');
else
htp.p('<H1>Welcome ' || theUser || '</H1>');
end if;
exception
when portal.WWCTX_API.NO_SESSION_EXCEPTION then
htp.p('Error: Session not initiated.');
when others then null;
end;
</ORACLE>
</BODY>
</HTML>
Regards,
Ersan

Similar Messages

  • Javascript URL redirect (setting value) not working

    Hello All,
    Apex 3.1
    I am trying to write javascript that will execute off the click of an icon in a report. It will display a prompt box to the user, and when the user clicks "OK", I would like to re-direct the user to another page, setting the value in the prompt to a page item on the new page. Here is the javascript I'm trying to use:
    <script language="JavaScript" type="text/javascript">
    function copy_prompt()
    var copies=prompt("Number of copies?","1");
    if (copies!=null && copies!="" && copies !="0")
    $s('P6_ITEM_COPY_COUNT',copies);
    redirect('f?p=&APP_ID.:82:&SESSION.::NO:P82_ITEM_COPY_COUNT:&P6_ITEM_COPY_COUNT.')
    </script>
    The problem I'm having is that since session state is not being set, it is passing a null value to the new page. I can see on page 6 the item P6_ITEM_COPY_COUNT is getting set appropriately, but the value is not in session state. Any suggestions?
    Thanks!

    In trying the suggestion, I receive the following error when redirected:
    Error ERR-1002 Unable to find item ID for item "<value in javascript prompt>" in application "103".
    Thanks!
    SOLUTION: I looked at my URL syntax in the redirect statement, and was missing an extra colon (:) before the P82_ITEM_COPY_COUNT. Correct syntax is:
    redirect('f?p=&APP_ID.:82:&SESSION.::NO*::*P82_ITEM_COPY_COUNT:' + copies);
    Edited by: potter_geek on Dec 8, 2009 8:51 AM

  • JSP to write javascript code

    somebody in the net say :
    " You could however have JSP write javascript code when creating
    the page that would set the javascript variables with values
    from your JSP variables. "
    how can we do that ?? can somebody show me a sample code ??

    I really hope this is my last answer to this question.
    Firstly, make clear of the relationship between client side and server side. There is no free lunch at all. Say if you don't want to make another connection to the server from the client side, all you have to do is sent whatever the client is needed to the client side at the very beginning. I believe that should be something really basic to be considered. It is just like, if you don't go out to buy something from the supermarket on your own, nor the supermarket provides any kind of delivery service to you. How can you physically get something you want to buy? This is the same in nature.
    So, your wish is definitely being denied naturally. The only way you can do is, prepare everything on the HTML code for the javascript. Otherwise, make another connection to the server from the client. Don't try to stuck on something which is definitely not possible.

  • How to write javascript in java class method

    Hi,
    any one please resolved this,
    i want to write javascript window closing code into java class method, in that method i want to write javascript code & wanted to call in jsf page on commandButton action event,
    my code is below but it is not working properly
    public void closeWindowClicked(ActionEvent event) {
              try
         FacesContext facesContext = FacesContext.getCurrentInstance();
         String javaScriptText = "window.close();";
         // Add the Javascript to the rendered page's header for immediate execution
         AddResource addResource = AddResourceFactory.getInstance(facesContext);
         addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javaScriptText);
    catch(Exception e)
         System.out.println(""+e);
    for calling into jsf code is below
    <h:commandButton action="#{parentBean.closeWindowClicked}" value="OK" />
    /*Note- i want to closed the window by caling method contain javascript only, i don't want any ajax code in method */
    please any one can resolved this.
    Thanks

    /*Note- i want to closed the window by caling method contain javascript only, i
    don't want any ajax code in method */ When the user presses your button, do your business logic and then send them to a page containing the following (note: untested code ahead):
    <html>
    <head>
        function onLoadHandler()
            window.close();
    </head>
    <body onload="onLoadHandler();">
        <p>Window closing....</p>
    </body>
    </html>

  • Javascript Confirm Redirect

    I am looking to figure out how to do a javascript confirm
    Redirect popup. Can anyone help me out with that? Is there a
    Dreamweaver behavior for that?

    I'm not sure exactly what you mean, but it's easy enough to
    make a popup (to
    open a second sized browser window) by using DW's Open
    Browser Window
    behavior.
    Patty Ayers | www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet
    "joey_a" <[email protected]> wrote in
    message
    news:edbo7j$iea$[email protected]..
    >I am looking to figure out how to do a javascript confirm
    Redirect popup.
    >Can anyone help me out with that? Is there a Dreamweaver
    behavior for that?

  • Is there a site where they will write javascript for your pdfs that you could pay them to do it.

    Is there a site where they will write javascript for your pdfs that you could pay them to do it.

    Hi timothyh,
    Adobe doesn't offer those services, but you might try looking here: Planet PDF - The PDF User Community - Debenu.
    Best,
    Sara

  • Since I can not log in bug report page, not even getting an error message, I'll write all my issues with ios8 here...

    Since I can not log in bug report page, not even getting an error message, I'll write all my issues with ios8 here... I have an iphone 4S and I did the last update. Now I am in trouble.
    1. When I move the "sound on/off" button, I get it buzzing 10 times before the setting is changed and I can do anything else, just not reacting to the round button on screen touches.
    2. Impossible to copy text from most websites into notes.
    3. Impossible to delete an email account in settings.
    4. Uses up the battery twice as fast as before. I have "update apps" setting turned off, just reading a couple of mails, making a couple of photos and open maps apps twice a day, and the battery is dead well before the evening.
    5. Got extremely slow, and it was getting slower and slower with every system update.
    I'm sure I forgot something... But well, that already a lot.

    Well, actually number 3 in my list is not true any more, I just tried to delete my account 15 times, then I've written my post, then half an hour later my Settings finally updated my accounts list. Whohoo
    I did not try restoring it yet, thank you for the link!

  • My Time Capsule expired and no longer works. My printer (a HP) will now not work as it still wishes to connect through the Time Capsule. It will not allow itself be recognised through a USB connection to my Mac. Anyone got any ideas?

    My Time Capsule expired and no longer works. My printer (a HP) will now not work as it still wishes to connect through the Time Capsule. It will not allow itself be recognised through a USB connection to my Mac. Anyone got any ideas?

    You will need to install the printer on your Mac
    Open System Preferences (gear icon) on the dock
    Open Print & Fax
    Click the + (plus) button at the bottom of the printer list
    Wait for your printer to appear in the next box, then click it to highlight it
    Click Add at the lower right
    Be sure to select the correct printer when you try to print as you will see your printer listed twice. Good idea to make the printer now installed on your Mac the default printer so you do not have to choose which printer to use each time you want to print.
    You can also go into Print & Fax, select the printer associated with the Time Capsule and click the - (minus) button if you want to delete that location.

  • Javascript alert script needed when calculation does not equal 100

    I have created a fillable form and have a total box which I've set to calulate the sum of Field1, Field2, Field3 and Field4
    which works well.
    I would like to add a javascript alert if the total amount does not add to exactly 100 to stop the user submitting the form or moving to next question.
    Any help would be greatly appreciated
    Thank you

    Hi try67,
    I have implemented successfully the following:
    event.value = ''; // clear field
    // get the values of field 1 and 2 as string
    var sField1 = this.getField("field 1").value.toString();
    var sField2 = this.getField("field 2").value.toString();
    // adjust for a field being 100 and the other is null
    if (sField1 == 100 & sField2 == '') sField2 = "0";
    if (sField2 == 100 & sField1 == '') sField1 = "0";
    // do only if field 1 and 2 are not null
    if(sField1 != '' & sField2 != '') {
    event.value = Number(sField1) + Number(sField2);
    if (event.value != 100) app.alert("Fields 1 and 2 must sum to 100!", 1, 0);
    } // end not empty
    Just wondered if you can let me know what I need to add to stop the form being submitted(email submit button) if the amount is not 100?
    So the same alert appears ("Fields 1 and 2 must sum to 100!")
    Currently if the fields exceed or are below 100, then the alert message  ("Fields 1 and 2 must sum to 100!")
    appears once and you can still tab to next field, or click on next field or submit the pdf.
    I was hoping to add validation on submitto be similar to required fields where you are alerted if not filled in and cannot submit until you imputted the correct calculation sum up to 100?

  • Why am I getting redirected to the MSN homepage (when logging out of hotmail) with third party cookies not enabled? And why are exceptions to cookies being cleared in private browsing mode?

    I have the latest version of Firefox, I use Private browsing with Allow cookies but not third party cookies. Recently I have begun to be redirected to the MSN homepage after logging out of hotmail and whenever I add MSN cookies to the exceptions in cookies the list gets deleted. Can anyone tell me why, when blocking third party cookies should prevent that?

    Two initial thoughts:
    (1) If you look at the cookie names and content in the View Cookies dialog, are they the ordinary scramble of different names and values, or do they look like "opt-out" cookies? Some security software or add-ons may restore opt-out cookies after you clear them.
    (2) If you have any extensions that make requests to those sites, it's possible they are bypassing private browsing mode, although I would hope not. Hmmm.
    Unfortunately, unlike history where you can see the time that an entry was added, it is difficult to figure out when a cookie was set. But there are many cookie add-ons that might provide insight.
    Alternately, you could go directly to the cookies.sqlite database using the SQLite Manager extension. This is on the nerdy side, but manageable.
    (1) Install SQLite Manager from: https://addons.mozilla.org/firefox/addon/sqlite-manager/
    (2) The extension adds an item to the Tools menu. If you do not normally use the classic menu bar, tap the Alt key to display it temporarily or press Alt+t to pull down the Tools menu.
    SQLite Manager may suggest a particular database, particularly on your second and later uses. You can skip that and it will open a new window.
    (3) On the toolbar (first screen shot), choose the cookies.sqlite database and click Go. This should display the database entries for all your cookies (second screen shot).
    (4) Select the following SQL query text:
    SELECT host AS Site, datetime(creationTime/1000000,'unixepoch') AS Created, datetime(expiry,'unixepoch') AS Expires
    FROM moz_cookies
    ORDER BY creationTime, host
    (5) Click the Execute SQL tab, paste the query, then click Run SQL. You should get a list of sites in order by the date their cookies were set (third screen shot).
    Are the dates all fresh? If they are older, something may be rolling back your cookie clearing.

  • I try to install my creative suite master collection (student version) on my new mac. the point is that when I want to write the product key. The computer does not accept the number 3. so what can I do ?

    I try to install my creative suite master collection (student version) on my new mac. the point is that when I want to write the product key. The computer does not accept the number 3. so what can I do ?

    Can you use the number 3 key elsewhere?
    [topic moved to Downloading, Installing, Setting Up forum]

  • Is it possible for your Mobile Me Account to say you are somewhere where you are not?  Can you tell it to make you appear somewhere else?

    Can you make your Moblie Me Account say you are somewhere where you are not?  Can you tell it where you want it to say you are?
    Thanks

    Sounds like one great relationship.
    With an iPhone that has not been hacked, no.
    Don't know about anything about a hacked iPhone or an illegal app involving this which is against the terms of use for these discussions.

  • "No write authorization for personal portfolio of user" from BW

    Hi, we are working on connection from BW 3.5 InfoBroadcaster into EP 6.
    When I try to publish BW webtemplate to EP to my personal portfolio I got follwoing messages:
    "<i>Settings were started from the BEx Broadcaster  
      Processing for user AC3339, language EN  
       Processing setting  
        No write authorization for personal portfolio of user AC3339 
        File 'ZM_P2P_SCORECARD_ORG_HIER_STAT' Was Successfully Created in the Portal</i>"
    Unfortunatelly, after this I cannot find this report in EP. Can anyone help us with this error?
    Thank you
    Vitaliy

    Did you setup authorizations as described:
    On BW side: You need special authorizations to be able to use information broadcasting. System administrators need authorization object S_RS_ADMWB with the field RSADMWBOBJ = BR_SETTING. Users that precalculate business intelligence content and would like to schedule things require the authorization object S_RS_BCS. To be able to schedule broadcaster jobs in background the authorization to run batch jobs should be granted on BW side. The authorization object is S_BTCH_JOB "Background Processing: Operations on Background Jobs"
    From my own experience:
    On portal side: The users, to which personal folders it is necessary to publish, should exist both in EP and BW (have the same name), be active and have “Business Explorer” role assigned in EP (i.e. "Personal BEx documents" folder in KM should exist for them)

  • Write a SELECT statement in different ways is not the same thing!!!

    Let's take a look
    use AdventureWorks2012
    go
    dbcc freeproccache
    go
    and now select something
    select * from [HumanResources].[vEmployeeDepartmentHistory]
    go
    so, analyzing 'Compiled Plan'
    SELECT usecounts, cacheobjtype, objtype, text
    FROM Sys.dm_exec_cached_plans
    CROSS APPLY sys.dm_exec_sql_text(plan_handle)
    where cacheobjtype = 'Compiled Plan'
    ORDER BY usecounts DESC;
    GO
    and now let's write some SELECT in "fuzzy case"
    dbcc freeproccache
    go
    select * from [HUMANResources].[vEmployeeDepartmentHistory]
    go
    select * from [HumanRESOURCES].[vEmployeeDepartmentHistory]
    go
    select * from [HumanResources].[VEmployeeDepartmentHistory]
    go
    select * from [HumanResources].[vEmployeeDEPARTMENTHistory]
    go
    select * from [HumanResources].[vEmployeeDepartmentHISTORY]
    go
    SELECT * from [HumanResources].[vEmployeeDepartmentHistory]
    go
    select * FROM [HumanResources].[vEmployeeDepartmentHistory]
    go
    and now let's see compiled plans again
    SELECT usecounts, cacheobjtype, objtype, text
    FROM Sys.dm_exec_cached_plans
    CROSS APPLY sys.dm_exec_sql_text(plan_handle)
    where cacheobjtype = 'Compiled Plan'
    ORDER BY usecounts DESC;
    GO
    So, write a SELECT statement in different ways is not the same thing!!!
    Hope it'll be useful
    P.Ceglie

    Yes.  There is little or no query normalization that happens in front of the query plan cache.  It would be a performance tradeoff to parse and normalize the query before matching it to the cached plans.  The benefit of reducing the number
    of plans in the cache probably wouldn't be worth it. 
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Web redirecting issue when users reconnect guest ssid

    We are facing new issue on our controller for Guest SSID. This SSID used for Guest users and it is web base redirected to Aruba CPPM. First time web page redirects to controller virtual IP address and then Aruba CCPM.
    The scenario is as below
    - The user fills the form and gets redirected to a page where there is a login button which is grayed out till the sponsor approves the mail.
    -Once the sponsorer approves the mail, the login is highlighted and user connects to internet. 
    -Issue occurs when the user disconnects and connects to the SSID and tries to login again. There the user is redirected to controller management IP not on virtual IP.
    Controller Make Model:-5508
    IOS Version:- 7.5.102.0

    Well... you should upgrade to v7.6.110.0 as that code is deferred.  I don't know how you have your WLAN setup, is it use open and your using a pre-auth ACL?  Have you also posted in the AirHeads forum for suggestion?
    Post your show wlan <wlan ID>

Maybe you are looking for