Session in WebDynPro

Hi everyone,
Is it good to use an EJB statefull session to store a value for a specific session ?
Is it possible to use this EJB from a WebDynPro ?
Maybe using an EJB is to much heavy...is there another way ?

public java.lang.String Put_Lang_in_Session(String value )
    //@@begin Put_Lang_in_Session()
     IMaintainScope maintainer = Utils.getScopeMaintainer( WDScopeType.CLIENTSESSION_SCOPE );
     IScope scope = maintainer.getScope( );
     String _key = new String( value );
     scope.put( "Lang", _key);
//     final IMaintainScope maintainer = Utils.getScopeMaintainer( WDScopeType.CLIENTSESSION_SCOPE );
//     final IScope scope = maintainer.getScope( );
//     scope.put( _key, _object);
     return _key;
    //@@end
  public java.lang.String Get_Lang_from_Session( )
    //@@begin Get_Lang_from_Session()
     IMaintainScope maintainer = Utils.getScopeMaintainer( WDScopeType.CLIENTSESSION_SCOPE );
     IScope scope = maintainer.getScope( );
    String var_session = new String();
    try{
          var_session = scope.get("Lang").toString();
    catch(Exception e){
          var_session = e.toString();
    return var_session;
    //@@end

Similar Messages

  • How to track session in Webdynpro Java application

    Hi All,
    How to get the session reference of any Webdynpro Java Application . My purpose is that thr is one WD application is getting launched , now if suppose user didn't perform any action on it and session for that application got expired . After the session got expired i have to update the table with the status . So to track that i need the session reference of WD application which i m looking for .
    How could i get the same . Kindly help me on this .
    Thanks & Regards,
    Mitul.

    Hi ,
    HttpSession session = request.getSession(false); //get the current session, if there is no session yet, return null
    if (session == null) //forward to first page
    else //do normal work
    Then u can update ur session right ,
    Regards ,
    Venkat

  • Global object visible for all sessions in WebDynpro application

    Hello everybody,
    in a normal java web application you have the possibility
    to put an object into the servlet context.
    This object is visible for all sessions(e.g. some configurations or global settings for the
    web application).
    Now my question:
    Is there a possibility in a WebDynpro application to put such an object into a "global context" visible for all sessions?
    So I am looking for a container in WebDynpro which has
    the same behaviour like the servlet context in a web application.
    Thank you for your ideas an suggestions.
    Greetings
    Anton

    Hi Anton,
    To make an Variable Global ,you have define variable at various levels based on Usage.
    1)Ex: If you want to define Variable between two different Components . when A component is embedded into B Component then you have to define at Component Interface level and Mapping has to be Defined.
    2) If you want to make Variable to be used within the component among the Iviews ,then you can define at Component Controller or Custom Controller and Mapping has to be defined at Iview Level.
    3) If you want to use Variable between two Webdynpro Iviews then you have define the eventing mechanism to pass the values among the EP Webdynpro Iviews.
    Hope this answer helps you.
    Thanks
    Madhan

  • ITS sessions in WebDynpro JAVA

    Hi experts
    We are developing a WebDynpro JAVA application in WAS7.0.
    In one view, we show a ITS page into iframe object. When open this page, in SAP transaction SM04 is showed the ITS session, but when we navigate back, to other page, or close navigator, the ITS remains open in SAP.
    If we open the ITS page directly in navigator and close them, the ITS session disapears in SM04.
    Any idea to solve this?
    Thx for advice

    Hi
    httpwatch is a tiny utility that allows us to monitor the http requests .
    you can get it here.
    www.httpwatch.com
    Using this you will be able to understand when the Sessions are being logged off
    in both of your scenarios.
    Regards
    Rajendra

  • Portal doesnot kill session for Webdynpro appliaction?

    hi
    I have a webdynpro appliaction which doesnot open in portal Content but in new Window.I have 2 scenario:
    1.User logs off the portal
    2.User just closes browser on which portal is running.
    Scenario 1:
    if user click on my Webdynpro application it opens in new Window ,now he minimize the browser window in which the Webdynpro appliaction is running.And then logs off from the Portal.In this scenario my Webdynpro session is killed by the Portal.
    Scenario 2:
    if user click on my Webdynpro application it opens in new Window ,now he minimize the browser window in which the Webdynpro appliaction is running.And simply closes browser on which portal is running.In this case portal doesnot kill the session of my Webdynpro application and user can do the transcation using the Webdynpro application.
    I want this 2nd Scenario to be solved.Please help me out.
    Regards
    Nidhideep

    Hi,
    The portal session stays alive as long as the logoff is not done in the portal. Since you are saying log off in the scenario 1, it is killing all sessions connected with the portal. You can check the properties of log off in this <a href="http://help.sap.com/saphelp_nw04/helpdata/en/38/5dc53e5ae84d3be10000000a11405a/frameset.htm">url</a>.
    Next, in the scenario 2, the portal session keeps working as long as it times out.
    In order to close the session you can change the java script code in the log off component of the portal.
    You can import the login par (\usr\sap\Instance id\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\deployment\pcd)and edit the logoff page jsp accordingly.
    Again export and deploy the edited login project and create a new par file.
    Now paste this par as the default one in the same location with the name (com.sap.portal.runtime.logon.par.bak)
    Regards,
    Sujana

  • How to track the login user session in webdynpro

    Hi all,
            I have a new requirement as Explained below
    User will login from portal with login username and password.
    I want to retive that information.
    How to keep track of that information in webdynpro
    Thanks & Regards
    Padma N

    Hi Padma,
    First you need to add the security.jar file by following the given steps
    Right Click on Project-Propertyjava Build PathLibrariesWDRuntime
    Com.sap.security_2.0.0
    public void LoginUser( )
        //@@begin LoginUser()
         String LogonID;
           try{
              // create an user object from the current user
              IWDClientUser wdUser=WDClientUser.getCurrentUser();
              IUser user=wdUser.getSAPUser();
              //LogonID=user.getUniqueName();
              wdComponentAPI.getMessageManager().reportSuccess(user.getFirstName()" "user.getLastName().toUpperCase());
              //wdComponentAPI.getMessageManager().reportSuccess(LogonID.toUpperCase());
              wdComponentAPI.getMessageManager().reportSuccess("Logon User ID : "+wdUser.getClientUserID().toUpperCase());
           }catch(Exception e){
              e.printStackTrace();
        //@@end
    Thanks
    Anup

  • How WebDynpro/JCO do the session management?

    Hi expert,
    Current we have one R3 system as our backend system, we would like to extend it via Webdynpro java and JCO in the frontend, but we don't know how java do the session management with backend R3 system?
    For  example, user logon in the frontend and connect to R3 via JCO, after once calling, I would like to store somthing in R3 system so that the second calling of this user can reuse it to save time and improve performance, would it be possible to do it via JCO?
    Thanks.

    Ya,
    Have a look at following threads.
    Maintaining caching for a user session in webdynpro
    <b>- Chintan</b>

  • How to store complex data in session object

    Hi All,
            I have a requirement like this, I have to store some complex data(like some object) in webdynpro session object.
    I know that i can store some string value in session by using wdScopeUtil and is it possible to store some complex data like(object ot object array).
    See i have some ContryTO[] object which contains countrycode and value i have to store this Array object in session.How can I solve this problem,i am strucked regarding this pls help me regarding this issue.
    Regards,
    saleem

    Bala,
    Go thru this link. It may be useful to you.
    Maintaining caching for a user session in webdynpro
    List elementList = new ArrayList();
    // set values to your list.
    IMaintainScope maintainer = Utils.getScopeMaintainer(WDScopeType.APPLICATION_SCOPE);
    maintainer.getScope().put("list",elementList);
    List elementList1 = (List)maintainer.getScope().get("list");
    Regards,
    Sridhar

  • Blackberry issues with WebDynpro application

    We are testing a webdynpro application via a blackberry. The webdynpro application works fine from IE.  With the blackberry, we see the following:
    - User logs into the application. After user's first access attempt, they no longer have to log in. We even turn off the Blackberry and restart. The same issue occurs.
    - User executes a line item transaction in the Blackberry. This item executes fine.  However, we get a communication error on the next lineitem.
    Is there Blackberry Browser and/or Blackberry server settings that need to be applied to allow the sessions and WebDynpro communication to work properly?

    Hi Stephen,
    I'm working on creating Blackberry application for online Purchase requisition Approval process, using PR workflow.
    Workflow configurations have been done in ECC.
    can u guide me how to get "Approve/ Reject" option on the BB device?

  • WDScopeUtil - Session value clears soon problem

    Hi Experts,
    We are trying to set some value in session using Webdynpro, but its getting cleared after sometime. We are setting the Value in one WD application and using it in all other WD application.
    The method used to put and get is given below.
    Is there any other method which can be used so that the session value stays.
    Setting the Value using:
    WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE, "APP_NAME", appvalue1);
    Getting the Value from session:
    WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE, "BP_ID");
    Thanks

    Hi Mohamed,
    Could try the HttpSession method  instead of your session method.
    This is the set method,
          HttpServletRequest request = ((IWebContextAdapter).wDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
          HttpSession session = request.getSession(true);
         session.setAttribute("XXX","Test1");
    and this one is get method,
    String getString = "";
    HttpSession session = wdContext.currentSessionElement().getHttpSession();
    getString = session.getAttribute("XXX").toString();
    Regards,
    Prabha

  • Web Services Session /Singleton cluster environment

    Hi!
    I am having trouble figuring out how to do sessions in web services.
    I am trying to build an app that uses multiple GUI's in different languages (not java) and we want to implement our business layer with web services.
    I need a session to save user settings, and user info so that I can avoid going to the database and ldap in every call.
    So far my idea is to have a web service that deals with the authentication. If the user is valid, the web service will save in a singleton that has hashmap the user setting and return to the client the hashmap key as a token.
    The client has the responsibility to save the token and to use it in later calls.
    The problem that I have is that a singleton would not work in a cluster environment! And I really don't want to be passing all the user information between calls
    Any ideas how can I solve this???

    Hi Gaurav,
    Yes, the currently running session will be taken care of by the another server node which is up and running.
    Your question: Does this mean that the a session of WebDynpro application will continue to work or the changes are lost and the user needs to login again?
    "The state of the session is maintained in the persistent storage after the last successfully ended request." Which means that for example a user was filling up a form and haven't saved the changes and the server crashes then the data on that form will be lost when the second server node starts processing the request. But if the user had saved the data before the server crashes that state of the session will be stored and the data of the form will be saved and user need not fill it up again. If the Server crashes in between the HTTP request session then the request is assinged to the another server node to generate the response. In none of the case user needs to login again.
    Your question: Fundamentally the question is what WebDynpro uses behind the scenes for maintaining session?
    It uses Java Serialization to serialize the HTTP Sessions
    "Serialization involves saving the current state of an object to a stream, and restoring an equivalent object from that stream. The stream functions as a container for the object. The information stored in the container can later be used to construct an equivalent object containing the same data as the original."
    Edited by: Aishwarya Sharma on Oct 7, 2008 8:07 AM

  • Web DynPro - HttpServletResponse object equivalent

    All,
    I was just wondering what is the equivalent of HTTPServletResponse object in Web DynPro.
    Any ideas...........
    Thanks in Advance
    JJ

    Hi JJ,
    first, welcome on the SDN forum!
    About your question:
    There is no direct equivalent. Be aware that the WD rendering is up to the WD runtime, and the client can, but does not have to be a web browser. So presenting WD within a browser is only one possibility (even the one most time used), and for that the response object in general is encapsulated.
    Anyhow, you have the possibility to reach the underlying HTTP objects, see for example Session in WebDynPro or Portal request object. or Portal Session Object in WebDynpro
    Hope it helps
    Detlev
    PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!

  • Error while Look up session bean (EJB 3.0) in WebDynpro

    hi ,
                 I want to look up session bean inside webdynpro. I hv written following code inside init of component controller. but not able to look up session bean
    try{
                   InitialContext context = new InitialContext();
                   ApplicationFetcherLocal applicationFetcherLocal = null;
                 applicationFetcherLocal = (ApplicationFetcherLocal)context.lookup((ApplicationFetcherLocal.class.getName());
              catch (Exception ex){
                   System.err.println("LookUp Failed\n\n"+ex.getMessage());

    Have you read my latest reply in your other [thread|session bean look up  across DCs in EJB3.0;?
    What's the value of asking the same question again if you don't care about the answer?
    Regards,
    -- Vladimir

  • Session time out in EP & webdynpro

    Hi can any body tell me how to control webdynpro session & portal session?
    I have created a webdynpro application & integrated in EP. I want to control the session time out for my application because if i run my application in Ep & the session time is out, i need to refresh my dynpro application.
    I want to control this session time out.
    Thanks,
    Siva

    Hi siva..
    Chk this link..
    Tabstrip: navigate with buttons instead of tabs
    Regards,
    GS

  • Timeout Session - Expiration time of Webdynpro application

    Hello,
    I set the sap.expirationTime property of my application to 1 hour,  know the expiration time of my application is one hour. After time out (one hour) I am getting default 500 internal server error page. But as per the requirement we need to display a custom message instead of 500 internal server Error.
    i.e.need to Redirect to Custom page with custom message instead of 500 internal server error page.
    i try to follow as per this link [Timeout of a WebDynpro session;
    but found that in NW 7.0 the parameter sap.sessionExpiredURL is not available anymore. How can archive this?
    Conclusion: If there is a timeout session, instead of 500 internal error page how to display a custom messages?
    Thanks & Regards
    Maha
    Edited by: Maha Hussain on Feb 10, 2009 12:00 PM

    Hi Maha,
                 With sap.expirationTime property, the application will certainly be expired.
    If your requirement suits for the scenario just try out the following workaround.
    If you want show a custom message only, you can use TimedTrigger UI Element instead of setting expirationTime just set dealy for this and in the action kust navigate to the view and displaye the custom message in that.
    Regards,
    Siva

Maybe you are looking for