Date Header from JSP

Has anyone managed to set the date header in a JSP file?
I'm generating an XML file - response.setContentType("text/xml");
and I want IE7 to be able to cache the file but the Date Header seems to get filled in on my behalf at the end of the page even though I have :
response.addHeader("Date", "Tue, 12 Feb 2008 10:00:00 GMT");
I've tried setHeader and the addDateHeader/setDateHeader alternatives.
I've set the cache-control but I can see using Fiddler that the Date Header of the reply is just set to the current date/time which forces IE7 to do a full load.
Thanks.

Have you also tried: response.setHeader("Cache-Control", "post-check=####"); with #### = some number?
Microsoft calls this "lazy update" see http://support.microsoft.com/kb/843526/en-us:
A Post-check directive is a cache-control directive that is included with the HTTP Expires header. Web sites use the HTTP Expires header to control how Internet Explorer caches content on the Web site. Post-check defines a time interval (in seconds) that defines after which an object must be checked for "freshness". This check allows Internet Explorer to display the content from its cache or in the Temporary Internet Files folder, and then update the cached copy of the content in the background. This update is also known as a lazy update.
But they don't really document this well. Do you get the same result using other browsers?
Finally I'd recommend that you ask this question at the http://forum.java.sun.com/index.jspa forums. The forum you have posted to here is specific to the Sun Java Studio Enterprise IDE developer tool, and since your question is not tool specific, you will receive very few responses to your post here.
Regards,
-Brad Mayer

