Sharing data across different webapps using JSP/Servlet

I have two different web applications running on same WebLogic server say webapp1 and webapp2. Webapp1 has servlet which redirects the user to JSP in webapp2. While redirecting I have to pass one string value to called JSP. I have achieved this by using QueryString as follows:
response.sendRedirect(ConfigService.getProperty("com.twofactauth.caymanlogin.caymanurl", null)) + "?userName=" + strCaymanUserName);
but this expoes the value in browser address bar but i don't want to expose the value passed. I am searching the way to pass the value internally without exposing.
so please tell me other way in which i can pass the value to called JSP without usign QueryString.
I am using WebLogic 8.1 for deployments. Both applications are deployed on same WebLogic instance.

I have two different web applications running on same
WebLogic server say webapp1 and webapp2. Webapp1 has
servlet which redirects the user to JSP in webapp2.
While redirecting I have to pass one string value to
called JSP. I have achieved this by using QueryString
as follows:
response.sendRedirect(ConfigService.getProperty("com.t
wofactauth.caymanlogin.caymanurl", null)) +
"?userName=" + strCaymanUserName);
but this expoes the value in browser address bar but
i don't want to expose the value passed. I am
searching the way to pass the value internally
without exposing.
so please tell me other way in which i can pass the
value to called JSP without usign QueryString.
I am using WebLogic 8.1 for deployments. Both
applications are deployed on same WebLogic instance.I think a big part of the problem is that you want the functionality of a web app to be available to others, but you've locked it up behind a UI.
I think this is one of the benefits of a service-oriented architecture. You start thinking about the system functionality apart from the UI. Your JSPs become just another client of the services you expose. Anyone can call those services, as long as they can see that service on their network.
When I've done this I've started with a Spring service interface that is completely separate from the view layer. Once I have that, I can expose it to any other client either with web services (not preferred) or Spring HTTP remoting (preferred due to its simplicity).
%

Similar Messages

  • Persisting Data across different WebApps/Sessions

    Hello all,
    I am developing in an environment where multiple (web & enterprise) applications
    are developed and deployed separately to the same clustered WebLogic infrastructure.
    The applications are all owned by the same company, and usually co-exist quite
    happily. I have a request from the business, for a new application I am developing,
    to persist some user info for a logged in user on one application to another application,
    acessible to the user via a link on page. The user should be able to click on
    a link and access a different application but still have their data available
    on the new app, if logged in.
    As these applications are separate, afaik they cannot simply share session information
    together. I need some mechanism, whereby one application can access the information
    in the other application's session. Thus far I have considered these options:
    1) Writing a cookie containing the info, this could be retrieved from the other
    application, back from the client.
    2) Send user data through to the second application via a query string. At the
    moment this would be possible as a limited amount of information is required to
    be shared.
    3) Send unique field, such as userid, through to the second application, then
    use this field to retrieve user's details from database shared with first application.
    This seems OK in principle but my DBA's and security people may have other ideas.
    4) Serialise a user object which could be picked up again by the second application.
    As I don't know much about serialisation, where do objects get serialised to,
    presumably the server they are running on, is there a particular location, would
    there be security manager issues and would this be possible in a cluster?
    5) Is there another way for web applications to share information with each other?
    Thanks,
    James

    James,
    All of these approaches seem legitimate. It seems like if the data is small,
    the URL Query String approach would scale and perform well. However, the database
    userid approach would entail a performance hit just like when you use JDBC persistence
    for session information.
    Additional, stateful session beans store serialized information based upon the
    persistent-store-dir in the weblogic-ejb-jar.xml file
    See
    http://edocs.bea.com/wls/docs61/ejb/reference.html#1071686
    "James Lawless" <[email protected]> wrote:
    >
    Hello all,
    I am developing in an environment where multiple (web & enterprise) applications
    are developed and deployed separately to the same clustered WebLogic
    infrastructure.
    The applications are all owned by the same company, and usually co-exist
    quite
    happily. I have a request from the business, for a new application I
    am developing,
    to persist some user info for a logged in user on one application to
    another application,
    acessible to the user via a link on page. The user should be able to
    click on
    a link and access a different application but still have their data available
    on the new app, if logged in.
    As these applications are separate, afaik they cannot simply share session
    information
    together. I need some mechanism, whereby one application can access the
    information
    in the other application's session. Thus far I have considered these
    options:
    1) Writing a cookie containing the info, this could be retrieved from
    the other
    application, back from the client.
    2) Send user data through to the second application via a query string.
    At the
    moment this would be possible as a limited amount of information is required
    to
    be shared.
    3) Send unique field, such as userid, through to the second application,
    then
    use this field to retrieve user's details from database shared with first
    application.
    This seems OK in principle but my DBA's and security people may have
    other ideas.
    4) Serialise a user object which could be picked up again by the second
    application.
    As I don't know much about serialisation, where do objects get serialised
    to,
    presumably the server they are running on, is there a particular location,
    would
    there be security manager issues and would this be possible in a cluster?
    5) Is there another way for web applications to share information with
    each other?
    Thanks,
    James

  • How do i Create charts using JSP/Servlet & Database

    I have to create charts which shows the graph of stock exchange.
    i have a database that keeps the data for creating charts.
    But i did not know how to create charts using jsp-servlet.
    Any Example might help me to go forward.
    Any help will be really appreciated.
    Please Advice me.

    JFreeChart - You can generate the charts then convert them to image formats (PNG and JPEG) all using the JFreeChart API
    http://www.jfree.org/jfreechart/

  • Any good books on web application using JSP/servlet?

    Does anyone know good books on how-to build enterprise web application using JSP/servlet? Aside from the book "Head First JSP/Servlet". Development using Netbeans is more preferrable.

    801264 wrote:
    What about the free web server? JBoss or Glassfish or something else? I prefer web/application server that is fully compatible with JEE6 (unlike Tomcat that can't handle EJB). thanksI'm a JBoss user myself, so naturally I would advise that to you if I were ignorant. I'm not however, so in stead I'll tell you to investigate yourself and see which one you prefer. Nobody is going to tell you which one to use as there is no such thing as a 'better' or 'best' server. Just different servers each with different issues.
    And the community edition of JBoss has had many issues in the past (because Red Hat of course wants to advise you to go to the enterprise platform which ain't cheap), but JBoss 5.1 was a rock solid piece of software that I have had zero problems with (after reading the odd forum or two). JBoss 6 builds on top of JBoss 5.1 and provides the full JEE6 web profile; this means it does NOT provide a certified 'full' JEE6 stack yet. This means nothing however as all the services you may need in an enterprise application are already there.
    BTW: for simple servlet programming, don't neglect Apache Tomcat. Its a lightweight server that just works.

  • Not able to display data in different columns using Unicode encoding

    Hi,
    Iam using Unicode encoding in my Java appln to support Japanese characters while downloading CSV report. But using the Unicode encoding displays all data in the first column of Excel sheet.
    Please let me know how to display data in different columns using Unicode encoding in Excel sheet.

    Hi Venkat,
    After extracting data into DSO check the request whether active or not.
    Check data in DSO in contents.
    If is there any restrictions on info providers in Queries.
    Let us know status clearly.......
    Reg
    Pra

  • Upload video by using jsp/servlet

    I'm using jsp/servlet to upload video file but I have a problem.
    This error occurs for preparing SQL statement when I cast OraclePreparedStatement.
    It is " Error : weblogic.jdbc.rmi.SerialPreparedStatement
    at jsp_servlet._upload._jspService(_upload.java:185)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:263)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2390)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:1959)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)"
    Please help me asap.
    Thanks

    You need to use the Oracle jdbc driver. Apparently, the Weblogic JDBC driver is being selected:
    weblogic.jdbc.rmi.SerialPreparedStatement
    The Oracle JDBC classes can be found in <ORACLE_HOME>/jdbc/lib/See <ORACLE_HOME>/jdbc/readme.txt for how to specify the correct class path in the application.
    I would have thought that the oracle JDBC driver would have been selected (if in the classpath) or an exception would be raised if the Oracle JDBC driver was not found.... because the code should include:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    This should load the Oracle jdbc driver and classes, not the weblogic ones. IF the Oracle JDBC drivers are not found, an exception should be raised...

  • File upload and download using jsp/servlets

    How to upload any file to the server using jsp/servlets. . Help me out

    You can also try the Jenkov HTTP Multipart File Upload. It's a servlet filter that is easy to add to your web-project. After adding it, you can access both request parameters and the uploaded files easily. It's more transparent than Apache Commons File Upload. There is sufficient documentation to get you started, and there is a forum if you have any questions.
    Jenkov HTTP Multipart File Upload is available under the Apache license, meaning its free to use.

  • Controlling the data formatting in excel using jsp.

    Hi,
    How to controlling the data formatting in excel using jsp with out using external jar files such as "jexcel" and "POI". And one more limitation is that it should be compatible with java 1.2.1

    dineshniot wrote:
    Hi - Is there any possibility to automatically display the chart for the logged datas using write to measurement file or write to data file? Please let me know as soon as possible.
    Thanks and Regards,
    Dinesh
    As an aside, "data" is already a plural.  The singular is "datum."
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Create login page using jsp, servlet  & Oracle

    hi,
    i need the sample application for creating login page using jsp, servlet & Oracle,can you please post one sample application.
    thanks
    sona

    See
    http://www.oracle.com/technology/products/jdev/collateral/papers/10g/adfstrutsj2eesec.pdf
    Frank

  • Examination system using JSP/SErvlet and MySQL

    Hi
    I am new to JSP /servlet.
    I am designing online examination system using JSP/Servlet and MySQL ,where multiple choice questions would be selected randomly from the database. After completion of the examination user gets the results ,also the results would be stored in the database for the future reference.
    Can anyone guide me for this? If possible give me the code for similar type of application.
    Thanks

    Sounds like you want someone else to do your homework for you, did you not read this:
    "This forum works so much better when you try to program the code yourself, then let us know where it doesn't work. Otherwise you learn very little, and we work a whole lot."
    and this
    "If you want free code, have you tried searching Google for it? You may want to consider looking for survey software. It will give you the question/answer capabilities then all you have to do is find a way to grade the survey (if you will)...
    If you are using Tomcat as your server, which you probably are, there is a jdbc tutorial included in the documentation, that is the fastest way to set up your database.
    As for your random selection, have a look at Math.random(), this is one way to generate random numbers, you will need an algorithm to convert this value (between 0.0 and 1.0) into a form that can be used to select information from your database.

  • Using JSP/Servlet to write Word Document to BLOB

    Hi
    I need some help pls
    When I use a normal class with a main method, it loads the word document into a blob and I can read this 100%.Stunning.
    With a JSP/Servlet I cannot get the document out again. The "format" seems to be lost.
    Any ideas,help greatly appreciated:
    Here is the Main class that works:
    package mypackage1;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class TestLOB
    //static final Logger logger = Logger.getLogger("test");
    public TestLOB()
    public static void main(String args[])
    TestLOB testLOB = new TestLOB();
    testLOB.TestLOBInsert("c:\\my_data\\callcenterpilot.doc");
    public void TestLOBInsert(String fileName)
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    File binaryFile = new File(fileName);
    System.out.println("Document length = " + binaryFile.length());
    FileInputStream instream = new FileInputStream(binaryFile);
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    DriverManager.registerDriver(new OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@oraclu5:1600:dwz110","so_cs","so_cs");
    catch (Exception ex)
    System.out.println("Error getting conn"+ex.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.out.println("Error closing connection in get last imei"+se.toString());
    Works fine:
    Here is the display servlet: Works when main class inserts file
    package mypackage1;
    import java.io.InputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class DisplayLOB extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    static final Logger logger = Logger.getLogger(DisplayLOB.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    //response.setContentType(CONTENT_TYPE);
    //PrintWriter out = response.getWriter();
    Connection conn = null;
    PreparedStatement pstmt = null;
    try
    conn = getConnection("wizard");
    //out.println("<html>");
    //out.println("<head><title>DisplayLOB</title></head>");
    //out.println("<body>");
    //out.println("<p>The servlet has received a POST. This is the reply.</p>");
    InputStream is=null;
    oracle.sql.BLOB blob=null;
    response.setContentType("application/msword");
    //response.setContentType("audio/mpeg");
    OutputStream os = response.getOutputStream();
    String term = "1";
    String query = "SELECT docdetail FROM testlob WHERE docno = 1";
    pstmt = conn.prepareStatement(query);
    ResultSet rs = pstmt.executeQuery();
    while (rs.next())
    blob=((OracleResultSet)rs).getBLOB(1);
    is=blob.getBinaryStream();
    int pos=0;
    int length=0;
    byte[] b = new byte[blob.getChunkSize()];
    while((length=is.read(b))!= -1)
    pos+=length;
    os.write(b);
    }//try
    catch (Exception se)
    se.printStackTrace();
    finally
    try
    pstmt.close();
    catch (Exception ex)
    System.out.println("Error closing pstmt "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    logger.fatal("Error getting connection: ",se);
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    logger.error("Error closing connection in get last imei",se);
    Here is JSP/Servlet
    <%@ page import="org.apache.log4j.*"%>
    <%@ page contentType="text/html; charset=ISO-8859-1" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>untitled</title>
    <title>Wizard SMS Interface</title>
    <link rel='stylesheet' type='text/css' href='main1.css'>
    <script language='JavaScript' src='copyright.js'></script>
    </head>
    <pre>
    <%
    //HTTP 1.1
    response.setHeader("Cache-Control","no-cache");
    //HTTP 1.0
    response.setHeader("Pragma","no-cache");
    //prevents caching at the proxy server
    response.setDateHeader ("Expires", 0);
    Logger logger = Logger.getLogger("co.za.mtn.wizard.administration.admin01.jsp");
    %>
    </pre>
    <body>
    <FORM ACTION="/WizardAdministration/uploadfile"
    METHOD="POST"
    ENCTYPE="multipart/form-data">
    <INPUT TYPE="FILE" NAME="example">
    <INPUT TYPE="SUBMIT" NAME="button" VALUE="Upload">
    </FORM>
    </body>
    </html>
    <font> <b>Copyright &copy;
    <script>
    var LMDate = new Date( document.lastModified );
    year = LMDate.getYear();
    document.write(display(year));
    </script>
    Mobile Telephone Networks.
    <p align="left"><i><b><font face="Georgia, Times New Roman, Times, serif" size="1"></font></b></i></p>
    package co.za.mtn.wizard.admin;
    import java.io.InputStream;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class UploadFile extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    //static final Logger logger = Logger.getLogger(UploadFile.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    String headerName = null;
    Enumeration en = request.getHeaderNames();
    try
    while ( en.hasMoreElements() )
    Object ob = en.nextElement();
    headerName = ob.toString();
    System.out.println("Value for headerNAme is >"+headerName+"<");
    String aaa = request.getHeader(headerName);
    System.out.println("Value for aa is >"+aaa+"<");
    catch (Exception ex)
    System.out.println("Error in extracting request headers"+ex.toString());
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    //File binaryFile = new File("h:\\callcenterpilot.doc");
    //System.out.println("Document length = " + binaryFile.length());
    //FileInputStream instream = new FileInputStream(binaryFile);
    response.setHeader("Content-Type","application/vnd.ms-word");
    String contentType = request.getContentType();
    System.out.println("Content type received in servlet is >"+contentType+"<");
    ServletInputStream instream = request.getInputStream();
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    System.err.println("Error getting connection: "+se.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.err.println("Error closing connection in get last imei"+se.toString());
    This is what the display servlet is showing when the JSP/Servlet insert the document
    -----------------------------7d31422224030e
    Content-Disposition: form-data; name="example"; filename="H:\(your name) Skills Matrix.doc"
    Content-Type: application/msword
    �� ࡱ � > ��     � � ���� � � ���������������������
    Tks
    Andre

    hello,
    there are multiple documents out there, describing the oracle reports server setup. try doc.oracle.com for documentation.
    also it is part of the online-documentation.
    you need to install 9iAS enterprise edition. the server is pre-configured and will listen to the url http://yourserver/dev60cgi/rwcgi60.exe
    passing only this url you will get a help-screen, describing the syntax.
    regards,
    the oracle reports team

  • Import contact from gmail yahoo hotmail aol using  jsp servlet

    hey can any one tell me the code to import contact list from gmail yahoo aol hotmail etc using jsp or servlet

    I guess you should look for these companies' Java APIs. Some of them (not sure if the ones you want) provides soap clients...

  • Different Classloader for JSP, Servlets?

    Hi!
              Does the WL5-JSP-servlet use an other classloader then the other
              servlets??
              I've previous posted an article with the subject "JSP - Servlet - Static
              Code in Classes".
              I will try to describe my problem better:
              At server startup I pass information to my startup servlet, for example
              the user and pw for our connection pool. The startup servlet instanciates
              the class Global which creates a db-pool with the user and pw getting
              from
              the startup-servlet.
              startup-servlet {
              public void init(ServletConfig config)
              Global.init("user","pw");
              The class Global looks like this:
              class Global {
              static {
              // register jdbc driver
              // store file informations
              static public init(string, string) {
              // init the connection pool with user and pw
              static public getConnection() {
              // returns connection from pool
              All our other servlets then just use the methode Global.getConnection()
              and other methods from the class Global.
              All servlets works perfect and can access the db-pool.
              When a jsp-file is called which also uses the methode
              Global.getConnection(), a new Instance of the class Global will be made.
              In order to init all values again, I would have to call the
              Global.init(user, pw) methode again.
              So my question is: Why does the jsp file causes a new instance of the
              class Global?
              Does the WL5-JSP-servlet use an other classloader then the other
              servlets??
              

    I am seeing the problem is sp3. I can't use sp4 becuase form based
              authentication, FBA, was broken. I can only hope that FBA will be
              re-fixed in sp5.
              Kumar Allamraju wrote:
              >
              > If you are seeing this problem in SP4, yes this is a regression in SP4 &
              > SP5. We are already aware of this
              > problem. SP5 will be out in a week or so. But this fix won't be available
              > in SP5. Follow-up with
              > support.
              >
              > --
              > Kumar
              >
              > "Bryon G. Rigg" wrote:
              >
              > > I have an application which has a servlet that controls page navigation
              > > via an xml file. The servlet class is located beneath the
              > > WEB-INF/classes as is the xml file. When I have weblogic pointing to
              > > the app directory, my servlet finds the xml file, using the
              > > Class.getResourceAsStream() method, without a hitch. But when I
              > > package everything up into a war file, and point weblogic at the war
              > > file instead, the servlet can not locate the xml file.
              > >
              > > What gives? Is there some kind of brain-dead classloader being used
              > > for war files versus a normal classloader used for directories? Any
              > > workarounds? And when will sp5 be released? I have been hearing a
              > > week or two for weeks.
              [bryon.vcf]
              

  • Problem storing date in MS Access using JSP

    Hi all,
    Can anyone please help me storing date in MS Access using Java i am getting errors. I think it is probably because MS Access take "date/month". I am entering a string with date and month example
    1st October as "0110". I don't know how to enter a date in MS Access.
    Here is my code.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <%@page import="java.io.*"%>
    <%@page import="java.sql.*"%>
    <HTML>
    <HEAD>
    <TITLE>  </TITLE>
    </HEAD>
    <BODY>
    <%
       String emplno = request.getParameter("emplno");
       String date = request.getParameter("date");
       String proposal = request.getParameter("proposals");
       String network1 = request.getParameter("network");
       String suppassociates = request.getParameter("suppasso");
       String intmngt = request.getParameter("intmgt");
       String client[] = request.getParameterValues("client");
       String client1= request.getParameter("client1");
       String clientunit[] = request.getParameterValues("clientunit");
       String clientunit1=request.getParameter("clientunit1");
       int staffid = Integer.parseInt(emplno);
       double proposalunit=Double.parseDouble(proposal);
       double suppliersunit=Double.parseDouble(suppassociates);
       double networkunit=Double.parseDouble(network1);
       double internalmgtunit=Double.parseDouble(intmngt);
       Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
       Connection con = DriverManager.getConnection("jdbc:odbc:finalmp" );
       String activities= "INSERT INTO StaffActivities (StaffID,Date,ProposalUnit,NetworkingUnit,SuppliersAssociatesUnit,InternalMGTUnit) VALUES (?,?,?,?,?,?)";
       PreparedStatement pstmt = con.prepareStatement(activities);
       pstmt.setInt(1,staffid);
       pstmt.setString(2,date);
       pstmt.setDouble(3,proposalunit);
       pstmt.setDouble(4,suppliersunit);
       pstmt.setDouble(5,networkunit);
       pstmt.setDouble(6,internammgtunit);
       pstmt.executeUpdate();
       //String emplno="hello";
       //String entered_date="hello";
       //int access_date=0;
       //int user_date=0;
       if(pstmt!=null)
         pstmt.close();
       if(con!=null)
         con.close();
    %>  
    </BODY>
    </HTML>

    i hope this can help you
    public static String convertToISOFormat(Date dateTime) {
            // ISO Format: 'YYYY-MM-DD HH:MM:SS'
            String returnValue = fillLeft(String.valueOf(dateTime.getYear()+1900), 4,
                    '0')
                    + "-"
                    + fillLeft(String.valueOf(dateTime.getMonth()+1), 2, '0')
                    + "-"
                    + fillLeft(String.valueOf(dateTime.getDate()), 2, '0')
                    + " "
                    + fillLeft(String.valueOf(dateTime.getHours()), 2, '0')
                    + ":"
                    + fillLeft(String.valueOf(dateTime.getMinutes()), 2, '0')
                    + ":" + fillLeft(String.valueOf(dateTime.getSeconds()), 2, '0');
            return returnValue;
        }

  • Determin how many user log on the site using JSP/Servlet?

    Hi all,
    Is there a way to determine how many user log on the site using JSP/Sevlet? I'm running Apache 2.x & Tomcat 4.x
    I'm trying to get a list of user currently log in the site.
    Please help!
    Thanks,
    -JN-

    You could use the HttpSessionBindingListener interface. Every time a user logs into the session put a user object into the session. The user object will implement the HttpSessionBindingListener interface. When the user object is added to a sessiion it recieves an event and it increments a counter. When the session times out or you invalidate the session because the user has logged out the user object will recieve an event and it can then decrement the counter.
    This will at least tell how many active user sessions there are.

Maybe you are looking for

  • Aspect ratio problem with consumer camera and Premiere Elements 11

    Hello everyone - I'm Steve. I'm new here. I do still photography on a pro level, digital and analog, but I am an absolute dummy with video...but then, I don't want to do much, just rudimentarily cut a few family videos, upload them, etc. However, I c

  • Why must I return a device I own?

    I have a device I have had for 2 years and am NOT on the edge program. Why must I return it if I want to upgrade early on the edge? I can understand going from edge to edge but I OWN my device and it is NOT on the edge program currently.

  • How text getting printed?

    Hi experts, I am creating a text template for my client. In the text template my client wants to know which text is getting copied from quotation to order, order to delivery, delivery to invoice and also my client wants to know which the text is gett

  • Fonts for HDTV Broadcast Design in Australia (PAL)

    Hello again everyone, I am researching deeper into the topic of Broadcast Design, specifically for HD & SD Digital TV in Australia. I want to use Photoshop to produce a graphic for HDTV(1920 * 1080)and then import it into Final Cut Pro HD to composit

  • Ipod screen shows only Apple logo

    i Just updated Itunes, and was going to put in some music when the ipod check or something popped up and closed itunes, and disconnected my ipod from the computer. I took a look at my pod, and all i could see was the apple logo refreshing and unrefre