Urgent: problem with sharing HttpSession  object between Jsp and servlets.

Hi,
          We are using weblogic 6.0 sp2.
          I m setting a particular object in session in a servlet using
          session.setAttribute() but when i try to retrieve that object using
          session.getAttribute() in a jsp page the value of that object is null. Is
          there any way to configure HttpSession in weblogic so that jsps and servlet
          can share the same session? Or any workaround for this problem.
          Any help in this regard is appreciated.
          Thanks
          -Shree
          

Just a guess, but it sounds like you have cookies turned off and are not
          using encodeURL. Try enabling cookies and see if that solves the problem.
          Also, it is generally good practice to use encodeURL to protect yourself
          from users who disable session cookies.
          Here's how we use encodeURL in our Servlets:
          gotoPage("/jsp/someJSP.jsp");
          private void gotoPage( String address,
          HttpServletRequest request,
          HttpServletResponse response )
          throws ServletException, IOException
          RequestDispatcher dispatcher =
          etServletContext().getRequestDispatcher( response.encodeURL( address ));
          dispatcher.forward( request, response );
          "Shree Unde" <[email protected]> wrote in message
          news:[email protected]..
          > Hi,
          > We are using weblogic 6.0 sp2.
          > I m setting a particular object in session in a servlet using
          > session.setAttribute() but when i try to retrieve that object using
          > session.getAttribute() in a jsp page the value of that object is null. Is
          > there any way to configure HttpSession in weblogic so that jsps and
          servlet
          > can share the same session? Or any workaround for this problem.
          > Any help in this regard is appreciated.
          > Thanks
          > -Shree
          >
          >
          

