Topic
8 replies Latest Post - ‏2013-03-26T13:55:35Z by maxmix
SystemAdmin
SystemAdmin
5842 Posts
ACCEPTED ANSWER

Pinned topic SessionContext(wcs)

‏2013-03-22T11:37:36Z |
V datoteki .jps programiram eno stvar. Uporabljam javascript, ki kliče funkcijo v jsp.

Vendar se pa pojavi težava in sicer:

Koda:
SessionContext sessionContext = new SessionContext(wcs);
StartCenterAppBean startcenter = (StartCenterAppBean)sessionContext.getCurrentApp().getAppBean();
psdi.mbo.MboRemote mbo = startcenter.getMbo();
wcs => wcs cannot be resolved

Ve kdo kako rešiti problem?
Updated on 2013-03-26T13:55:35Z at 2013-03-26T13:55:35Z by maxmix
  • SystemAdmin
    SystemAdmin
    5842 Posts
    ACCEPTED ANSWER

    Re: SessionContext(wcs)

    ‏2013-03-22T11:38:11Z  in response to SystemAdmin
    The. JPS programmed one thing. I use javascript to call a function in jsp.

    However, the problem arises as follows:

    code:
    SessionContext sessionContext = new SessionContext (wcs);
    StartCenterAppBean startcenter = (StartCenterAppBean) sessionContext.getCurrentApp (). GetAppBean ();
    psdi.mbo.MboRemote mbo = startcenter.getMbo ();
    wcs => wcs Can not Be resolved

    Does anyone know how to solve the problem?
  • scottsd
    scottsd
    121 Posts
    ACCEPTED ANSWER

    Re: SessionContext(wcs)

    ‏2013-03-22T19:51:14Z  in response to SystemAdmin
    wcs is only available as a variable if you have imported the common/simpleheader header jsp into your component jsp.

    Did you include this in your component jsp?

    <%@ include file="../common/simpleheader.jsp" %>

    Thanks,
    Scott
    • SystemAdmin
      SystemAdmin
      5842 Posts
      ACCEPTED ANSWER

      Re: SessionContext(wcs)

      ‏2013-03-25T06:14:17Z  in response to scottsd
      I have included. Intended problem is when calling jsp from javascript function and cause problems here => SessionContext sessionContext = new SessionContext (wcs);
  • scottsd
    scottsd
    121 Posts
    ACCEPTED ANSWER

    Re: SessionContext(wcs)

    ‏2013-03-25T17:11:26Z  in response to SystemAdmin
    Sorry I'm not clear on what you're trying to do with javascript, is it possible to post your javascript and jsp and more details about your usecase?

    Thanks,
    Scott
    • SystemAdmin
      SystemAdmin
      5842 Posts
      ACCEPTED ANSWER

      Re: SessionContext(wcs)

      ‏2013-03-26T06:22:59Z  in response to scottsd
      I solved the problem. Thanks for the help.
      • maxmix
        maxmix
        83 Posts
        ACCEPTED ANSWER

        Re: SessionContext(wcs)

        ‏2013-03-26T10:45:44Z  in response to SystemAdmin
        Please share your solution, so others can benefit from it.
        • SystemAdmin
          SystemAdmin
          5842 Posts
          ACCEPTED ANSWER

          Re: SessionContext(wcs)

          ‏2013-03-26T11:42:31Z  in response to maxmix
          Call JSP function from JavaScript:
          int x = ('<% = size (wcs)%>');

          JSP function
          <%!
          public int size (WebClientSession wcs) throws java.rmi.RemoteException, MXException
          {
          int st = 0;

          try
          {
          SessionContext sessionContext = new SessionContext (wcs);

          StartCenterAppBean startcenter = (StartCenterAppBean) sessionContext.getCurrentApp().GetAppBean ();
          psdi.mbo.MboRemote mbo = startcenter.getMbo();
          Where String = "status like '% New%'";

          psdi.mbo.MboSetRemote mbo.getMboSet groups = ('$ SR "," SR ", Where);
          groups.count = st ();
          }

          catch (Exception e)
          {
          e.printStackTrace ();
          }

          return st;
          }
          %>
          • maxmix
            maxmix
            83 Posts
            ACCEPTED ANSWER

            Re: SessionContext(wcs)

            ‏2013-03-26T13:55:35Z  in response to SystemAdmin
            thanks, I hope this will help future readers that run into the same issues...