How the hell does a person share session data between JSP page and a Servle

1. How the hell does one share session data between a servlet and a JSP page without using a bean but rather using a normal string variable.
2. When using session scope to access a bean the application complains about not finding the bean on the specified scope, however when I use an application scope the save the same bean, the application does find it.
Please help!!!!!!!
SERVLET:
HttpSession session = request.getSession(true);
ServletContext servletContext = session.getServletContext();
customerID = result.getString("CustomerID");
userName = result.getString("UserName");
session.setAttribute("UserName",userName);
session.setAttribute("CustomerID",customerID);
System.out.println("Customer UserName = " + session.getAttribute("UserName"));
response.sendRedirect("/economics/subscriptions/default.jsp");
JSP PAGE:
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root xmlns:jsp=http://java.sun.com/JSP/Page mlns:c="http://java.sun.com/jsp/jstl/core" xmlns:sql="http://java.sun.com/jsp/jstl/sql" version="2.0">
<jsp:directive.page isThreadSafe="true" session="true" contentType="text/xml"/><jsp:output omit-xml-declaration="false"/><jsp:scriptlet>response.addHeader("x-xslt-nocache", "true");</jsp:scriptlet><pml>
<page type="web" search="y">
     <pageName>Commercial Banking</pageName>
     <jsp:directive.include file="/economics/header.inc"/>
     <jsp:directive.include file="/login.inc"/>
     <jsp:directive.include file="/economics/leftMenu.inc"/>
     <!--<jsp:useBean id="UserName" type="java.lang.String" scope="session" />-->
     <content>
     <searchSum>Commercial - Main Content</searchSum>
     Value = <c:out value="${request.session.getAttribute("UserName")}"/>
     </content>
     <jsp:directive.include file="/economics/rightNav.inc"/>
     <jsp:directive.include file="/footer.inc"/>
</page></pml></jsp:root>

For a start, just "session" instead of "request.session" would work better. But why did you post this here and not in the JSP forum? Doesn't seem to have anything to do with Java programming.