Similar Messages

  • (UIX XML) Sharing Connection objects between BC4J and custom java.

    If I have a UIX XML page that contains some BC4J application modules, then in the event handler I call [public static EventResult handleMyEventEvent (BajaContext context, Page page, PageEvent event..) ], which in turn calls some java classes I have written that take a java.sql.Connection object and access the database doing some updates/inserts with this Connection object (via JDBC)....HOW CAN I USE THE SAME TRANSACTION AS WAS USED IN THE BC4J APPLICATION MODULE...i.e. CAN I SHARE THE CONNECTION OBJECT BETWEEN BC4J AND MY OWN JAVA CLASSES THAT USE JDBC?
    What are the best ways to share such a transaction?
    Thanks,
    Paul.

    Would it be easier to use a custom method on the bc4j Application module?
    Take this scenario...
    1. User opens UIX XML web page which opens a bc4j App Module..it has a VO based on all employees.
    2. User presses the add button and a new employee is created (using the bc4j App Module).
    (Notice: no commit yet!)
    3. User presses the submit button...fires event REVIEW_SALARY.
    4. This event is 'handled' in the event section of the UML XML...it calls:-
    public static EventResult handleREVIEW_SALARYEvent (BajaContext context, Page page, PageEvent event)...
    5. I now want to call a java class I wrote that computes an employees new salary and updates the employee record with this new salary. This update will fail unless it is part of the same transaction as the one used by the bc4j App Module (that inserted the new employee).
    How best to proceed from here?
    How about having a method on the bc4j App Mod's VO called 'reviewSalary'? Calling this would use the same transaction? I could then call my java class from within the VO's method? However do I still have the same problem in that my java class expects to be passed the connection object?
    The approach you suggested previously seems a touch dangerous....in that these are not 'publically exposed'...and a new release of JDev may break my code.
    Thanks,
    Paul.

  • Difference between jsp and servlets

    Can any body tell me the difference b/w jsp and servlets.
    As i know one difference is to seperate the java code from html. Is there any other difference. please...

    Servlets are a way to run java on a server. They don't necessarily need to be about HTML or even HTTP. You can write servlets that generate images rather than HTML, for example.
    JSP is a way to create servlets that generate HTML. They get translated into servlets (special-purpose servlets). This is sort of glossing over the details -- the power of JSP is that, by being an intersection between HTML and executed Java code, they can provide a way to clearly differentiate between the two.
    That's a way of looking at it anyway.

  • What is the diff between jsp and servlet

    is thr any other difference betwwen jsp and servlet, tht: jsp is automatic generated servlet and jsp has different types of tag, due this we have write less amount of code.any other technically difference between these two?

    As you mentioned JSP automatically gets converted into a Servlet and then compiled. From the server's perspective other than the transformation process, there is no real difference.
    However, in coding there are some minor differences such as additional access to pre-defined variables and different syntax for some minor things such as imports and etc.
    Perhaps somebody else more knowledgeable can fill you in further.
    Hope that was helpful.

  • Choice between JSP and Servlet

    I am new to JSP and Servlet. I know JSP container will convert JSP to servlet
    eventually. But in application development's standpoint, anything can be
    done in servlet can also be done in JSP? Some people told me we can
    use the combination of both in one application.
    My question is in what situation we use JSP alone, servlet alone, or
    combination of both??
    Please advise. Thanks!!

    Use a combination of both.
    Your Web application should have a single servlet that all HTTP requests are POSTed to. All the servlet does is act like a traffic cop: it figures out what the request is, delegates to other objects that do the work, and forward the result to the next JSP, whatever that is. It's called a front controller servlet.
    The JSPs should just be pure dynamic presentation. Everything displayed in the pages should have been generated by the servlet and its helper classes. No database queries, etc. Your JSPs will be a lot better off if you learn JSTL and eliminate all scriptlet code.
    Check out frameworks like Struts.

  • Passing session data between jsp and servlet

    I have a servlet that I pass data to my jsp.
    I do a session.setAtrribute in the servlet. No problem.
    I get the data no problem in the jsp that I call.
    How do I pass this same data to the another servlet?
    I basically have an array of values that I already have in the existing jsp that has been set in session.
    When I call the secondary servlet, I don't have anything in this session variable related to my array.
    Prior to posting to my next servlet, do I need to do another setAttribute inside the jsp to get the data passed to the servlet?
    Thanks.

    Two different things. The encoding adds this to the URL (after the page, before the query string
    ;jsessionid=ABC123 but only if the user isn't using cookies.
    So in your example, you would do this (maybe):
    <%
      String url = response.encodeURL("Servlet");
    %>
      <form name="form1" method="post" action="<%= url %>?cmd=pay"> ... Or some modification.
    So the difference between encodeing and using a post is that
    1) encoding adds the jsessionid to the url string if necessary. It does nothing else
    2) POSTing will send a request to the provided URL via the POST method, including the inputs of the form as parameters to the URL.
    They really don't interact with each other. It is like asking what is the difference between the Color Orange and thr Size Big? They can both be applied to the same thing, or not... and have no real relation to each other.

  • Sharing a session between JSP and a Servlet

    Hello everyone,
    I am currently working on an online catalog. I am attempting to track a user through a group of servlets and JSP's, I create an order object from a java class and using its session scope I reference this in several JSP's.
    I however attempted to use a servlet to retrieve this session using the following code:
                   HttpSession session = request.getSession();
                   Order order = (Order)session.getAttribute("order");
                   Authorization auth = TestPaymentAuthorizer.getAuthorisation( order );
                   order.setAuthorization( auth ); //this causes an error due to a null object
    Can anyone please offer some help on how to use the same session.
    Much Appreciated
    Arnold Oree

    create a session if already does not exist
         HttpSession session = req.getSession(true);
    Put the above statement before using the session .. it should work,
         HttpSession session = req.getSession(true);
    Order order = (Order)session.getAttribute("order");
    Hello everyone,
    I am currently working on an online catalog. I am
    attempting to track a user through a group of servlets
    and JSP's, I create an order object from a java class
    and using its session scope I reference this in
    several JSP's.
    I however attempted to use a servlet to retrieve this
    session using the following code:
                   HttpSession session = request.getSession();
    Order order =
    = (Order)session.getAttribute("order");
    Authorization auth =
    = TestPaymentAuthorizer.getAuthorisation( order );
    order.setAuthorization( auth ); //this causes an
    an error due to a null object
    Can anyone please offer some help on how to use the
    same session.
    Much Appreciated
    Arnold Oree

  • Urgent : Problem with Editable  ALV Grid  for Quantity and Currency Fields

    Hi All,
    I am using Editable ALV Grid display and have quantity and value as editable fields in the display.
    When user changes these values these values are not changing properly .
    For the quantity field the domain is MENG13 with 3 deciamal places and here  if we enter 500 it takes it as 0.500   .
    The same problem is for the currency field. Here the Domain is WERT7 with 3 decimal places.
    Here also it takes last 2 digits after decimal places by default.
    Please advice how to get proper values in this case from ALV editable fields.
    Thanks and Regards
    Harshad
    Edited by: Harshad Rahirkar on Dec 25, 2007 7:39 AM

    for all the currency field , it will display like that only.
    u have to manipulate uin program before displaying.
    if they are giving 500, in program multiply with 100 and move it to table.
    when u are getting from table, divinde and display.
    this is what I am doing.
    Reward if helpfull.

  • (URGENT) problem with JTable: can't catch ENTER and control focus in JTable

    I hava a JTable and a AbstractTableModel.
    Here is what i want to DO.
    When I press the ENTER or TAB I want to set focus to cell wich is 2 position away from the the sell I am editing
    on the same row in the JTable. How can I do this.
    in fact, that is my real question HOW to ?
    When I press the ENTER or TAB in JTABLE I want to tell to JTable which cell to grab the focus

    In the UI is defined the InputMap/ActionMap pair to respond to keys. There is defined an action for ENTER. I have had the same problem, and the only thing that worked for me was to clear the actionMap, and reassign some keys to their original action, and some (e.g. ENTER, TAB) to my actions. This worked. With TAB is harder beacuse i guess it's deeper in the JVM implemented, but after a while i've managed to overwrite that too.

  • Problems with effects being lost between motion and final cut?

    Hi I have an older version of motion, I am editing a video for my course and I have made some motion graphics with some blurs and fades etc (just this kids of effect, nothing else), when they are imported into final cut they disapear all i have is static text or graphics that crawl across the screen...
    Is this a bug?
    If I let software update do its job would these problems go away.
    Just so you know Final cut 5.1.4 and Motion 2.0.1
    thanks in advance if anyone can help.
    Matt

    Great fix....I started a compression to NTSC and it should be done in 3 hours, I will then boot up FCP, chose a 1 minute clip...follow your directions to the T. and compare the results....I did have this solved when I used NTSC 4:3 before; however, when I chose the menu with the mpeg2 codec, I thought that it would be faster....

  • Problems with key figure quantities between ODS and PSA

    We have some key figures which are part of the purchasing transactional load.  The key figure in some cases is showing the correct total value for the ordering unit in the PSA but incorrect in the ODS (there is no transformation logic).  This seems to happen when an ordering unit exists but a base unit of measure does not exist? Has anyone had similar and how to resolve? Thanks

    Hi, thanks for the quick reply. I forgot to mention that. As I wrote before, this percentage is given to us directly in the file that is loaded on the system, but since there were problems when taking away a characteristic from the table, I created a formula which should give us the same data. The formula is Percentage = "Products Sold / Total Products" (I used the Percentage part operator, so it looks like this "Products Sold %A Total Products"). The TOTALS value is validated with the person in charge of giving us the file to load.
    A sample data record:
    DATE--SHOP_ID-DEPT-PRODUCTS-SOLD---PCT.
    20080101--125020--
    40
    Edited by: Pedro Olvera on Aug 1, 2008 12:21 PM

  • Problem with the voice volume between incoming and outgoing calls

    Hi all.
    I have a situation with volume calls.
    1.- When the calls are originated in the PSTN to the IP Phones, the volume is ok in both sites.
    2.- When the calls is originated in the IP Phones to the PSTN, the person in the PSTN listens very low.
    I try to adjust the volume in the voice-port configuration, increasing the input and output db value, but not if I am doing it well or if I need adjust the configuration in other part.
    The router 2801 have a CCME ver 4, this router is connected to PBX with a E1 and the PBX have the PSTN Digital trunks.
    this is the voice router configuration:
    voice-card 0
    dsp services dspfarm
    voice service voip
    allow-connections h323 to h323
    supplementary-service h450.12
    controller E1 0/0/0
    framing NO-CRC4
    line-termination 75-ohm
    ds0-group 0 timeslots 1-12 type e&m-immediate-start dtmf dnis
    description to the PBX
    voice-port 0/0/0:0
    auto-cut-through
    input gain 4
    output attenuation 4
    playout-delay nominal 200
    playout-delay minimum low
    bearer-cap Speech

    Try using a negative value in the output attenuation setting. My understanding is that negative values in the the output attenuation increases the volume out to the PSTN. Make small adjustments as you increase the chance for echo. Positive values decrease the volume.
    Larry

  • Passing parameters between JSP and Servlet

    The scenario is as follows:
    There is a JSP page that sends a string as a hidden parameter to a servlet:
    <input type="hidden" name=<%= Book.NAME %> value=<%= book.getName() %> >
    In the servlet there is a print statement that checks the parameter value:
    System.out.println("Book name: "+request.getParameter(Book.NAME));
    The problem is as follows: if the name of the book consists of more than one word
    such as "Servlets and JSP", the print statement will print only Servlet.
    If the JSP page passes a string directly as shown here:
    <input type="hidden" name="Test" value="Test String" >
    The servlet will print the complete string: Test String
    The same problem appears if the string is passed between two JSP pages.
    Any help is greatly appreciated.
    Regards,
    Basil Mahdi

    You might want to try
    <input type="hidden" name="<%= Book.NAME %>" value="<%=URLEncode.encode(book.getName(), "UTF-8")%>" >This will take care of any wierd un-url friendly charcters that might appear in the book titles such as the ' or " which may be the problem.

  • URL mapping  between jsp and servlet

    recently, I try glassfish, and I get surprised, for example My application name is HelloWorld if I have jsp action to servlet I can't use action ="servlet/myservlet1" I have to use
    action="HelloWorld/myservlet " if I put my servlet2 under test folder I can't call this servlet by servlet/test.servlet2, I have to use HelloWorld/servlet2,. I realize that is not glassfish problem , I just wonder is any one could give more expiration on servlet mapping ??
    Thank you !

    Depends on several factors. In which context and how exactly are you specifying the URL? In client context, the leading "/" brings you to domain root. In servlet context, the leading "/" brings you to context root. The HTML <a> element is relative to client context and JSTL <c:url> is relative to servlet context. That kind of things.

  • My host name changes every few days, since Xmas adding a macbook its changed 6 times. Do I need to stop this? Does it cause problems with sharing between the iMac and macbook?

    my host name changes every few days, since Xmas adding a macbook its changed 6 times. Do I need to stop this? Does it cause problems with sharing between the iMac and macbook?

    There are several possible causes for this problem.
    1. Two (or more) computers on the local network have the same Bonjour name, such as "X's-MacBook-Pro.local".
    2. You have two simultaneous connections to the same local network: probably Ethernet and Wi-Fi. If applicable, disconnect the Ethernet cable or turn off Wi-Fi.
    3. A Mac wakes from sleep due to network traffic. This is due to a bug in OS X that may only affect some models.
    4. A device that gets its network address from the router wakes from sleep, and the address it was using before has been assigned to another device.
    5. A third-party wireless router has incompatible settings or firmware. In that case, refer to the manufacturer or ISP for support. Restarting the router may help, temporarily.
    6. See also this support article.
    Rename the computer in the Sharing preference pane.