Similar Messages

  • Adf-Struts/JSP/BC4J- and setting date fields from jsp

    Hi,
    I'm working with the new ADF Frameworks (JDev 9.0.5.1) and ran into some questions regarding exception handling using BC4J, Struts and JSPs.
    I have a DATE column in database and an entity and VO with a datefield with type oracle.jbo.domain.Date.
    My JSP shows a textfield and the user should enter a valid date. Everything fine, until date is of wrong format or contains illegal characters...
    Problem:
    ADF tries to do a setAttribute on the datefield in VO row which expects a parameter with type oracle.jbo.domain.Date. When the user entered e.g. "NiceWeather" as date, I get an IIlegalArgumentException while converting to the correct Date format. This exception isn't thrown by bc4j as AttrValException and therefore my JSP renders a global error instead of a message directly behind the date field.
    I tried to validate the datefield in my DataForm and in my Action in the validateModelUpdates() method, but with no fitting solution.
    Any ideas how to validate a datefield with adf/struts/jsp/bc4j?
    Thanks for your help!
    Torsten.

    Torsen - In the first instance I'd recommed that you try and handle it declaritively using the Struts Validator Framework . See http://otn.oracle.com/products/jdev/howtos/10g/StrutsValidator/struts_validator_howto.html
    There is a section in there on how to use the validator with ADF databound pages and you can check the format the user enters via generated JavaScript.
    Also check out the matching sample project:
    http://otn.oracle.com/sample_code/products/jdev/10g/ADFandStrutsValidator.zip - this has a data field check on it as well

  • Trying to call a data bean from jsp

              I get the following error:
              C:\bea\user_projects\infologic1\.\myserver\.wlnotdelete\extract\myserver_BibleApp_BibleApp\jsp_servlet\__menu.java:146:
              cannot resolve symbol
              probably occurred due to an error in /menu.jsp line 27:
              Enumeration.categoryIds = categories.keys();
              code:
              menu.jsp
              <%@page import="java.util.*"%>
              <jsp:useBean id="DbBean" scope="application" class="showMeItNow.DbBean"/>
              <%
              String base = (String) application.getAttribute("base");
              %>
              <table width="150" cellpadding="5" height="75" cellspacing="0" border="0">
              <tr>
              <td>
              <form>
              <input type="hidden" name="action" value="search">
              <input type="text" name="keyword" size="10">
              <input type="submit" value="go">
              </form>
              </td>
              </tr>
              <tr>
              <td>category</td>
              </tr>
              <tr>
              <tr valign="top">
              <%
              Hashtable categories = DbBean.getCategories();
              Enumeration.categoryIds = categories.keys();
              while (categoryIds.hasMoreElements()) {
              Object categoryId = categoryIds.nextElement();
              out.println("<a href=" + base + "? action=browseCatalog&categoryId="
              + categoryId.toString() + ">" + categories.get(categoryId) + "</a><br>");
              %>
              web.xml
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
              "http://java.sun.com/dtd/web-app_2_3.dtd">
              <web-app>
                   <servlet>
                        <servlet-name>ControllerServlet</servlet-name>
                        <servlet-class>ControllerServlet</servlet-class>
              <init-param>
                   <param-name>base</param-name>
                   <param-value>http://localhost:7001/BibleApp/</param-value>
              </init-param>
              <init-param>
                   <param-name>imageURL</param-name>
                   <param-value>http://localhost:7001/BibleApp/</param-value>
              </init-param>
              <init-param>
                   <param-name>dbURL</param-name>
                   <param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
              </init-param>
              <init-param>
                   <param-name>usernameDbConn</param-name>
                   <param-value>dinesh</param-value>
              </init-param>
              <init-param>
                   <param-name>passwordDbConn</param-name>
                   <param-value>passs</param-value>
              </init-param>
              </servlet>
              </web-app>
              DbBean.class
              package showMeItNow;
              import java.util.*;
              import java.sql.*;
              import showMeItNow.Poll;
              public class DbBean {
              public String dbUrl="";
              public String dbUserName="";
              public String dbPassword="";
              public void setDbUrl(String url) {
              dbUrl=url;
              public void setDbUserName(String userName) {
              dbUserName=userName;
              public void setDbPassword(String password) {
              dbPassword=password;
              public Hashtable getCategories() {
              Hashtable categories = new Hashtable();
              try
              Connection connection = DriverManager.getConnection(dbUrl, dbUserName,
              dbPassword);
              CallableStatement cstmt = connection.prepareCall("{? = call dbo.categoryListing()}");
              //register the stored procedure's output paramater!!!
              cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
              cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
              ResultSet rs = cstmt.executeQuery();
              while (rs.next()) {
              categories.put(rs.getString(1), rs.getString(2) );
              rs.close();
              cstmt.close();
              connection.close();
              catch (SQLException e) {  }
              return categories;
              

    You might want to look at whether there is any data being fetched from
              the DB. Use some System.out.println()'s in the code where you fetch the
              data from the stored proc.
              Another way might be to comment out the database code, add some dummy
              values into the hastable and make sure that the page comes up as you
              expect.. and then go ahead with the database thingy..
              Nagesh
              dinesh wrote:
              > Thanks, the page is loading up. But, it is just blank. It is not displaying the
              > hastable data. Any ideas?
              >
              > thanks again,
              > Dinesh
              >
              > Nagesh Susarla <[email protected]> wrote:
              >
              >>>Enumeration.categoryIds = categories.keys();
              >>
              >>try replacing the dot '.' with a space and it should be all fine ..
              >>maybe a typo.
              >>
              >>Enumeration categoryIds = categories.keys();
              >>
              >>--
              >>Nagesh
              >>
              >>
              >>dinesh prasad wrote:
              >>
              >>>I get the following error:
              >>>
              >>>C:\bea\user_projects\infologic1\.\myserver\.wlnotdelete\extract\myserver_BibleApp_BibleApp\jsp_servlet\__menu.java:146:
              >>>cannot resolve symbol
              >>>probably occurred due to an error in /menu.jsp line 27:
              >>>Enumeration.categoryIds = categories.keys();
              >>>
              >>>
              >>>code:
              >>>
              >>>menu.jsp
              >>>----------
              >>><%@page import="java.util.*"%>
              >>><jsp:useBean id="DbBean" scope="application" class="showMeItNow.DbBean"/>
              >>>
              >>><%
              >>> String base = (String) application.getAttribute("base");
              >>> %>
              >>>
              >>>
              >>><table width="150" cellpadding="5" height="75" cellspacing="0" border="0">
              >>><tr>
              >>><td>
              >>><form>
              >>><input type="hidden" name="action" value="search">
              >>><input type="text" name="keyword" size="10">
              >>><input type="submit" value="go">
              >>></form>
              >>></td>
              >>></tr>
              >>><tr>
              >>><td>category</td>
              >>></tr>
              >>><tr>
              >>><tr valign="top">
              >>>
              >>> <%
              >>> Hashtable categories = DbBean.getCategories();
              >>> Enumeration.categoryIds = categories.keys();
              >>> while (categoryIds.hasMoreElements()) {
              >>> Object categoryId = categoryIds.nextElement();
              >>> out.println("<a href=" + base + "? action=browseCatalog&categoryId="
              >>>+ categoryId.toString() + ">" + categories.get(categoryId) + "</a><br>");
              >>>}
              >>>
              >>> %>
              >>>-------------------------------------------------------------------------------------
              >>>
              >>>web.xml
              >>><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              >>
              >>2.3//EN"
              >>
              >>>"http://java.sun.com/dtd/web-app_2_3.dtd">
              >>>
              >>><web-app>
              >>>     <servlet>
              >>>          <servlet-name>ControllerServlet</servlet-name>
              >>>          <servlet-class>ControllerServlet</servlet-class>
              >>>     
              >>><init-param>
              >>>     <param-name>base</param-name>
              >>>     <param-value>http://localhost:7001/BibleApp/</param-value>
              >>></init-param>
              >>>
              >>><init-param>
              >>>     <param-name>imageURL</param-name>
              >>>     <param-value>http://localhost:7001/BibleApp/</param-value>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>dbURL</param-name>
              >>>     <param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
              >>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>usernameDbConn</param-name>
              >>>     <param-value>dinesh</param-value>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>passwordDbConn</param-name>
              >>>     <param-value>passs</param-value>
              >>></init-param>
              >>> </servlet>
              >>></web-app>
              >>>     
              >>>          
              >>>-----------------------------------------------------------------------
              >>>DbBean.class
              >>>
              >>>package showMeItNow;
              >>>
              >>>import java.util.*;
              >>>import java.sql.*;
              >>>import showMeItNow.Poll;
              >>>
              >>>public class DbBean {
              >>> public String dbUrl="";
              >>> public String dbUserName="";
              >>> public String dbPassword="";
              >>>
              >>> public void setDbUrl(String url) {
              >>> dbUrl=url;
              >>> }
              >>>
              >>> public void setDbUserName(String userName) {
              >>> dbUserName=userName;
              >>> }
              >>>
              >>> public void setDbPassword(String password) {
              >>> dbPassword=password;
              >>> }
              >>>
              >>> public Hashtable getCategories() {
              >>> Hashtable categories = new Hashtable();
              >>> try
              >>> {
              >>> Connection connection = DriverManager.getConnection(dbUrl,
              >>
              >>dbUserName,
              >>
              >>>dbPassword);
              >>>
              >>> CallableStatement cstmt = connection.prepareCall("{?
              >>
              >>= call dbo.categoryListing()}");
              >>
              >>> //register the stored procedure's output paramater!!!
              >>> cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
              >>> cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
              >>> ResultSet rs = cstmt.executeQuery();
              >>> while (rs.next()) {
              >>> categories.put(rs.getString(1), rs.getString(2) );
              >>> }
              >>> rs.close();
              >>> cstmt.close();
              >>> connection.close();
              >>> }
              >>> catch (SQLException e) {  }
              >>> return categories;
              >>> }
              >>>
              >>>}
              >>>
              >>>
              >>>
              >>
              >
              

  • Insert data into table from JSP page using Entity Beans(EJB 3.0)

    I want to insert data into a database table from JSP page using Entity Beans(EJB 3.0).
    1. I have a table 'FRIENDS', (in Oracle 10g database).
    2. It has two columns, 'NAME' and 'CITY'. Both have datatype strings(varchar2).
    3. Now from a JSP page, having two textfields, 'NAME' and 'CITY', I want to insert data into table 'FRIENDS'.
    4. In between JSP and database is a Entity Bean(EJB 3.0) and a stateless session bean.
    5. I am using JDev as editor.
    Please provide me code ASAP or link with similar example.
    Thank you.
    Anurag

    Hi,
    I am also trying that scenario. So u can
    Post the jsp form data to a Servlet which will act as a Controller.
    In the servlet invoke the business method.
    Similar kind of app is in www.roseindia.net
    Hope this would help u.
    Meanwhile if u get any optimal solution, pls post it.
    Thanks,
    Happy Java Coding.

  • Need help in writing data from JSP to excel

    Hi ,
    I need help in writing the data from JSP to excel.I somehow able to retrieve the data into excel but unable to get the required format.
    For eg: The amount should be displayed in 0.00 format .when i am exporting it to excel it is displaying as 0 :( .
    I am using the following code in JSP.
    "out.print(amt + '\t');"
    Would like to know if there is any otherway where in i can get my requirement.
    Thanks
    Tom

    Hi,
    Try using format part of the JSTL tag libs.
    Syntax :
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <fmt:formatNumber value="40" pattern="$#,##0.00"/>
    I need help in writing the data from JSP to excel.I
    somehow able to retrieve the data into excelHow do u convert the jsp to excel?
    One way to convert the jsp page to excel, is to render it as an excel appl instead of html. Set the content type of the response to application/ms-excel.
    response.setContentType("application/ms-excel")Hope this Helps....

  • Pass the data back from the jsp page to the java code

    Hi,
    I have written an iView that receives an event using EPCF and extracts data from the client data bag.
    I need this iView to pass the data back from the jsp page to the java code.
    I am trying to do this using a hidden input field, but I cannot get the code to work.
    Here is the code on the jsp page.
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId">
    <hbj:inputField id="myInputField" type="string" maxlength="100" value="" jsObjectNeeded="true">
    <% myInputField.setVisible(false);%>
    </hbj:inputField>      
       </hbj:form>
      </hbj:page>
    </hbj:content>
    <script language=JavaScript>
    EPCM.subscribeEvent("urn:com.peter", "namedata", window, "eventReceiver");
    function eventReceiver(eventObj) {
         var url = eventObj.dataObject;
         var funcName = htmlb_formid+"_getHtmlbElementId";
         func = window[funcName];
         var ipField = eval(func("myInputField"));
         ipField.setValue(url);
         var form = document.all(htmlb_formid);
         form.submit();
    </script> 
    Here is my java code
    package com.sap.training.portal;
    import com.sapportals.htmlb.InputField;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.page.PageException;
    import com.sapportals.portal.htmlb.page.JSPDynPage;
    import com.sapportals.portal.htmlb.page.PageProcessorComponent;
    public class ListSalesOrder extends PageProcessorComponent {
      public DynPage getPage(){
        return new ListSalesOrderDynPage();
      public static class ListSalesOrderDynPage extends JSPDynPage{
         private String merong;
        public void doInitialization(){
        public void doProcessAfterInput() throws PageException {
              InputField reportfld = (InputField) getComponentByName("myInputField");
              if (reportfld != null)      merong = reportfld.getValueAsDataType().toString();
        public void doProcessBeforeOutput() throws PageException {
              if ( merong != null ) setJspName("merong.jsp");
              else setJspName("ListSalesOrder.jsp");
    Here is DD
    <?xml version="1.0" encoding="utf-8"?>
    <application>
      <application-config>
        <property name="SharingReference" value="com.sap.portal.htmlb"/>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
      </application-config>
      <components>
        <component name="SearchSalesOrder">
          <component-config>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="/pagelet/SearchSalesOrder.jsp"/>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
          </component-profile>
        </component>
        <component name="ListSalesOrder">
          <component-config>
            <property name="ClassName" value="com.sap.training.portal.ListSalesOrder"/>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
          </component-profile>
        </component>
      </components>
      <services/>
    </application>
    After receive event, then call java script function "eventReceiver" and call "form.submit()".
    But .. PAI Logic in Java code doesn't called ...
    Where is my problme ?
    Help me ...
    Regards, Arnold.

    Hi Arnold,
    you should not do a form.submit yourself. Instead you can put a component called ExternalSubmit to your page:
    ExternalSubmit exSubmit = new ExternalSubmit("EX_SUBMIT"));
    exSubmit.setServerEventName("MyEvent");
    This results in a java script funtion on the page which is called "_htmlb_external_submit_". If you call this function the the form gets submitted and your event handler is called.
    regards,
    Martin

  • Sending binary data from JSP (1.1)

    Hi all:
    I am using Tomcat 3.2.1 and Apache under Linux Mandrake OS.
    I have a JSP (1.1) sending binary data (GIF, PDF, DOC ..) using response.getOutputStream().write(data)
    method.
    The problem is the precompiler automatically creates the JspWriter and puts some out.write("\r\n") lines
    before I use getOutputStream method. The JVM throws an IllegalStateException because I am using both
    methods (this is from Servlet 2.2 specification).
    Must I change my code to forwarding to a servlet that make this work or is there a simple solution to
    avoid this?
    Thanks in advance.
    J.
    null

    Hi Shreeharsha
    Please refer to below docs for sending data from JSP page to RFC. In which you need to use sap connectors for connecting to SAP backend system.
    http://help.sap.com/saphelp_nw04/helpdata/en/b6/55e3952a902447847066a0df27b0d6/content.htm
    Hope it helps
    Regards
    Arun

  • Capturing xml data returned from a url post in a jsp page

    Hi,
    We are writing a interface which will capture data returned from an other website. The data returned will be in XML form.
    http://www.ecrm.staging.twii.net/ecrmfeed/ecrmfeedservices.sps?eCRMFeedInputXml=<twii><ecrmfeedinput><data%20method="Login"><username>[email protected]</username><password>password</password></data></ecrmfeedinput></twii>
    When the above url is executed in a browser, it required NT authentication. The username and password is getcouponed. Once the username and password is fed, we can see the output in the form of a xml. We require the xml in a String variable in a jsp page. We need to know the steps on how to execute the url in a jsp page. We used the url object to do the same, but we get a error saying "java.net.UnknownHostException: www.ecrm.staging.twii.net".
    Can anyone help?
    Regards,
    Gopinath.

    Hi,
    I would like to know if I can use the java.net package to get anything out of a website which requires authentication. In this case NT authentication.
    Thanks in advance,
    Gopinath.

  • Insert date time into oracle database from jsp

    pls tell me ,from jsp how can I insert datetime values into oracle database .I am using oracle 9i .here is codethat i have tried
    html--code
    <select name="date">
    <option selected>dd</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <select name="month">
    <option selected>dd</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <select name="year">
    <option selected>dd</option>
    <option>2004</option>
    <option>2005</option>
    <option>2006</option>
    <option>2007</option>
    </select>
    here the jsp code
    <% date= request.getParameter("date"); %>
    <% month= request.getParameter("month"); %>
    <% year= request.getParameter("year"); %>
    try
    { Class.forName("oracle.jdbc.driver.OracleDriver"); }
    catch (ClassNotFoundException exception)
    try
         Connection connection = null;
         out.println("connectiong the database");
    connection = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcsid","scott","tiger");
    out.println("connection getted");
         int rows = 0;
         String query_2 = "insert into mrdetails values(?)";
         String dob = date+month+year;
         prepstat = connection.prepareStatement(query_2);
         prepstat.setTimestamp(4,dob);
         rows = prepstat.executeUpdate();
         out.println("data updated");
    catch (Exception exception3)
    out.println("Exception raised"+exception3.toString());
    }

    To insert date values into a database, you should use java.sql.Date. If it also has a time component, then java.sql.TimeStamp.
    Your use of prepared statements is good.
    You just need to convert the parameters into a date.
    One way to do this is using java.text.SimpleDateFormat.
    int rows = 0;
    String query_2 = "insert into mrdetails values(?)";
    String dob = date+"/" + month+ "/" + year;
    SimpleDateFormat sdf = new SImpleDateFormat("dd/MM/yyyy");
    java.util.Date javaDate = sdf.parse(dob);
    java.sql.Date sqlDate = new java.sql.Date(javaDate .getTime);
    prepstat = connection.prepareStatement(query_2);
    prepstat.setTimestamp(4,sqlDate);
    rows = prepstat.executeUpdate();
    out.println("data updated");Cheers,
    evnafets

  • Need help in fetching requested data from JSP

    Hello,
    I really need help in fecthing requested data from JSP to servlet. Can anyone assist me as soon
    as possible because I must finish my program by today.....( 20/02/2002).
    Thanks in advance.

    It is very likely that somebody can help you, if you say what your problem is. In fact somebody might already have helped you. What is your problem?

  • Inserting data from jsp form to multiple tables !

    Hi,
    I want to insert data from jsp form to two tables
    tables are
    (1) Form
    formId (PK)
    deptName
    (2) Data
    formId (FK)
    sNo
    description
    itemCode
    and the problem is that i want to save information form a jsp form to above two tables and i have only one form.
    so how do i insert data from a jsp form to multiple tables.

    You already know what your form in the jsp will be and what fields they are. You also already know what your database looks like. Using one form, you should be able to break the data down, and give it certain ids and/or names, so that when the form is submitted, you retrieve the correct values corresponding to a specific field and insert it.
    Unless there is something else I am not catching, this seems pretty straight forward.

  • Export data from JSP to Excel on click on button

    Hi,
    I want to display the table data in my Jsp to Excel on click of "Export to Excel" icon, The data in my jsp table is dynamic, only click of "export to Excel" icon i want the contents of the table needs to be exported to Excel. Can pls anyone help me in doing this..
    Thanks & Regards
    Sowmya.J

    On click of the button, you will have to reuse the same java code which you used to populate the table in the JSP except that you will have to create an excel file with the data you got using suitable excel api's (look for POI api). Write the stream to the response and the browser will take care of opening a dialog to save/open the file.

  • Crystal report from JSP using the JRC

    Hi, I am trying to call crystal report from JSP using the JRC.
    But i am getting the Error as 'Logon Failed'. my web.xml entry is
    <env-entry>
    <env-entry-name>jdbc/Test</env-entry-name>
    <env-entry-value>!oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:{userid}/{password}@//10.0.0.1:1521/TestDB</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
    i am setting the userid and password in the code. Please see the below code for your reference. Please help me to solve the issue.
    <%@ page language="java" contentType="text/html;charset=UTF-8"%>
    <%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSource" %>
    <%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSource" %>
    <html>
    <head>
    <title>Crystal Report with Database Logon information</title> </head>
    <body bgcolor="#ffffff">
    <%
    try
    String report = "/TEMPLATE.rpt";
    IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
    JPEReportSource reportSource = (JPEReportSource) rptSrcFactory.createReportSource(report, request.getLocale());
    CrystalReportViewer viewer = new CrystalReportViewer();
    viewer.setReportSource(reportSource);
    viewer.setHasRefreshButton(true);
    IConnectionInfo newConnInfo = new ConnectionInfo();
    newConnInfo.setUserName("TEST");
    newConnInfo.setPassword("TEST");
    ConnectionInfos newConnInfos = new ConnectionInfos();
    newConnInfos.add(newConnInfo);
    viewer.setDatabaseLogonInfos(newConnInfos);
    viewer.setEnableLogonPrompt(false);
    viewer.setOwnPage(true);
    viewer.setOwnForm(true);
    out.println("Connection Information: "+viewer.getDatabaseLogonInfos().getConnectionInfo(0).getAttributes().toString());
    viewer.processHttpRequest(request, response, getServletConfig().getServletContext(),null);
    viewer.dispose();
    catch(Exception e)
    throw new JspException( e);
    %>
    </body>
    </html>

    I never really had much luck with this approach.
    Mind you I was using Crystal Reports 10, and as far as I recall it didn't allow setting/changing of database at this level.
    Things to check
    - can you create a database connection on your page with this URL/username/password?
    - what server are you using? Tomcat? WebLogic?
    I found this in your other post:
    Connection Information: {Server Name=ee6rpt, Connection String=DSN=s(ee6rpt);User ID=s(ee62test);Password=;UseDSNProperties=b(false), Database Name=, Database DLL=crdb_odbc.dll}That would indicate it is using odbc to connect to the database (crdb_odbc.dll). ODBC is a bad idea with java.
    The way I have got it to work for me (after much trial and error) was to in Crystal Reports to connect using the Oracle Driver, and specifying a tnsname - eg define REPORT_DS in tnsnames.ora.
    When running through the JRC, it looked for a JNDI datasource under that same name "REPORT_DS".
    Don't know if that will help you or not.
    Good luck,
    evnafets

  • Sending file from jsp

    Dear Friends,
    I copied all the jar files (mail.jar, activation.jar, smtp.jar..etc.,) to jakarta's lib directory.
    But when i run sendmail.jsp program, exception is raising.
    =======================================
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile C:\jakarta-tomcat-3.3a\work\DEFAULT\examples\jsp\sendmail_1.java:8: Package javax.mail not found in import.
    import javax.mail.*;
    ^
    C:\jakarta-tomcat-3.3a\work\DEFAULT\examples\jsp\sendmail_1.java:9: Package javax.mail.internet not found in import.
    import javax.mail.internet.*;
    ^
    C:\jakarta-tomcat-3.3a\work\DEFAULT\examples\jsp\sendmail_1.java:10: Package javax.activation not found in import.
    import javax.activation.*;
    ^
    3 errors
    =======================================
    I already set the classpath for these. and i am able to run on command prompt.
    please help me. if you have any ideas, please share ur ideas.
    Once again thank you very much for your kind cooperation.
    Yours
    Rajesh
    Looking for your reply.
    My Program
    <%@page import="java.io.*"%>
    <%@page import="java.util.*"%>
    <%@page import="javax.mail.*"%>
    <%@page import="javax.mail.internet.*"%>
    <%@page import="javax.activation.*"%>
    <%
    String to = request.getParameterValues("[email protected]")[0];
    String from = request.getParameterValues("[email protected]")[0];
    String host = request.getParameterValues("your.smtp.net")[0];
    String filename = request.getParameterValues("c:/Button.html")[0];
    String msgText1 = "Sending a file.\n";
    String subject = "Sending a file";
    // create some properties and get the default Session
    Properties props = System.getProperties();
    props.put("mail.smtp.host", host);
    Session session = Session.getDefaultInstance(props, null);
    session.setDebug(debug);
    try {
    // create a message
    MimeMessage msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    InternetAddress[] address = {new InternetAddress(to)};
    msg.setRecipients(Message.RecipientType.TO, address);
    msg.setSubject(subject);
    // create and fill the first message part
    MimeBodyPart mbp1 = new MimeBodyPart();
    mbp1.setText(msgText1);
    // create the second message part
    MimeBodyPart mbp2 = new MimeBodyPart();
    // attach the file to the message
    FileDataSource fds = new FileDataSource(filename);
    mbp2.setDataHandler(new DataHandler(fds));
    mbp2.setFileName(fds.getName());
    // create the Multipart and its parts to it
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp1);
    mp.addBodyPart(mbp2);
    // add the Multipart to the message
    msg.setContent(mp);
    // set the Date: header
    msg.setSentDate(new Date());
    // send the message
    Transport.send(msg);
    } catch (MessagingException mex) {
    mex.printStackTrace();
    Exception ex = null;
    if ((ex = mex.getNextException()) != null) {
    ex.printStackTrace();
    %>

    Dear Friend,
    Thank you very much for you reply.
    My Tomcat.bat file is like this
    C:\>cd jakar*.*
    C:\jakarta-tomcat-3.3a>set TOMCAT_HOME=c:\jakarta_tomcat-3.3a
    C:\jakarta-tomcat-3.3a>set java_home=c:/jdk1.3.1
    C:\jakarta-tomcat-3.3a>set path=c:/jdk1.3.1\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System
    32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;c:\jdk1.3.1\bin\;.;
    C:\jakarta-tomcat-3.3a>set TOMCAT_HOME=c:\jakarta-tomcat-3.3a
    C:\jakarta-tomcat-3.3a>set classpath=D:\jaf-1.0.1\activation.jar;.;D:\javamail-1.2\mail.ja
    r;.;c:\jdk1.3.1\lib\tools.jar;.;D:\jaf-1.0.1\activation.jar;D:\javamail-1.2\mail.jar;D:\javamail-1.2\smtp.jar;D:\javamail-1.2\pop3.jar;D:\javamail-1.2\mailapi.jar;
    C:\jakarta-tomcat-3.3a>bin\startup
    Starting Tomcat in new window
    C:\jakarta-tomcat-3.3a>
    =========================
    But still it is saying (when i am trying to run the sendmail.jsp) Internal Server Error : 500
    org.apache.jasper.JasperException: Unable to compile C:\jakarta-tomcat-3.3a\work\DEFAULT\ROOT\sendmail_1.java:6: Package javax.mail not found in import.
    import javax.mail.*;
    ^
    C:\jakarta-tomcat-3.3a\work\DEFAULT\ROOT\sendmail_1.java:7: Package javax.mail.internet not found in import.
    import javax.mail.internet.*;
    ^
    C:\jakarta-tomcat-3.3a\work\DEFAULT\ROOT\sendmail_1.java:8: Package javax.activation not found in import.
    import javax.activation.*;
    ^
    =====================
    please help me.
    Thanks in advance.
    yours
    Rajesh.

  • Anyone know the way to call SQLLoader utility or similar from JSP/Servlet?

    Anyone know the way to call SQLLoader utility or similar from JSP or Servlet?
    i would like to make a big data load from web interface, using SQL Loader or similar, because this utility allows a great performance.
    I think that i can make a JSP or Servlet to open file, and create insert statement into a loop, but the performance is very bad for 30000 inpuits.
    Help me please
    Thanks
    Note: my english is very bad. Sorry.

    Hi there,
    I tried this codes into a Bean like this:
    package com.tuxedo.beans;
    import java.io.*;
    public class TuxTest
         public void RunTest()
              try{
                   Runtime rt = Runtime.getRuntime();
                   Process pr = rt.exec("command /k c:\test.bat");
              } catch (IOException e) {
                   System.err.println("Error: " + e.getMessage());
    }and call it with a JSP like this:
    <html>
    <head><title>Tuxedo Test</title></head>
    <body>
    To run a test on local batch file
    <jsp:useBean id="test1 " class="com.tuxedo.beans.TuxTest"/>
    <jsp: RunTest name="test1"/>
    </body>
    </html>i had created folder %tomcat%\webapps\ROOT\WEB-INF\classes\com\tuxedo\beans to store the bean.
    Yet the JSP file executed, but i dun see any response by calling the batch file, anyone have any idea?
    the batch file is like this:
    @echo off
    echo
    echo Hello World!
    echo
    pausePlease help!

Maybe you are looking for