How to use Cookies in Web DynPro?

Hello,
Is there a way to use Cookies in Web DynPro like a regular Servlet uses in it's response Object?
If yes, I could use a code example...
Roy

Hi Roy,
1. This will create a Request Objec containing all the client's request just like in a regular Servlet or does it have special considerations I should worry about?
A: If you have portal and webdynpro components, both have to use the same runtime. If you are using only webdynpro components then you can use the "Task" class. But it is a non-standard API.
Task.getCurrentTask().getWebContextAdapter().getHttpServletRequest()
2. Where do you recommend putting this statement? I assume at the wdDoInit() method right?
A: Don't put this statement in the doInit(), if you are handling some event within the component and refreshes the view, your doInit() will not get executed.
3. Is there a Response object I can create as well?
A:
HttpServletResponse response =((com.sap.tc.webdynpro.services.sal.adapter.core.IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletResponse()
Regards,
Santhosh.C

Similar Messages

  • How to use ALV  in web dynpro for ABAP?

    Hi,
    I am new to web dynpro. Now I want to create a table using ALV to display. I have no idea how to use it.
    I only know I need to add the SALV_WD_TABLE for component usage. Can anyone give me some hints
    or step-by-step procedure?
    Thanks.
    Awards will be provided.
    Best Regards,
    Chris Gu

    Hi,
    Please go thru this set of [tutuorials|https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/webcontent/uuid/60ea94e5-0901-0010-c3bb-aad5ea9620d8].
    Its really good for ALV.
    I also used this as I am also new to WD ABAP.
    Revert back with issues.
    Regards,
    Sumit

  • How to use multilanguage in web dynpro

    Hi experts,
    I want to use multilanguage feasility in my Web Dynpro application.
    It means, several language option are available in my application,
    if user click any option from the list of option, then application's contains will changed  to the corresponding language selection.
    How can i achive this? can any one help me?
    Advance thanks,
    P.J.Balaji

    Hi Balaji..
    Check this ..
    These links are abt internationalization...
    http://help.sap.com/saphelp_nw04/helpdata/en/2d/e7381138a8d2458f1f4fac32614f71/content.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/8e/7ce87a2aede645ae3cdc857b791590/content.htm
    https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#59
    /people/karin.schattka/blog/2007/03/12/new-web-dynpro-java-tutorial-and-sample-list
    /people/prashant.patalay/blog/2006/12/20/internationalization--i18n-of-webdynpro-java-application
    This will help u.
    Urs GS

  • How to use JSP in Web Dynpro

    Hi
         I want to use JSP and servlet pages in my web dynpro application
    how can we add the JSP pages in web dynpro aaplication or how can I achive this functionality?
    Thanks
    Ninad

    Hi,
    Have a look at this thread,
    Re: web dynpro jsp
    Regards,
    Saravanan K

  • How to use JDI with Web Dynpro

    Can any one help me with detailed steps on how to put my Webdynpro development components into JDI?
    We are already done with the development work. Now we have JDI installed and want to source safe the project in JDI.
    So, my requirement is only to put them in JDI, to be able to check-in and check-out any future changes and use the JDI to deploy the applications into QA and production systems . No team development or anything.
    For this case, which of the 3 tutorials ( Team oriented development, Development with track, Development with layers) given in help.sap.com will be ideal?
    Please help.

    Hi Aditya,
    Step for creating Webdynpro:
    1. Open Development Configuration Perspective in NWDS. In the “Local DCs” view, right-click on “Local Development” and choose “Import
    Configuration…”
    2. Login remote with your username and password. It will create development infrastructure in Inactive DCs. There you can create the component like webdynpro, Java, J2EE, Enterprise Portal, etc.
    3. Creating Webdynpro in the DTR perspective.
    Step 1: Right click on Inactive DCs -> Create new DC.
    1. By default vendor name is SAP. You can change vendor name according to your requirements.
    2. create a new Web Dynpro DC with desired name.
    Name should not exceed eight characters (Recommended)
    create a new Web Dynpro DC with desired name.
    3. Select the language
    4. Select the domain
    5. Select the component type
    3. Copy the file structure from your existing local project to DC.. These will be under an activity..
    Step 2:
      1. Build and Deploy and test your new DC.If it works fine then in DC perspective..Right click on src folder->add subtree ->create activity.
    See this thread discussing about how to migrate local project to JDI..
    How to migrate local Web DynPro projects into the DTR?
    Regards
    Suresh KB

  • How to Use BAPI in Web dynpro?

    Hi SDN,
    I am trying to use BAPI_FLIGHT_GETLIST in my web dypro application but my result table doesn't showing any data.
    can you please tell me the reason behind this?
    Regards,
    Rahul

    hi rahul.........
             steps to be followed:
                Right click on your component and click create->service call.
                give the bapi name you want to access.
                give the rfc destination name..
                if you have all the rights, then whatever name you give, an rfc destination will be created automatically.
                 otherwise you have to specify an already existing rfc destination name.
                 in your view you create input fields for binding the importing parameters.
                 bind the changing parameters to your table.
                 <b>make sure you call the method which will calls the bapi</b> either when you initialize your window or have a button and call the method, inside its action.
                 <b>embed your view to the window</b>.
    note:
             the method and the respective codings would be automatically generated when you created your service call.
    ---regards,
       alex b justin.

  • How to use Archivelink in Web dynpro?

    I want to add some upload and download function on my website.How should I  realize these functions?How to built some connection between an database's attribute and an Archivelink file?

    Hi,
    see <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/09/a5884121a41c09e10000000a155106/frameset.htm">FileDownload</a> and <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/b3/be7941601b1d09e10000000a155106/frameset.htm">FileUpload</a>
    Regards, Heidi

  • How to use BREAD CRUMB / WEB DYNPRO

    Hello Experts......
         My requirement is.. i have certain task numbers which will be displayed as multiple links ( i used multilple links option in BREAD CRUMB to display them ). When i click on each task number i must get some data from ztable (like Person Responsible for RS,UTD..... )  and displayed under the task number.
         Iam successfull in displaying my task numbers as :
    101>102>104>.............. but iam not able to code to get data displayed for the task number (when clicked on it).
         Plz ... can any one help me out with sample code.. or some examples...on BREAD CRUMB

    hi sandhya.......
              when the bread crumb is clicked, read the attribute that is bound to the bread crumb.... and get values accordingly.
    ---regards,
       alex b justin

  • Using EJBs in Web Dynpro

    I have recently started to develop Web applications using the Web Dynpro framework. Coming from a pure J2EE world, I must admit that Web Dynpro has a few innovative features that I find interesting for user interface development. The use of component & view contexts, for example, is not unlike the ActionForms that one may find in a Struts application, but pushed a bit further. No complaints here.
    What I do have some problems with is the whole CommandBean paradigm that is put forth by SAP (refer to the document <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/using%20ejbs%20in%20web%20dynpro%20applications.pdf">Using EJBs in Web Dynpro</a>).
    I do understand the usefulness of defining a model that will be used to generate and eventually bind to Context data structures. That's fine. What I do object to is the use of a so-called CommandBean to play that role. Again, coming from a J2EE world, I am familiar with the BusinessDelegate pattern - which would typically be used by a client application to invoke business logic on the server side. I would propose that a better, cleaner way of integrating EJBs with the Web Dynpro framework would be to use a BusinessDelegate for invoking business logic, and importing a separate and distinct ModelBean (instead of a CommandBean) to be used for defining and binding to Context data.
    I have built one Web Dynpro application thus far. Instead of using a CommandBean, I created a ModelBean that extends my business object DTO (Data Transfer Object) (which is quite appropriate for that role, given that it implements all the get & set methods that are required for the business data that I need to model). My Web Dynpro application also makes use of an independant BusinessDelegate that is packaged with my EJB DC - this is a standard best practice on J2EE projects. I have been asked by the people working with me to modify this architecture to bring it more in line with the SAP way of doing things. I am open-minded and willing to learn and accept new ways of thinking and doing things. However, I fail to understand the usefulness of merging structure and behaviour by resorting to CommandBeans:
    - <b>It violates the MVC paradigm</b> by having one object (the CommandBean) serve as both model AND controller as far as the Web Dynpro application is concerned. The CommandBean is obviously a model - since it is literally imported as such into the Web Dynpro application. It is ALSO a controller from the Web Dynpro's application perspective, since all calls to the back-end go thru the CommandBean via one or more of its execute_xxx methods. In contrast, the use of a business delegate by the Web Dynpro application clearly separates the model (the CommandBean... or rather, a more suitably named ModelBean) from the controller (BusinessDelegate).
    - <b>Doesn't carry its own weight.</b> In other words, I haven't yet been provided with any valid justification for going thru the extra effort of coding the CommandBean's execute methods. It's been proposed to me that it somehow serves as an abstraction layer between the Web Dynpro application and the business logic. I would argue that it is the BusinessDelegate's role to abstract away the back-end logic from clients. If one does have a BusinessDelegate available, I would argue there's no need to code execute methods in a separate CommandBean. To prove my point, I would simply point out that all of the CommandBean examples that I have seen so far, either in How-To documents, or in production code, all follow the same pattern....
               CommandBean.execute_doSomething() calls BusinessDelegate.doSomething()
    Not a heck of an "abstraction" layer... I would in fact argue that it is worse than useless. If some major change occurs in the business logic that requires changing the doSomething() operation, we expect of course to modify the BusinessDelegate. The Web Dynpro client will also presumably need to be modified - that's to be expected, and unavoidable. But then, we'll also need to go about and change the CommandBean's execute_doSomething() method - again, extra work for no apparent benefit. Adding and removing business methods has the same implication. All this for an layer that simply adds the prefix execute_ in front of all business method calls... Is this "abstraction layer" worth the cost of creating and maintaining it ??
    - <b>Unnecessarily complicates error handling</b>. I have been told that for technical reasons, it is recommended that all exceptions thrown by the CommandBean be of type WDException or WDRuntimException. But what if the client application needs to react differently to different failure scenarios ? When I create a business object, I might wish to provide the user with an error messages if connection is lost to the backend, and with a different error message if an object already exists in the database with the same attributes. In order to do that, I will have to catch the WDException, extract the cause, and continue processing from there... possible, yes, but clearly less standard and more labor intensive than the classical try/catch mechanism.
    To say nothing about the fact that SAP's own API documentation clearly states that applications using Web Dynpro can reference and catch WDExceptions, but THEY MUST NOT THROW OR EXTEND IT !
    - <b>Produces unnecessary DCs</b>. Page 6 of the aforementioned document presents an architectural view of a Web Dynpro project that uses a CommandBean. Why an extra DC for the CommandBean ?? I created my ModelBean class right inside the Web Dynpro project (in the Package view). That, to me, is where this class should reside, because it is created for no other reason that to be used by this particular Web Dynpro application. What is the benefit of placing it in its own independant DC ?
    - <b>Not a typical application of the Command pattern</b>. The well-documented command pattern (Design Patterns - Gang of Four) has been devised mainly to enable encapsulation of request as objects, thereby making it possible to:
    - specify, queue and execute requests at different times
    - decouple execution of a command from its invoker
    - support undo operations
    - support logging changes so that they can be reapplied in case of system crash making it possible to assemble commands into composite commands (macros), thereby structuring a system around high-level operations built on primitive operations.
    None of this applies to the way the SAP CommandBeans are being used. Not that much of an issue to people new to J2EE and/or OO development... but quite confusing for those already familiar with the classic Command pattern.
    At this point, I fail to understand the advantage of merging structure (model) and behaviour (execute methods) through the use of a unique CommandBean object. Am I missing something ?

    Thanks for your reply and your suggestion. I have posted in the Web Dynpro Java forum... and suggest those wishing to participate in this thread to refer to the Web Dynpro Java forum.
    As for your answer, I'm afraid it doesn't satisfy me.
    Reuse is hardly an issue, since the CommandBean is specifically tailor-made for the Web Dynpro application that needs to use it. I could hardly imagine building another application that would just happen to have the exact same needs as far as data structure and processing is concerned...
    As for the right Eclipse environment... the CommandBean is not an EJB artifact - it is an EJB client. The aforementioned tutorial in fact suggests creating it in the Java perspective.
    But thanks anyway for your time and suggestion

  • Using EJBs in Web Dynpro Applications

    I have recently started to develop Web applications using the Web Dynpro framework. Coming from a pure J2EE world, I must admit that Web Dynpro has a few innovative features that I find interesting for user interface development. The use of component & view contexts, for example, is not unlike the ActionForms that one may find in a Struts application, but pushed a bit further. No complaints here.
    What I do have some problems with is the whole CommandBean paradigm that is put forth by SAP (refer to the document <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/using%20ejbs%20in%20web%20dynpro%20applications.pdf">Using EJBs in Web Dynpro Applications</a>).
    I do understand the usefulness of defining a model that will be used to generate and eventually bind to Context data structures. That's fine. What I do object to is the use of a so-called CommandBean to play that role. Again, coming from a J2EE world, I am familiar with the BusinessDelegate pattern - which would typically be used by a client application to invoke business logic on the server side. I would propose that a better, cleaner way of integrating EJBs with the Web Dynpro framework would be to use a BusinessDelegate for invoking business logic, and importing a separate and distinct ModelBean (instead of a CommandBean) to be used for defining and binding to Context data.
    I have built one Web Dynpro application thus far. Instead of using a CommandBean, I created a ModelBean that extends my business object DTO (Data Transfer Object) (which is quite appropriate for that role, given that it implements all the get & set methods that are required for the business data that I need to model). My Web Dynpro application also makes use of an independant BusinessDelegate that is packaged with my EJB DC - this is a standard best practice on J2EE projects. I have been asked by the people working with me to modify this architecture to bring it more in line with the SAP way of doing things. I am open-minded and willing to learn and accept new ways of thinking and doing things. However, I fail to understand the usefulness of merging structure and behaviour by resorting to CommandBeans:
    - <b>It violates the MVC paradigm</b> by having one object (the CommandBean) serve as both model AND controller as far as the Web Dynpro application is concerned. The CommandBean is obviously a model - since it is literally imported as such into the Web Dynpro application. It is ALSO a controller from the Web Dynpro's application perspective, since all calls to the back-end go thru the CommandBean via one or more of its execute_xxx methods. In contrast, the use of a business delegate by the Web Dynpro application clearly separates the model (the CommandBean... or rather, a more suitably named ModelBean) from the controller (BusinessDelegate).
    - <b>Doesn't carry its own weight</b>. In other words, I haven't yet been provided with any valid justification for going thru the extra effort of coding the CommandBean's execute methods. It's been proposed to me that it somehow serves as an abstraction layer between the Web Dynpro application and the business logic. I would argue that it is the BusinessDelegate's role to abstract away the back-end logic from clients. If one does have a BusinessDelegate available, I would argue there's no need to code execute methods in a separate CommandBean. To prove my point, I would simply point out that all of the CommandBean examples that I have seen so far, either in How-To documents, or in production code, all follow the same pattern....
    CommandBean.execute_doSomething() calls BusinessDelegate.doSomething()
    Not a heck of an "abstraction" layer... I would in fact argue that it is worse than useless. If some major change occurs in the business logic that requires changing the doSomething() operation, we expect of course to modify the BusinessDelegate. The Web Dynpro client will also presumably need to be modified - that's to be expected, and unavoidable. But then, we'll also need to go about and change the CommandBean's execute_doSomething() method - again, extra work for no apparent benefit. Adding and removing business methods has the same implication. All this for an layer that simply adds the prefix execute_ in front of all business method calls... Is this "abstraction layer" worth the cost of creating and maintaining it ??
    - <b>Unnecessarily complicates error handling</b>. I have been told that for technical reasons, it is recommended that all exceptions thrown by the CommandBean be of type WDException or WDRuntimException. But what if the client application needs to react differently to different failure scenarios ? When I create a business object, I might wish to provide the user with an error messages if connection is lost to the backend, and with a different error message if an object already exists in the database with the same attributes. In order to do that, I will have to catch the WDException, extract the cause, and continue processing from there... possible, yes, but clearly less standard and more labor intensive than the classical try/catch mechanism.
    To say nothing about the fact that SAP's own API documentation clearly states that applications using Web Dynpro can reference and catch WDExceptions, but THEY MUST NOT THROW OR EXTEND IT !
    - <b>Produces unnecessary DCs</b>. Page 6 of the aforementioned document presents an architectural view of a Web Dynpro project that uses a CommandBean. Why an extra DC for the CommandBean ?? I created my ModelBean class right inside the Web Dynpro project (in the Package view). That, to me, is where this class should reside, because it is created for no other reason that to be used by this particular Web Dynpro application. What is the benefit of placing it in its own independant DC ?
    - <b>Not a typical application of the Command pattern</b>. The well-documented command pattern (Design Patterns - Gang of Four) has been devised mainly to enable encapsulation of request as objects, thereby making it possible to:
    - specify, queue and execute requests at different times
    - decouple execution of a command from its invoker
    - support undo operations
    - support logging changes so that they can be reapplied in case of system crash making it possible to assemble commands into composite commands (macros), thereby structuring a system around high-level operations built on primitive operations.
    None of this applies to the way the SAP CommandBeans are being used. Not that much of an issue to people new to J2EE and/or OO development... but quite confusing for those already familiar with the classic Command pattern.
    At this point, I fail to understand the advantage of merging structure (model) and behaviour (execute methods) through the use of a unique CommandBean object. Am I missing something ?

    Hi Romeo,
    You would be disappointed, this reply ain't anywhere nearby to what you are talking about...
    I wanted to mail you, but you have not mentioned your email in your profile.
    I am really impressed by your flair for writing. It would be far better had you written a blog on this topic. Believe me, it would really be better. There is a much wider audience waiting out there to read your views rather than on the forums. This is what I believe. To top it, you would be rewarded for writing something like this from SDN. On the blogs too, people can comment and all, difference being there you would be rewarded by SDN, here people who reply to you would be rewarded by you. Doesn't make  much a difference.
    Anyways the ball is still in your court
    As far as I am concerned, it has still not been much time since I have started working on Web Dynpro. So can't really comment on the issue...
    Bye
    Ankur

  • How to use cookies in jsp

    Hi all,
    I'm new to jsp, please let me know how to use cookies with jsp.
    I have three web applications, in run time I have to switch from one application to another application based on single login page. I have taught cookies are one of the solution. But while I'm googling I unable to get such a good material.
    please give some examples,
    Thanks in advance.
    achchayya

    Read a cookie in jsp
    HttpSession session = request.getSession();
    Cookie cookie_session = getCookie(request, "COOKIENAME");
              if (cookie_session == null) {
                   sesID = session.getId();
              } else {
                   sesID = cookie_session.getValue();
              }or
    get all cookie in the browser
    This gets all the cookies and according to the cookie name given u can get the cookie value
    Cookie[] cookies = request.getCookies();
              if (cookies != null) {
                   for (int i = 0; i < cookies.length; i++) {
                        if (cookies.getName().equals(cookieName))
                             return cookies[i];
                   }but i am not sure if this works for ur requirement try and see                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How MVC related to ABAP Web Dynpro?

    Hi
    I am a java guy....Can you please explain me how MVC related to ABAP Web Dynpro. In java we have views, controllers and model..but in web dynpro abap i didnt find any model and they are writting all the businness logic in view only. They are not using any component controller as well.
    Can any one please explain me this...
    Thanks & Regards
    Ravi shankar B

    Hi
      Webdynpro is not a complete MVC pattern stuff , but it has also a controller and views.Views are to be completely out of the business logic  but webdynpro allows us to put business logic inside the views.
      Controller and Windows acts as the Controller in the MVC pattern
    Thanks
    Anzy

  • Using CSS for Web dynpro application in EP

    Hi,
    I have some CSS (Style sheets) which I need to apply to the portal, so that all the web dynpro applications can have the same look and feel.
    I read something about Theme Editor in EP. Can I somehow use that to import the CSS contents into the EP theme?
    Any pointer to using CSS for Web Dynpro applications will be appreciated.
    Thanks.
    Puneet

    Hi,
    Go thorugh the follwing Web Dynpro Java
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/nw04stack09themes.zip
    To know how to use it and for the steps to be followed please follow the tutorial here
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/how to edit web dynpro themes.pdf
    the last url gives you a step by step procedure with wizards..
    Regards,
    RK

  • How is EP linked to Web Dynpro

    Hi boss,
    Am new to Web Dynpro willing to train in Web Dynpro, and would like to know how is EP linked to Web Dynpro. When i complete my course how should i market my self as Web Dynpro expert or EP  with Web Dynpro.
    Please guide me,......Thank's in advance
    Points will be rewarded.
    Thank you...

    Hi Ajay,
    Webdynpro is SAP  Programming model to develope  web Based Application.
    EP is a FrontEnd tool for Netweaver to display integrated information.
    The information displayed in EP may be from R/3, non R/3, Database,WEb Applicatins.
    To Display such  information in EP we are using some development tools.
    In Short Webdynpro is an Enterprise Portal development tool which can fetch
      R/3 data,non R/3 data.
    You will be integrate your webdynpro application in EP by creating SAP Webdynpro iView.
    Of Course thr are lot of EP development Tools are available such asWebdynpro Java, Web Dynpro ABAP,Visual Composer,PDK. etc.
    Using Model Concept in webdynpro you can fetch the data from
      R/3.
    Webdynpro Java needs Basic Java Knowledge and ABAP needs Basic ABAP.
    To be am expert ,Familiar with these Links,
          https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a282c952-0801-0010-1eb5-87953e036712
    You can start with tutorials and all. There are around six tutorials in SDN library.
    Web Dynpro for ABAP
    http://help.sap.com/saphelp_erp2005/helpdata/en/a5/1a1e3e7181b60ae10000000a114084/frameset.htm
    best tutorials in wbdynpro for ABAP to start with :
    https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/webcontent/uuid/fed073e5-0901-0010-4eb4-c9882aac7b11 [original link is broken]
    Have a look at the following SDN WDA Wiki . There you can find all relevant information.
    https://wiki.sdn.sap.com/wiki/display/WDABAP/Main
    Regards,
    <b>Ramganesan K</b>

  • What is Digital Signature, How to use it in web based applications?

    I am new to digital signatures. Any body can help me how to create a digital signature and how to use it in web based applications. Do we need certificates to use digital signatures?

    <link_farm_and_everything_else_removed_by_moderator>
    Edited by: Julius Bussche on Sep 3, 2008 8:59 AM

Maybe you are looking for