Maybe you are looking for

  • How Can I do that the leds of my UIR is blinkin all the time

    Hello I have  a question of CVI, I am modify a UIR and I am add a LEDs in my UIR, I nedded do that these Leds is blinking all the time, but I am having problem for do this. I know that exist 2 functions in CVI SetCtrlVal and GetCtrlVal for Set and Ge

  • A script to pick up song lyrics from the web - feedback

    Below is a PC implementation of this script written by Chris Schull which uses google to grab the lyrics of the selected song in iTunes and add them to the tags for the song. Enjoy Andrew's first go at converting an Applescript to .net for the PC. I

  • Age analysis for stock materials

    I needs to have a z report on age analysis of all the stock materials, the hitch being – they do not have batch mgmt active. Age analysis is needed from a period to a period, e.g. - current quarter.

  • Anti-virus for OS X 10.5.8

    What is the best anti-virus/debugger for OS X 10.5.8? I have always heard you don't need one because Macs are virus free...true?

  • ältere Datei nicht kompatibel mit Premiere Pro CS5?

    Hallo, mein Problem ist folgendes: ich habe ein Projekt mit einer älteren Premiere Pro Version angefertigt und wollte diese mit der CS5 Version öffnen und dran weiterarbeiten. Nun kommt folgende Fehlermeldung: --Dieses Projekt enthält eine Sequenz, d