Similar Messages

  • How can share data between jsp pages using beans??

    any one can give me code for 2 jsp pages with bean that share data for them

    <jsp:usebean name="yourBeanName" type="com.whatever.foo" scope="session"/>
    this will look for a bean named yourBeanName in the scope specified by the scope attribute. If none was found, the container will instantiate one with the no arg constructor for your bean and place it into the proper scope.
    if your bean had a method getName(), you could then on your jsp do:
    <%=yourBeanName.getName()%> to print the results of the method to the page. there are other ways to do the actual placing of the output on the page, but this is the most direct.

  • 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.

  • CS4 Error 148:3 What the hell does that mean?

    CS4 Error 148:3 What the hell does that mean?

    It's a licensing error and I'm sure the accompanying text in the warning dialog spells it out pretty clearly, despit you not caring to provide that info along with any tangible details about your system. So the only blindfire advise we can give you is this: Error "Licensing has stopped working".
    Mylenium

  • How the HELL do I stop this damned thing from eliminating my LSO,s. Damn this is a BAD program/

    I'm an 80 year old guy who has not had a problem with my computer until I downloaded some damn addon from Firefox. Now every time I close a web site I get a message that says that you are going to eliminate my LSO's. How the hell do I get rid of this anoying problem? Does ANYONE know?

    You can stop this happening by unininstall the add-on that you downloaded, for details of how to do that see [[Uninstalling add-ons]].
    The add-on that is doing this is probably called Better Privacy.

  • I ask for help, I can not cancel a monthly subscription to Adobe! contrary to the tutorial does not appear  scribed CANCEL PLAN on my page management plan, is not worse than any serial number of my subscription, where is it? how can I cancel monthly charg

    I ask for help, I can not cancel a monthly subscription to Adobe.
    contrary to the tutorial does not appear scribed "CANCEL PLAN" on my page management plan, is not worse than any serial number of my subscription, where is it? how can I cancel monthly charge? 

    Just to clarify: This is a user to user Forum, so you are not really addressing Adobe here, even though some Adobe employees thankfully have been dropping by.
    Have you done a Forum search?
    How can I delete my account? There is no "cancel plan" in my creative cloud free membership.
    Contact Customer Care

  • HT202213 My wife and I have different iTune accounts.  How do we share purchaed content between our ipads and iphones?

    My wife and I have different iTune accounts.  How do we share purchaed content between our ipads and iphones?

    iTunes- How to share music between different user accounts on a single computer
    You cannot merge two separate libraries across user accounts. Photos does not have the function of merging different Photos.library files. If you have Aperture then you can merge the two before migrating over to Photos.

  • How can I stop the execution on a JSP page and start it again

    Hi
    I am making a program that simulates how to manage transactions when accessing a database by using locks. I have run into a problem and I hope someone has the time to help me.
    When a user does an update the transaction commits and releases its locks when the program executes
    <%stmt.executeUpdate("commit!"); %>
    I need to put a break in to stop the program executing this statement, to illustrate the lock is set correctly.
    I have tried to put in an alert box but this does not prevent the rest of the java code being executed.
    I have tried to use prompt boxes, JavaScript functions, but these functions cannot have any java code in them.
    I have tried using the java.swing JOptionPane boxes but this didn?t work either
    I have tried to get input from the user but I don?t know how to retrieve this data on the same page. (As far as I know you have to use submit and even refresh the page or retrieve it on the next page).
    Does anyone know how I can stop the execution on a JSP page and start it again (on same page)
    Mette

    I already have another client (Tomcat jsp application) running and it throws a SQLException correctly when I don�t put in a commit=true statement and don't close the database connection.
    But the problem is how to get the code above to stop to illustrate I have set this lock.
    I have tried to use the JOptionPane but because my program is running in a web browser I cannot use the JOptionPane dialog box.
    I have tired using an alert box but it executes the commit statement before the alert box is dispayed. So this does not work
    While (i < 2)
    if( i==1)
    %>alert(�The transactions commits when you press Ok�); <% //what it to stop execution here
    else
    stmt.executeUpdate(�commit�);
    I am not using threads so I cannot use the sleep function.
    I am using mysql and have already configured it to detect deadlocks and how long to wait for locks.
    Thanks for your help
    Mette

  • How to Hightlight the Data in Jsp Page

    How to Hightlight the Data in Jsp Page,
    I am doing doing search page,based on values given search page those are sent to servlet,in servlet based on some conditions if particuler id i am getting then i am redirecting to Respective jsp page with highlight the data from database..
    Thanks in advance...

    "Highlighting data in JSP sounds strange".
    Without looking at your search specific algorithms I feel you are finally going to display a page (HTML content) to user which contains highlighted text. Highlighting is not directly related to server side language you use (JSP, ASP, PHP etc.). This is purely HTML and CSS. However, server side script (such as JSP) should generate HTML content for getting highlight effect.
    Following HTML shows highlighted text using background-color property on span element.
    <html>
      <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
      </head>
      <body>
          <p style="font-size:1.1em">This is a long paragraph which contains <span style="background-color: yellow;">highlighted text</span> and non highlighted text.</p>
      </body>
    </html>Thanks,
    Mrityunjoy
    Edited by: mrityunjoy on 14 Jun, 2010 3:30 AM

  • Is there a way to Move files to the iCloud thus freeing up disk space on my Mac? Or does iCloud only sync (replicate) files between my Mac and the cloud?

    Is there a way to Move files to the iCloud thus freeing up disk space on my Mac? Or does iCloud only sync (replicate) files between my Mac and the cloud? I want to free up disk space on my Mac and assumed that the icloud would be a good way to do this, but having 'moved' 70Gb of files to the iCloud drive (I've upgraded to 200Gb storage) my Mac is still nearly full and I've realised that it seems to just Sync files just like dropbox.

    So, the big question is did the Apple guys confirm that this is how the new iCloud drive should be working?  I'm guessing, from your response, that this is indeed the case.  Are they going to fix this anytime soon?  I thought that this was a new function of the iCloud drive in Yosemite.
    I just want an online storage facility to back up my photo & music collections.  I did look at Dropbox as they have a good deal going with their Dropbox Pro, however this is still just a sync service where the Master files reside on your local disk drive - although I have read that there may be a way to work around this.  Still not ideal.

  • How can I share data between WinXP Pro and Mac OS 10.8.3 via wifi

    How can I share data between WinXP Pro and Mac OS 10.8.3 via home wifi. 

    MartyP wrote:
    Or is there a problem with both OS's writing stuff to the
    ~/Home/Library folder that may be incompatible?
    Yes, big time.  Mail, for sure, has a different file/folder structure, and would not be happy.
    Plus, a number of apps (Apple and 3rd-party) are "Sandboxed."  That's a security feature, to prevent malware or bad coding from affecting things it shouldn't.  Some of their files, including the preferences files, aren't even stored in the same places!
    Or to other places I'm not aware of?
    Probably.  If you have two versions of the same app, they may or may not expect the same data setup.
    To have one User folder for both OS's would save a lot of drive space
    Not if you use some or all of woodmeister50's suggestions. 
    But I'm also not sure how I'd use Time machine with such a set up.
    Just as you do now.  By default, Time Machine backs-up everything (except things like system work files, most caches and logs, trash) for all users and all internal drives & partitions.  By default, it excludes external drives.
    You can change those defaults, of course, via TM Preferences > Options.
    See Time Machine - Frequently Asked Question #32 for details and considerations of multiple drives.
    Presently I backup with . . . clones to other HD's
    Good.   Yes, clones are different.  You need multiple "tasks" to back up multiple drives/partitions.  But once set up, that shouldn't be a big deal.

  • I updated my Itunes the other day and now, when clicking on the itunes icon, the program does not open?? I have tried uninstalling and reinstalling, resetting the computer, checking permissions, running as adminstrator.. nothing is working?? Help!!

    I updated my Itunes the other day and now, when clicking on the itunes icon, the program does not open?? I have tried uninstalling and reinstalling, resetting the computer, checking permissions, running as adminstrator.. nothing is working?? Help!!

    Amazing steps you've done so far! The great news is this is very unlikely an issue with your iPhone.
    I've run into a similar issue lately as well. I narrowed it down to one song that was causing 30 songs not to sync. I removed the song from the sync list (unchecked it) and all 29 songs were able to sync.
    You may be running into a similar issue. This may be a problem with this version of iTunes, an issue with one song or a group of songs; hard to know for sure. It's important to narrow down and isolate the cause. Most imporantly get that music back on there!
    The way to narrow down the casue add just a few songs at a time (even 1, just to get that first sync finished). Manually syncing is what you'll need here.
    Plug in your iPhone, on the Summary screen (shows a picture of your iPhone, the iOS version, Restore iPhone....; etc). Under the Options area at the bottom choose to Manually Manage Videos and Music then choose Apply in the lower right. The music that's on your iPhone now should be removed from your iPhone now. You're now able to sync music manually.
    The link below explains how to drag the songs from the iTunes library on the computer on to your iPhone which will start the sync. Add just one song just to see if you can get 1 of those hundreds of songs on there. If you can, awesome! Keep adding until you find the song or group of songs that are causing this issue.
    http://support.apple.com/kb/HT1535
    Please let me know how things are going.
    Cheers!

  • ORA-20001: The assignment does not exist at this date.

    Hi,
    I got the following error when imported employee assigment per Hr_Assignment_Api.update_emp_asg_criteria. Could any one help us?
    "ORA-20001: The assignment does not exist at this date.".
    Following are information and scripts. By the way, Our instance is R12
    RDBMS : 11.2.0.1.0
    Oracle Applications : 12.1.2
    lp_object_version_number ->7
    effective_start_date ->29-OCT-10
    effective_end_date -> 31-DEC-12
    ln_effective_date = > effective_start_date
    =========================
    apps.Hr_Assignment_Api.update_emp_asg_criteria
    (p_validate => False,
    p_effective_date => ln_effective_date, -- l_date,
    p_datetrack_update_mode => lv_update_mode, --'CORRECTION',
    p_assignment_id => ln_assignment_id,
    p_object_version_number => lp_object_version_number,
    p_organization_id => '0', --'Business Group' c_emp.organization
    p_location_id => '1242', -- 'default ccid',
    p_job_id => '64', -- This is job 'MANAGER ->64' to test in OFADEV.,
    -- p_position_id => v_emp.std_position_id,
    p_special_ceiling_step_id => lp_special_ceiling_step_id,
    p_effective_start_date => ln_effective_date,
    --per_effective_start_date,
    p_effective_end_date => lp_effective_end_date, --IN/OUT
    p_people_group_id => lp_people_group_id, --IN/OUT
    p_group_name => lp_group_name, --IN/OUT
    p_org_now_no_manager_warning => lp_org_now_no_manager_warning, --IN/OUT
    p_other_manager_warning => lp_other_manager_warning, --IN/OUT
    p_spp_delete_warning => lp_spp_delete_warning, --IN/OUT
    p_entries_changed_warning => lp_entries_changed_warning, --IN/OUT
    p_tax_district_changed_warning => lp_tax_district_chang_warning --IN/OUT
    );

    966933 wrote:
    How do I find the reference you posted?MOS website -- https://support.oracle.com
    You need to have a valid CSI number and valid username/password to access MOS website.
    Thanks,
    Hussein

  • How do I share data between my MBP and iMac?

    I have two Genealogy programs on my iMac that I would like to share data between my MBP and the iMac.  I would like to gather the data on the MBP and then share new data to the iMac which is where I basically do all of the Genealogy work from, since it is much easier with the larger screen and better keyboard. 
    Can someone please explain or direct me to a tutorial or procedures if this is possible?  Thank You!

    Click Apple>System Preferences>Sharing
    Check File Sharing. In File Sharing add the folder you want to share with another computer. Then add users. Then proide access previledges such as Read & Write, Read Only, Write Only or No Access.
    Now in the System Preferences, Click iCloud, sign in to iCloud. It's free and you can access your Macs from anywhere.
    In iCloud, check Back to My Mac.
    Do the same to another computer. You're all set by now.

  • The printing of .pdf file from Project 2013 stops when the file name should be written. Project 2013 crashes. Does someone know what is wrong between Project 2013 and Adobe Acrobat 9?

    The printing of .pdf file from Project 2013 stops when the file name should be written. Project 2013 crashes. Does someone know what is wrong between Project 2013 and Adobe Acrobat 9?

    The Acrobat 9.x product family passed into "End of Support" mid-year of 2013.
    Acrobat 9 support of MS Project via PDFMaker stops with Office 2007.
    For Office 2013 support you must use Acrobat XI (11.0.1) or newer. 
    A good to have reference:
    https://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html
    Acrobat Pro and Standard DC are what are currently available for purchase. 
    Be well...

Maybe you are looking for