Sharing data between jsp's

how can i share different variable difined in one jsp to another jsp??
thanks!!!!

Are the two JSPs on the same user request? Use the request object to store the variables?
Are the two JSPs read by the same user but on different requests? Use the session object.
Are the two JSPs read by different users? Put the data in the application object.
Not sure how to use the pageContext, request, session, and application objects? Read chapters 11-16 of the J2EE tutorial: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

Similar Messages

  • Sharing data between two separate user sessions

    Hi all!
    I have been trawling my brain for a solution to this - any help will be appreciated!
    I would like to create a single instance of a class but share that instance over more than one user session (two separate users but both running concurrently).
    Just as you can pass data between sessions using ABAP memory - I would like to pass data (specifically an object reference) between two separate users that could even be logged in to two separate application servers...
    Even a mini Client/server solution would suffice but I cannot figure one out!
    Is this possible?
    Many thanks for your thoughts in advance...
    N

    Hello N K,
    sorry thats not possible. Sharing a data item / object instance requires at least a common physical memory. As this is not guaranteed between different app. server this is technical not possible.
    With release 640 ABAP offers the new feature Shared Objects. These mechanism allows access by different users and some propagation to differnt servers.There is an interesting article on the ABAP SDN homepage
    https://www.sdn.sap.com/sdn/developerareas/abap.sdn
    For relases below more or less the database is the only chance to store data accross application servers (known to me). One exception might be the ENQUEUES which might (mis)used to store some Flags.
    Kind Regards
    Klaus
    Link to Shared Objects PDF
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/shared objects in abap

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

  • Sharing data between SWF's

    Hello,
    Is there any way to exchange data between 2 swf's?

    You can talk between movies using javascript as the middleman. Here's a link that provides some information on that...
    http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683

  • Sharing data between a bean and a jsp

    I have a bean that is being used as a helper class for a jsp page. I can call functions in the bean and display what is returned but I can't test the state of the bean in the jsp page. Is this possible?
    my code is below:
    jsp: a form posts info to this page
    <HTML>
    <BODY>
    <jsp:useBean id='portal' class='portal.portal'/>
    <%-- set the username and password --%>
    <jsp:setProperty name="portal" property="*" />
    <jsp:getProperty name="portal" property="dbconnection"/>
    <Center>
    <H1>Welcome to the Portal
    <jsp:getProperty name="portal" property="firstName"/>
    </H1>
    <br>
    <table border="0">
    <%-- while loop grabs all the services --%>
    <%-- case tests for special services (links) --%>
    <%
    String url = "";
    int ServiceID = 0;
    //I CAN'T PULL THE VALUES FOR THESE VARIABLES SO THE WHOLE WHILE LOOP IS SKIPPED!
    while (url.length() != 0)
    switch (ServiceID)
    case 69:
    %>
    <tr valign="top" height="45">
    <td>
    <center>
    " TARGET="new_window"><IMG SRC="images\MEDS TAPE LOG.gif" BORDER=white></A><br>
    </center>
    </td>
    </tr>
    <%
    break;
    case 41:
    %>
    <tr valign="top" height="45">
    <td>
    <center>
    <A HREF="<jsp:getProperty name="portal" property="url"/>" TARGET="new_window"><IMG SRC="images\Lan Support Website.gif" BORDER=white></A><br>
    </center>
    </td>
    </tr>
    <%
    break;
    case 1:
    %>
    <tr valign="top">
    <td>
    <center>
    <form name="loginfrm" action="http://204.104.185.139/pls/WLOG/login.ValidateUser" method="post" target=_parent>
    <INPUT TYPE=hidden NAME=TXTUSERNAME VALUE="<jsp:getProperty name="portal" property="name"/>">
    <INPUT TYPE=hidden NAME="TXTPASSWORD" VALUE="<jsp:getProperty name="portal" property="password"/>">
    <input TYPE="submit" VALUE="<jsp:getProperty name="portal" property="serviceName"/>" style="width: 120px;" >
    <input type="reset" name="reset" value="">
    </Form>
    </center>
    </td>
    </tr>
    <%
    break;
    default:
    %>
    <tr valign="top">
    <td>
    <center>
    <Form method='post' action='<jsp:getProperty name="portal" property="url"/>' name='loginfrm'>
    <INPUT TYPE=hidden NAME="TXTPASSWORD" VALUE="<jsp:getProperty name="portal" property="password"/>">
    <INPUT TYPE=hidden NAME="TXTUSERNAME" VALUE="<jsp:getProperty name="portal" property="name"/>">
    <INPUT TYPE=hidden NAME="firstname" VALUE="<jsp:getProperty name="portal" property="firstName"/>">
    <INPUT TYPE=hidden NAME="lastname" VALUE="<jsp:getProperty name="portal" property="lastName"/>">
    <INPUT TYPE=hidden NAME="id" VALUE="<jsp:getProperty name="portal" property="userID"/>">
    <INPUT TYPE=hidden NAME="role" VALUE="<jsp:getProperty name="portal" property="roleID"/>">
    <input type='submit' name='submit' value='<jsp:getProperty name="portal" property="serviceName"/>'>
    </Form>
    </center>
    </td>
    </tr>
    <%
    break;
    %>
    <jsp:getProperty name="portal" property="nextForm"/>
    <%
    %>
    </table>
    </Center>
    </Body>
    </Html>
    here is the bean:
    //bean for portal
    package portal;
    import java.io.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.util.Enumeration;
    import java.sql.*;
    import java.util.*;
    public class portal {
    private ResultSet userInfo;
    private Statement stmt;
    private String pw;//password from the database
    private String FirstName;
    private String LastName;
    private String UserName=""; //network login name
    private String UserPassword="";//password supplied by the form
    private int UserID; // temp variable while pulling the services from the databases
    private int RoleID; // temp variable while pulling the services from the databases
    private String ServiceName=""; //temp variable while pulling the services from the database
    private int ServiceID;
    private String url ="";
    //String Message=""; //testing
    private String Message2=""; //string that sends the correct html back to the jsp
    public int getServiceID(){
    return ServiceID;
    public void setName(String Name){
    UserName = Name;
    public String getName(){
    return UserName;
    public void setPassword(String Password){
    UserPassword = Password;
    public String getPassword(){
    return UserPassword;
    public String getFirstName(){
    return FirstName;
    public String getLastName(){
    return LastName;
    public String getUrl(){
    return url;
    public int getUserID(){
    return UserID;
    public int getRoleID(){
    return RoleID;
    public String getServiceName(){
    return ServiceName;
    public String getDbconnection() {
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    DriverManager.setLoginTimeout(60);//time out after 1 min.
    Connection con = DriverManager.getConnection("jdbc:odbc:Portal");
    stmt = con.createStatement();
    String query = "SELECT EMP_TABLE.EMP_PASS, MGR_SERVICES.SERVICE_ID,";
    query = query +" MGR_SERVICES.DEFAULT_URL, EMP_TABLE.EMP_USER_ID, *";
    query = query +"FROM (EMP_TABLE LEFT JOIN MGR_USER_SERVICES ON";
    query = query +" EMP_TABLE.EMP_USER_ID = MGR_USER_SERVICES.USER_ID)";
    query = query +" LEFT JOIN MGR_SERVICES ON MGR_USER_SERVICES.SERVICE_ID =";
    query = query +" MGR_SERVICES.SERVICE_ID WHERE (((EMP_TABLE.EMP_LAN_ID)='" + UserName+ "'))";
    //String query = "SELECT EMP_TABLE.EMP_PASS, MGR_SERVICES.SERVICE_ID,";
    //query = query +" MGR_SERVICES.DEFAULT_URL, EMP_TABLE.EMP_USER_ID, *";
    //query = query +"FROM (EMP_TABLE LEFT JOIN MGR_USER_SERVICES ON";
    //query = query +" EMP_TABLE.EMP_USER_ID = MGR_USER_SERVICES.USER_ID)";
    //query = query +" LEFT JOIN MGR_SERVICES ON MGR_USER_SERVICES.SERVICE_ID =";
    //query = query +" MGR_SERVICES.SERVICE_ID WHERE (((EMP_TABLE.EMP_LAN_ID)='landwla'))";
    //String query = "SELECT * FROM EMP_TABLE WHERE EMP_LAN_ID ='landwla'";
    userInfo = stmt.executeQuery(query);
    if(userInfo.next())
    pw = userInfo.getString("EMP_PASS");
    if (UserPassword.equals(pw))
    //Message = "Your logged in";
    //Message = Message + "Luke you sly devil";
    FirstName = userInfo.getString("EMP_FIRST");
    LastName = userInfo.getString("EMP_LAST");
    UserID = userInfo.getInt("EMP_USER_ID");
    RoleID = userInfo.getInt("ROLE_ID");
    url=userInfo.getString("DEFAULT_URL");
    ServiceName = userInfo.getString("SERVICE_NAME");
    ServiceID = userInfo.getInt("Service_ID");
    else
    Message2 = "<Script Language=JavaScript>";
    Message2 = Message2 + "alert('Your Password Information is incorrect');";
    Message2 = Message2 + "window.location.href = 'Login.html'";
    Message2 = Message2 + "</Script>";
    else
    Message2 = "<Script Language=JavaScript>";
    Message2 = Message2 + "alert('Your Login Information is incorrect');";
    Message2 = Message2 + "window.location.href = 'Login.html'";
    Message2 = Message2 + "</Script>";
    catch (InstantiationException i)
    {return (i.toString());}
    catch (ClassNotFoundException c)
    {return (c.toString());}
    catch (SQLException sql)
    {return (sql.toString());}
    catch (Exception e)
    {return (e.toString());}
    return Message2;
    public String getNextForm() {
    try
    url="";
    ServiceName="";
    if(userInfo.next())
    url=userInfo.getString("DEFAULT_URL");
    ServiceName = userInfo.getString("SERVICE_NAME");
    RoleID = userInfo.getInt("ROLE_ID");
    ServiceID = userInfo.getInt("Service_ID");
    catch (SQLException sql)
    {return (sql.toString());}
    return Message2;

    Of course you can.
    <%
    String url = protal.getUrl();
    %>

  • 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 Date between Projects

    I can copy slides and use the Library to share data. I can
    also combine multiple projects into a chain of projects. Is it
    possible to have a source of data that can be shared accross
    multiple projects? For example, lets say I have one slide I want to
    use across 30 projects. Right now I can create a slide and copy it
    into 30 projects. I can also create a project with the one slide
    and have all projects run the second project, but starting a new
    movie (I think) won't allow the user to go back to the previous
    movie.
    Is it possible to link data so multiple projects can point to
    one or multiple files with the one or multiple slides. So when I
    update that one slide, it updates it in 30 locations. I don't have
    to update 30 slides. Its kind of lik building common pieces and
    sharing them so you don't have to duplicate the same work multiple
    times.
    Shawn

    Yeah, what you are talking about used to be called dynamic
    link libraries or just dynamic linking - might still be, for all I
    know. No, Shawn, it's not possible in Captivate. Not the way you
    want to use it - sorry.
    You've been around long enough to know the drill -
    click
    here to go to the Wish List and enter a request for this
    feature
    . It's not a bad idea IMO. Good luck with the request...
    .

  • Sharing data between two canvases on the same form ?

    Hello,
    I have one form with two canvases and two data blocks.
    Datablock A and datablock B are same tables.
    The reason I split is so I can have a search field on canvas A, then after executing the query, I want to populate canvas B.
    I'm having trouble sharing the data across both data blocks.
    Note: I set up a relation in datablock B to correspond with A, and I've chosen field name "Horse" to be my master and detail item.
    "When-button-pressed-trigger" --> Here is part of my code after the user presses the "Search" button (in datablock A).
         execute_query;
         SHOW_VIEW('CANVAS_HORSE');
         HIDE_VIEW('CANVAS_SEARCH');
         :fox_horse.horse := :fox_horse1.horse     ;                         GO_BLOCK('FOX_HORSE');
    When I go back to my "FOX_Horse" datablock, why is the :fox_horse.horse field the only one populated? I though by creating a relation btwn the two blocks they would syncronize automatically ?
    Any advice ?
    Thanks,
    Bob

    Alex,
    I have tried your suggestion, yet I'm still having a problem once I issue my execute_query command.
    In my Search button I have this code:
    BEGIN
    :fox_horse1.horse := :fox_horse.horse;
    GO_BLOCK('FOX_HORSE1');               
    execute_query;
    END;
    Note that FOX_HORSE is NOT a database block (as you suggested), but FOX_HORSE1 is a database block.
    So when I click on the "Search" button I can see the :fox_horse1.horse field getting populated immediately, but then the system asks me if I want to save changes. When I say NO, the actual data block portion of my screen just defaults to the first record, so my exec_query show no effect at all.
    What am I doing wrong in my search button trigger ?
    Thanks so much for your advice,
    Bob

  • Sharing data between CRM and Sharepoint

    Does anyone have an easy way to share dynamic lists in CRM with Sharepoint? We basically have a client list/view in accounts in CRM (all are online services with Microsoft 2013) and want to have it or a variation of it in sharepoint, but we want the data
    to be dynamic. Wondering about BCS or using dynamic spreadsheets. Thanks.

    Hi,
    Yes, this is what EPMA is meant for. You can create and share dimensions between applications of different type. In the property grid of any member at dimension library you can choose the category and edit the properties in selected category of the member (Planning, Consolidation (HFM), Essbase, etc.).
    Further details are in below:
    http://download.oracle.com/docs/cd/E17236_01/epm.1112/epma_admin/frameset.htm?launch.html
    Cheers,
    Alp

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

  • Sharing data between swf files

    Hello,
         I have a login.swf file which authenticates the user. Once login is successful I want redirect to loggedin.swf file and pass some user information to the loggedin.swf?. How do i do it? I dont want to use shared objects as users may prevent saving  on to local machine. I dont want to send it in URL either. I want something like hidden variables in html. Is it possible.
    Thanks,
    Bharani

    Hi
    I have mutiple swf files in single page each having its sound attached to it.
    Now I want one sound to play at a time while all rest swf's sound to be mute.
    When user clicks second swf then first swf sound to be mute and second's swf sound to play and all rest swf to mute.
    Similarly when he clicks third then third's sound to play while rest all swf to be mute.
    I have already implemented swf with sound attached.
    But they all are playing at a time.
    How this control can be implemented ?? Number of swf files can vary.
    Any help??

  • Transferring data between JSp's

    I have a servlet, PC502, which I invoke and use PC502.jsp to display the results. I have a clickable button so if the user wants to see more account information I invoke servlet PC503, and use PC503.jsp to display the results. Within the PC503.jsp I want to reference and display a field that is part of the PC502 servlet. I thought that by using the useBean,
    <jsp:useBean id="pC502Command" class="pc502.PC502Command" scope="request"></jsp:useBean>
    I would be able to reference <%= pC502Command.getOp02o__Debt__Name() %> within the PC503.jsp, but PC503.jsp displays a blank for the DebtName.
    My question is how can I reference a property from the PC502 bean while I am in the PC503.jsp. Each servlet is in its own package, and project. So I have project PC502, which has package pc502, which has command PC502Command, and servlet PC502Servlet. The same holds true for PC503.
    Any help would be appreciated.

    Hello,
    I do not think you can reference a PC502 object from PC503, since they reside in their own package structure.
    I have developped a few JSP/Servlet applications and have come to the conclusion that the best way to get the information across is to have PC502 set a session variable and let PC503 get the info from the session.
    Similarly, you can put information in the request object.
    session.setAttribute("paramName", "hello");
    String object = (String) req.getParameter("paramName");So now, the string object has a value of "hello".
    Hope this helps,
    Haig

  • Sharing data between two Web Apps

    Hi,
    I have got two web applications that share a MySQL database accessed by
    Kodo JDO. I have tremendous difficulty to share the state that one web
    application writes to the database with the second web application. The
    data seems to stay in the cache of the first app and I have not found a
    way to flush the data to the SQL database, so that the second can read it.
    I do a refresh on the relevant object within the second app. The problem
    seems to be flushing the cache of the first app.
    Best regards
    Wolfgang
    PS: To Solarmetric: Thanks for this wonderfull technology. I am building a
    complex database application, without having to learn SQL.

    Hi Greg,
    this:
    properties.setProperty("kodo.DataCache", "false");
    does not do the trick. There is no difference in behaviour. To use
    kodo.RemoteCommitProvider I would need the performance pack at 900 bucks a
    pop, which is not an option right now.
    Best regards
    Wolfgang
    Greg Campbell wrote:
    Hi Wolfgang,
    Are you using Kodo's Datastore cache in both web apps? I suspect that what
    is happening is that the data actually is being flushed to the database
    appropriately (assuming that you commit your transactions), but that your
    cache in your second app has stale data. Could you turn off the datastore
    cache in both apps just test that hypothesis?
    If your applications start to work as expected with the datacache off, then
    you should check out (assuming you're using Kodo v. 3.1.3)
    http://www.solarmetric.com/Software/Documentation/3.1.3/docs/ref_guide_event.html#ref_guide_event_conf
    That section of doc describes how to get the datastore caches in the two
    JVMs talking to each other.
    Thanks,
    Greg
    "Wolfgang Kundrus" <[email protected]> wrote in message
    news:ccli85$lae$[email protected]..
    Hi,
    I have got two web applications that share a MySQL database accessed by
    Kodo JDO. I have tremendous difficulty to share the state that one web
    application writes to the database with the second web application. The
    data seems to stay in the cache of the first app and I have not found a
    way to flush the data to the SQL database, so that the second can read it.
    I do a refresh on the relevant object within the second app. The problem
    seems to be flushing the cache of the first app.
    Best regards
    Wolfgang
    PS: To Solarmetric: Thanks for this wonderfull technology. I am building a
    complex database application, without having to learn SQL.

  • Sharing data between two computers

    Hi
    I have a mac running itunes in my office, it is not connected to the Internet any more. At home I have a PC which is connected to the Internet with itunes running on it. Can I purchase songs on the PC and then transfer them to the mac? How would I do this?
    Thanks!

    *Can I purchase songs on the PC and then transfer them to the mac?*
    Yes you can. Have a look at these guides:
    iTunes for Mac: How to copy purchases between authorized computers
    iTunes for Windows: How to copy purchases between authorized computers

  • Sharing data between two iPads with different iclouds

    Hi basically I want to be able to link notes etc from my iPad to my bosses iPad, obviously we have different iCloud's and we don't mind using a third party app. anything anyone can suggest.

    Thank you! The itunes accounts are on different computers. The movies I want to share are digital downloads that came with movies I purchased. Example Rio. My son has an Ipad2 and and I have an ipad. I mainly want to be able to share the movies with him on his ipad.

Maybe you are looking for

  • Issue with dreamweaver and PHP on WordPress theme

    Hi all Im trying to create a WordPress theme for my blog, however I keep getting this issue (CS6) "Dynamically-related files cannot be discovered because a testing server is not defined" I have been through my preferences and set everything how I thi

  • Content Exchange  menu not found in KM

    Hi All I am trying to import home_area_content_templates_fullupdate.zip file. As per documentation of Importing an Offline Package  it is saying there will be a menu Content Exchange under Content Management. I could <b>not find Content Exchange</b>

  • A strange problem while Solaris9 CC compile union

    I met a strange question while using solaris9 CC to compile my code. These codes looks like as following: typedef struct { int len; union { DWORD u; #if BYTE_ORDER == BIG_ENDIAN struct { BYTE ext1 : 1; BYTE codingStd : 2; BYTE infoTransCap : 5; BYTE

  • SQL server database structure

      Is it possible to create an 'XML file' from a SQ Server 2008R2 database structure?

  • Safari and Firefox crashing EXC_BAD_ACCESS KERN_PROTECTION FAILURE

    Both Safari and Firefox have recently started crashing on me. I thought it might be a software update issue, but everything should be up to date. Error report from latest Safari crash below... thanks in advance for any assistance. Process: Safari [18