Regarding history.go() in jsp

hi,
i have 2 jsps the first jsp contains some search creteria after giving the search creteria and click search button the results will display in the same page as a table. after the results one export option also is there if i clilck the results will export to ascii file format and dialog box will come asking open or save. after doing this operation. in the results page that is first page one column has hyperlink if i click that link i will go to next jsp containg details of that particular id. in the second page one button name back will be there if i click that button i must come back to the first page containg the previous search results. i give javascript:history.go(-1) in the button onclick event then its going to the first page but the results and the search creterial is not there, means its going to previous to previous screen. please suggest me in this regards.
Thanks in advance

There is a logger taglib available (on Jakarta) which works with log4j. You can make use of that.
xH4x0r

Similar Messages

  • History problem in jsp page,internet explorer back button

    hi everyone
    i have a jsp page suppose a.jsp.in which i am using dropdown menu to displays:list of data from database,one submit button i am using name select and click here.after selecting the value from dropdown menu ,again some other data will be displayed from some other table in same a.jsp page.
    my problem is:
    when user selects one value from drop down menu ,it is diplaying the value in same page .upto here is ok
    and i click back button from I.E only one page back it is showing
    but when user select the value form drop down menu 2nd time ,and after data get dipalyed in same apge a.jsp.then
    whne i click back button ,now it is showing two a.jsp page .history is not going .
    this is the problem.i dont want to this morw than one page get displayed in back button.only one page a.jsp
    if anyone has understood my problem ,please help.
    thanku

    thanks java2006
    but it is not working .i will try to explain once again
    1. one page called a.jsp.this page contains one drop drown menu list box ,and one submit button.
    2.data in drop dropdown is coming from db.as the user select value from drop down box .relalted value is diplayed on same a.jsp page.
    3.again user select the 2ndvalue from drop down box ,related value is displayed.
    this i explained about my a.jsp page.
    problem is
    4.when user select the 1st value and clcik on submit button related value is displaying.upto here its ok.and in back button of Internet explorer it is showing only one a.jsp page
    5.but whenever i am trying to see 2nd or 3rd or more value from drop down after related value is being diplayed in same a.jsp page.
    the back button of internet exlorer showing two a.jsp page after clcicking submit button
    .as u have told the code aso but it is not working
    i have added ur code indisde html tags .

  • Regarding logout page in jsp and servlets

    Hi Friends,
    I have created a web page for employee details. When employee enters his details that will be stored in database. Now the problem arises with logout page. When user presses logout, the page is redirected to login page. When he presses back button again its getting logging in for the employee who has just logged in. Can anyone guide me how to resolve this problem. When he presses on back button the page should display with warning message that session has expired. Click here to login. I am posting the code what I have done. And if anyone try to solve using servlets and jsp also no issues. I would be grateful if anyone helps me in advance.
    IDE: Netbeans
    Database: MS-Access.
    Code is as follows
    This is html page for employee details:(EmployeeDetails.jsp)
    <html>
    <head>
    <script language=javascript>
    function Value()
    FirstName=document.form1.FirstName.value;
    MiddleName=document.form1.MiddleName.value;
    LastName=document.form1.LastName.value;
    EmployeeID=document.form1.ID.value;
    day=document.form1.select1.value;
    month=document.form1.select2.value;
    year=document.form1.select3.value;
    EmailID=document.form1.EmailID.value;
    if(FirstName=="")
    alert("Enter The FirstName");
    document.form1.FirstName.focus();
    document.form1.FirstName.select();
    return true;
    else if(LastName=="")
    alert("Enter The LastName");
    document.form1.LastName.focus();
    document.form1.LastName.select();
    return false;
    else if(EmployeeID=="")
    alert("Enter EmployeeID");
    document.form1.ID.focus();
    document.form1.ID.select();
    return false;
    else if(isNaN(EmployeeID))
    alert("Enter The EmployeeID in Numbers");
    document.form1.ID.focus();
    document.form1.ID.select();
    return false;
    else if(day=="Day")
    alert("Select The Day");
    document.form1.select1.focus();
    return false;
    else if(month=="Month")
    alert("Select The Month");
    document.form1.select2.focus();
    return false;
    else if(year=="Year")
    alert("Select The Year");
    document.form1.select3.focus();
    return false;
    else if(EmailID=="")
    alert("Enter EmailID");
    document.form1.EmailID.focus();
    document.form1.EmailID.select();
    return false;
    </script>
    </head>
    <body BGCOLOR="#ffffcc">
    <form name=form1 action="val.jsp" method="post" >
    <font color="#FF0000">*</font> <i><b>First Name :  </b></i>         
    <input type="text" name="FirstName" >                                                                                                            
    logout
    <br>
    * <i><b>Middle Name:</b></i>         
    <input type="text" name="MiddleName" size="20"><br>
    <font color="#FF0000">* </font><i><b>Last Name :   </b></i>         
    <input type="text" name="LastName" size="20"><br>
    <font color="#FF0000">*</font> <i><b>EmployeeID:  </b></i>         
    <input type="text" name="ID" size="20" maxlength="5"><br>
                                            (DD)      / (MM)      / (Yr)<br>
    <font color="#FF0000">*</font> <i><b>D.O.J:                      </b></i>
    <select name="select1"> <option value="Day" selected>Day</option>
    <script language=javascript>
    for(i=01;i<=31;i++)
    document.write("<option value="+i+">"+i+"</option>");
    </script>
    </select> /
    <select name="select2">
    <option value=Month selected>Month</option>
    <script language=javascript>
    for(i=01;i<=12;i++)
    document.write("<option value="+i+">"+i+"</option>");
    </script>
    </select> /
    <select name="select3">
    <option value=Year selected>Year</option>
    <script language=javascript>
    for(i=1975;i<=2009;i++)
    document.write("<option value="+i+">"+i+"</option>");
    </script>
    </select>
    <br>
    <font color="#FF0000">*</font> <i><b>EmailID:        </b></i>         
    <input type="text" name="EmailID" ><br>
     <font color="#FF0000">*  </font><i><b>Star with red mark
    indicates Mandatory </b></i>
    <i> <b>Star with black mark indicates Optional</b></i><br>
    <input type="submit" value="Submit" name="Submit" onclick="Value()">
    </form>
    </body>
    </html>
    This is for validation purpose(i.e inserting data into database)
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page language="java" import ="java.sql.*" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <%
    Statement stmt=null;
    ResultSet rs=null;
    Connection con=null;
    String firstname,lastname,empid,day,month,year,emailid,doj;
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con= DriverManager.getConnection("jdbc:odbc:login");
    System.out.println("Database Connected");
    // System.out.println("name : " +request.getParameter("name"));
    firstname=request.getParameter("FirstName");
    lastname=request.getParameter("LastName");
    empid=request.getParameter("ID");
    day=request.getParameter("select1");
    month=request.getParameter("select2");
    year=request.getParameter("select3");
    doj= year + month + day;
    emailid=request.getParameter("EmailID");
    stmt=con.createStatement();
    String query = "insert into EmployeeTable values ('"+firstname+"','"+lastname+"',"+empid+",'"+doj+"','"+emailid+"')";
    int i =stmt.executeUpdate(query);
    if(i==1)
    out.println("Data inserted Successfully");
    else
    out.println("Data insertion failed ");
    catch(ClassNotFoundException ce)
    out.print(ce);
    catch(Exception se)
    out.print(se);
    %>
    </body>
    </html>
    This is code for logout page (logout.jsp)
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <%
    session.invalidate();
    session=request.getSession(true);
    response.setHeader("Cache-Control","no-cache");
    response.setDateHeader("Expires",0);
    response.sendRedirect("Login.jsp");
    %>
    </body>
    </html>
    Another way for logout page what I have tried
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <%
    request.getSession();
    session.invalidate();
    %>
    <jsp:forward page="Login.jsp"/>
    </body>
    </html>
    With Regards,
    V.S.Ravi Kiran Balusu.

    Hi Friends,
    Once again i am posting the code here also....can check it out...
    login.jsp
    <title>Logout Sample JSP 1</title>
    <%
    String error = (String) request.getAttribute("Error");
    if (error != null) {
    out.write("<center><strong>");
    out.write("<font color=\"Red\">");
    out.write(error);
    out.write("</font>");
    out.write("</strong></center>");
    %>
    <form action="loginAction.jsp" focus="userName" method="POST">
    <table class="tborder" width="50%" cellspacing="1" cellpadding="3" align="center">
    <tr>
    <td colspan="2">Please login with a valid user name and password</td>
    </tr>
    <tr>
    <td><font color="Red">*</font>User Name: </td>
    <td>
    <input id="userName" name="userName" type="text" size="20" value=""></input>
    </td>
    </tr>
    <tr>
    <td><font color="Red">*</font>Password: </td>
    <td>
    <input id="password" name="password" type="password" size="20" value=""></input>
    </td>
    </tr>
    <tr>
    <td colspan="2" align="center">
    <input type="submit" id="submit" name="submit" value="Logon"></input>
    </td>
    </tr>
    </table>
    </form>
    loginAction.jsp
    <%@ page import="java.sql.*" %>
    <%
    String userName = request.getParameter("userName");
    String password = request.getParameter("password");
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    RequestDispatcher rd = request.getRequestDispatcher("home.jsp"); //forward to home page by default
    try {
    //Change the next 3 lines to use correct values in your own environment
    String dbURL = "jdbc:mysql://localhost/logoutSamplesdb";
    Class.forName("com.mysql.jdbc.Driver");
    con = DriverManager.getConnection(dbURL, "root", "qut854");
    stmt = con.createStatement();
    rs = stmt.executeQuery("select password from USER where userName = '" + userName + "'");
    if (rs.next()) { //query only returns 1 record in the result set
    if (rs.getString("password").equals(password)) { //if valid password
    session.setAttribute("User", userName); //Saves user name string in the session object
    else { //password does not match,i.e. invalid user password
    request.setAttribute("Error", "Invalid password.");
    rd = request.getRequestDispatcher("login.jsp");
    } //no record in the result set,i.e. invalid user name
    else {
    request.setAttribute("Error", "Invalid user name.");
    rd = request.getRequestDispatcher("login.jsp");
    catch (Exception e) { //database problem
    request.setAttribute("Error", "Problem accessing security realm.");
    rd = request.getRequestDispatcher("login.jsp");
    e.printStackTrace();
    finally {
    try {
    stmt.close();
    con.close();
    catch (Exception ignore) {
    rd.forward(request, response);
    %>
    for home.jsp
    <title>Logout Sample JSP 1</title><%String userName = (String) session.getAttribute("User");
    if (null == userName) {
    request.setAttribute("Error", "Session has ended. Please login.");
    RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
    rd.forward(request, response);
    %>
    Logout
    <p>
    This is home page. This page is pretended to contain secure information.
    </p>
    logout.jsp
    <title>Logout Sample JSP 1</title><%String userName = (String) session.getAttribute("User");
    if (null == userName) {
    request.setAttribute("Error", "Session has ended. Please login.");
    RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
    rd.forward(request, response);
    %>
    <form action="logoutAction.jsp">
    <table class="tborder" width="50%" cellspacing="1" cellpadding="3" align="center">
    <tr>
    <td colspan="2"> Are you sure you would like to logout?</td>
    </tr>
    <tr>
    <td>
    <input type="submit" id="submit" name="submit" value="OK"></input>
    </td>
    <td>
    <input type="submit" id="submit" name="submit" value="Cancel"></input>
    </td>
    </tr>
    </table>
    </form>
    With Regards,
    V.S.Ravi Kiran Balusu.

  • Regarding SMS application using jsp

    Hi Friends,
    I want to develop an application for sending and receiving sms from pc to mobile using jsp and servlets.I am new to it.can anyone guide me how to develop that application.
    Thanks and Regards,
    V.S.Ravi Kiran Balusu.

    The Java Messaging Service is middleware for exchanging messages between programs and such, not text messages to cell phones.
    You can send text messages to cellphones via email using carrier-specific addresses.
    [http://www.tech-recipes.com/rx/939/sms_email_cingular_nextel_sprint_tmobile_verizon_virgin/|http://www.tech-recipes.com/rx/939/sms_email_cingular_nextel_sprint_tmobile_verizon_virgin/]

  • Regarding comment statement in JSP Page

    Hai to All,
    I have written one small jsp page which checks the given name and display the entered name. This is the code which i have written. Its working fine.
    <html>
    <%
    String name = request.getParameter("txtName");
    out.println("THe Name is"+name);
    out.println("<br><br><br>");
    if(name.equals("Balaji"))
    %>
    <input type=Label value="Welcome Balaji">
    <%
    else
         if(name.equals("Kumaran"))
         %>
         <input type=Label value="Welcome Kumaran">
         <%
              else if(name.equals("Kandhan"))
              %>
              <input type=label value="Welcome Kandhan">
              <%
         else{
              %>
              <input type=label value="Welcome!!! Welcome !!!!">
              <%
              %>
    <h3> Code Ends Here</h3>
    </html>
    But if want to comment an else if block like this it shows some error like else without if.... delete else token. can someone please help me.
    <html>
    <%
    String name = request.getParameter("txtName");
    out.println("THe Name is"+name);
    out.println("<br><br><br>");
    if(name.equals("Balaji"))
    %>
    <input type=Label value="Welcome Balaji">
    <%
    else
         if(name.equals("Kumaran"))
         %>
         <input type=Label value="Welcome Kumaran">
         <%
         /*     else if(name.equals("Kandhan"))
              %>
              <!--
              <input type=label value="Welcome Kandhan">
              -->
              <%
         else{
         %>
         <input type=label value="Welcome!!! Welcome !!!!">
         <%
         %>
    <h3> Code Ends Here</h3>
    </html>

    <!--
    <input type=label value="Welcome Kandhan">
    -->That is an HTML comment, not a Java comment. So it gets sent to the client with Java code that looks like this (sorta):
    out.println("<!--");
    out.println("<input ...>");
    out.println("-->");So that means, between the end of the previous if statement there is some java code (the out.printlns) before you get to the else, which isn't allowed.

  • Help regarding HTML Textarea in JSP

    I have a textarea in my JSP where if the text entered is </TEXTAREA> it considers it to be the code to end the Textarea.
    The code i have used is :
    <TEXTAREA cols="30" name="<%=fieldName + template.getFieldId()%>" ><%=fieldValue%></TEXTAREA>
    When the form is saved with the text ' </Textarea> abcd ' in the textarea then the page if retrived after saved is scrambled.

    You will want to escape those nasty < and > characters that are in your text.
    Turn them into &lt; and &gt; in your HTML and you should be ok.
    (plug time for JSTL and EL again)
    Using <c:out > tag in JSTL automatically escapes these nasty characters for you, unless you ask it not to.
    Struts provides a similar tag I believe.
    Good luck,
    evnafets

  • Help Regarding playing slideshow in jsp

    HI,
    In my project i want to do the slide show of the uploaded photos.
    Im saved the image links in the database and tried to pass those values to the slide show array.
    But it s not working properly
    Im using the following javascript and jsp codings:
    <%@ page import="java.sql.*,java.io.*,java.util.*,java.util.Date" %>
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    var browserName = navigator.appName;
    var browserVer = parseInt(navigator.appVersion);
    var browserOK = (((browserName == "Netscape") && (browserVer >= 3)) ||
         ((browserName == "Microsoft Internet Explorer") && (browserVer >= 4)));
    var slideURL;
    var slideDelay = 2000;
    var curSlide = -1;
    var curTimeout;
    function showSlide1(name1) {
    slideURL = Array(name1);
    showSlide();
    function showSlide() {
         if (browserOK) {
         curSlide = ((curSlide + 1) % slideURL.length);
              document.images["slideImg"].src = slideURL[curSlide];
              curTimeout = setTimeout("showSlide()", slideDelay);
         } else {
              alert("This page requires Netscape 3.0+ or IE 4.0+");
    function goNext() {
         if (browserOK) {
              clearTimeout(curTimeout);
              showSlide();
    function goPrev() {
         if (browserOK) {
              clearTimeout(curTimeout);
              curSlide = (((curSlide - 2) + slideURL.length) % slideURL.length);
              showSlide();
    </SCRIPT>
    </HEAD>
    String name=(String)(session.getAttribute("theName"));
    Connection con=null;
    Statement st=null;
    String sql=null;
    ResultSet rs=null;
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:foto");
    st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
    sql="select * from album_bookmark where username='"+name+"'";
    rs=st.executeQuery(sql);
    while(rs.next())
    //out.println(rs.getString(2));
    }catch(Exception ert){out.println(ert.toString());}*/
    %>
    <BODY ONLOAD="javascript:showSlide1('rs.getString(2)');">
    <CENTER>
    <IMG NAME="slideImg" SRC="" width="150" height="150">
    <BR><BR>
    <INPUT TYPE="BUTTON" VALUE="<< Previous Slide" onClick="goPrev()">
    <INPUT TYPE="BUTTON" VALUE="Next Slide >>" onClick="goNext()">
    </CENTER>
    </BODY>
    </HTML>
    Can u tell how to do this and where im did mistake?
    thanx in advance

    Is this JSF code?
    Besides of mixing up business code in presentation code, i thing you are missing some jsp start tags, because ....
    (for example)
    </SCRIPT>
    </HEAD>
    String name=(String)(session.getAttribute("theName"));
    Connection con=null;

  • Regarding the running the jsp file

    i am getting an error class names date.jsp are only acceptable is annotation processing is explicitly requested
    i have saved this file by name date.jsp
    and when i run this .jsp file in commant prompt i am getting an error
    so what should i do
    do i need any extra software to install to run the jsp
    i have tomcat and jdk1.6 in my system
    <%@page contentType="text/html" import="java.util.*" %>
    <!--
    Date.jsp
    -->
    <html>
    <body>
    <p> </p>
    <div align="center">
    <center>
    <table border="0" cellpadding="0" cellspacing
    ="0" width="460" bgcolor="#EEFFCA">
    <tr>
    <td width="100%"><font size="6" color
    ="#008000"> Date Example</font></td>
    </tr>
    <tr>
    <td width="100%"><b> Current Date
    and time is:  <font color="#FF0000">
    <%= new java.util.Date() %>
    </font></b></td>
    </tr>
    </table>
    </center>
    </div>
    </body>
    </html>

    and when i run this .jsp file in commant prompt i am getting an error How do you run a jsp file from a command prompt? What command are you using?
    The standard way to run a jsp page is to deploy it onto a server as part of a web application, and then access the page through the browser.
    Tomcat should take care of compiling/running it for you.
    Cheers,
    evnafets

  • Problem regarding Combo boxes in JSP

    Hi all,
    I have two combo boxes on jsp page, i want to fill the second CB by value of first CB, and both CBs have values from Database, i tried it many times but cant got solution
    plz help me its very urgent and if possible provide code plz
    thanks

    http://forum.java.sun.com/thread.jspa?threadID=597553

  • Regarding using frames in jsp

    Hello
    I am a graduate student developing a web project. I want to use frameset and make frames in my page. I have got two frames in my page, leftFrame and rightFrame.
    Now I want to give the src to leftframe as src="myhtml.htm" and to right one as src="myjsp.jsp". Now when I run the program, then i find that the html page is seen finely in the page but the jsp part of the frame gives an error which is something like this .
    " The requested resource (/Atlantis/myjsp.jsp) is not available."
    Is it that in a frameset we can referr to only the html pages. Cant I work with referring to .jsp pages in a frame.
    Please help.
    thanks.

    Thanks
    @BalusC
    Hello sir,
    I have used the jsp:include function , and am getting the jsp pages included in my jsp page.
    but then the thing which I finally want, is that on the click of a button which is present in one of the included pages, i want to get
    another jsp page opened, but the new page should be opened only a part of the mother page.
    where as what is happening is that the whole page is refreshed and the new page replaces the parent page.
    actually my code is something like this :
    ***********************Parent page ***********************
    <table align="center">
    <tr>
    <td width="25%" bgcolor="WhiteSmoke">
    <table ><tr>
    <td><jsp:include page="DeleteCopies.jsp" flush="true" /></td></tr></table>
    </td>
    <td>
    <table frame="box"><tr>
    <td bgcolor="LavenderBlush">
    <jsp:include page="AddNewTitle.jsp" flush="true" /></td></tr></table></td>
    </tr>
    </table>
    Now
    in the delete copies. jsp page i have put a submit button and on the click of submit i am going to another page
    calles "SuccesfullyDeleted.jsp"
    but the problem what i am having is that that SuccesfullyDeleted.jsp page is coming in a new page.
    Can I have any mechanism by which i get this final page i.e. SuccesfullyDeleted.jsp page only restricted to the parent page's table's cell
    where the DeleteCopies.jsp page was lying.

  • Regarding Vector classes in JSP

    Hello,
    Where we actually use the vector classes in jsp page.Is there any necessary to use Vector classes in jsp programs instead of database.Or is there any conditions like here we have use vector instead of DataBase.

    JSP pages are part of the "view" layer in the MVC design pattern.
    As such, it is advisable to seperate them from the model/control layer. For this reason, database code in a JSP page is undesirable.
    The controller normally queries the model, places the results into a collection/vector, makes them available to the jsp page. All the jsp page knows is that it gets the collection - nothing about where it came from or how the model is accessed.
    It is not NECESSARY to do so. You can easily put SQL statements, and scriptlets into your JSP pages. But keeping that stuff out makes for more easily understood and maintainable web applications.
    Cheers,
    evnafets

  • Regarding error handling in jsp

    how can i handle error in jsp page.That means i want to write error or exceptions
    in a file if an exception occurs.that meas i want to log that exception with time and date in a log file.how will i do?

    There is a logger taglib available (on Jakarta) which works with log4j. You can make use of that.
    xH4x0r

  • Regarding History of System Status in CRM BI

    Hi BW Experts,
       I am currently working on CRM datasources.I have analysed the standard datasources related to CRM Services (0CRM_SRV_PROCESS_I,0CRM_SRV_PROCESS_H,0CRM_SRV_CONFIRM_H,0CRM_SRV_CONFIRM_I). I am just looking for History of System Status ie) At what time and date the status is set. Can i able to get this informations in Standard datasources.
    Please help on this issue.
    Thanks,
    Jelina.

    HI
    Sorry for the late reply.
    we dont have routine for date but v have for the status..please go through the below code if it can help u
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    TABLES: ...
    DATA:   it_times TYPE STANDARD TABLE OF zbw_escl_times,
            wa_times LIKE LINE OF it_times,
            timestamp1 TYPE  timestamp,
            timestamp2 TYPE  timestamp,
            w_temp_timestamp TYPE string,
            w_temp_timestamp1 TYPE string,
            w_secs TYPE i.
    $$ end of global - insert your declaration only before this line   -
    FORM compute_data_field
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
      USING    COMM_STRUCTURE LIKE /BIC/CS0CRM_SERVICE_PROCESS_I
               RECORD_NO LIKE SY-TABIX
               RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING RESULT LIKE /BIC/AZCRM_O0100-/BIC/ZCRM_STAT
               RETURNCODE LIKE SY-SUBRC "Do not use!
               ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
    fill the internal table "MONITOR", to make monitor entries
    data: wa_usstat type /BI0/TCRM_USSTAT,
          it_usstat type table of /BI0/TCRM_USSTAT.
    DATA : w_usstat_txt TYPE /bi0/tcrm_usstat-txtsh.
    CLEAR : wa_usstat, w_usstat_txt.
    select single * from /BI0/TCRM_USSTAT into wa_usstat
      where CRM_STSMA = COMM_STRUCTURE-CRM_STSMA
       and CRM_USSTAT = COMM_STRUCTURE-CRM_USSTAT
       and LANGU = 'E'.
    result value of the routine
      w_usstat_txt = wa_usstat-TXTSH.
      RESULT = w_usstat_txt.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    $$ end of routine - insert your code only before this line         -
    ENDFORM.

  • Performance testing of servlets / beans / jsp ?

    Hi. I'd like to performance test my applications, anyone have a clue on what software to use?
    I use Fort� for Java CE 3 as the IDE and TomCat 3.23 as the servlet / jsp container.
    Hopefully there are some opensource tools to use for this?
    Regards,
    Chris

    You can precompile JSP's, this removes the small hickup when they are requested the first time (making the server translate and compile them). Check the documentation of your specific web/application server on how to do this.
    Otherwise:
    - buy better hardware
    - use a better application server
    - make sure your network is properly configured (so packets don't get routed around the network four times before they reach their destination for example)
    - make sure your program logic doesn't create bottlenecks such as
    unnecessary HTTP requests, redundant loops, etc.
    - optimize your database access, use connection pooling
    - optimize your database queries. Create indexes, make sure the SQL queries themselves aren't doing unnecessary trips around the database, etc.

  • How to catch Exception in a JSP

    Hi there,
    I'm building my first JSP application. I still don't know what happens to an exception thrown inside a scrptlet in a JSP page.
    My JSP page is resultados.jsp (it processes a DB query):
    <%@ page contentType="text/html; charset=iso-8859-1" language="java"
    import="java.lang.*,java.sql.*,pcliente.*" errorPage="error.jsp" session="true" %>
    <html>
    <head>
    <title>PCliente - Hist?rico de Mainframe</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body background="imagens/sm_bg.gif">
    <TABLE border=0 cellPadding=0 cellSpacing=0>
    <TR>
    <TD width=5><IMG alt="" height=1 src="imagens/pixel.gif" width=5></TD>
    <TD vAlign=top width=125><jsp:include page="menu.jsp" flush="true" /> </TD>
    <TD width=25><IMG alt="" height=1 src="imagens/pixel.gif" width=25></TD>
    <TD vAlign=top width=365>
    <%
    try
    PCliente pcliente = new PCliente(request.getParameter("maquina"),
                        request.getParameter("acessorio"),
                        request.getParameter("contrato"),
                        request.getParameter("estabelecimento"),
                        request.getParameter("ifiscal"));
    ResultSet rs = pcliente.executarQuery();
    while (rs.next())
    out.println("<BR>" + rs.getString("nome_estab_instalacao"));
    out.print(" -----" + rs.getString("num_serie_equipamento"));
    out.print(" -----" + rs.getString("num_contrato"));
    /*** SQL exception is thrown by pcliente.executarQuery() ***/
    catch (SQLException sqlEx)
    out.println("<P>" + "There was an error doing the query:");
    out.println ("<PRE>" + sqlEx + "</PRE> \n <P>");
    application.log("Exception lan?ada", sqlEx);
    throw new Exception(sqlEx.toString());
    finally
    out.println("<P>" + "FINALLY !!!");
    %>
    </TD>
    </TR>
    </TABLE>
    </body>
    </html>
    The error.jsp is
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*,pcliente.*" isErrorPage="true" session="true" %>
    <html>
    <head>
    <title>PCliente - Hist?rico de Mainframe - Erro</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <strong>Pagina de Erro</strong>
    </body>
    </html>
    The java class I'm using in this JSP is pcliente/PCliente with the source code:
    package pcliente;
    import java.sql.*;
    public class PCliente
    private String numSerieMaquina, numSerieAcessorio, numContrato, numEstabelecimento, ifiscal;
    private String strQuery;
    private Connection conn;
    private ResultSet rs;
    private Statement stmt;
    public PCliente(String numSerieMaquina, String numSerieAcessorio,
                        String numContrato, String numEstabelecimento,
                        String ifiscal)
    conn = null;
    rs = null;
    stmt = null;
    this.numSerieMaquina = numSerieMaquina;
    this.numSerieAcessorio = numSerieAcessorio;
    this.numContrato = numContrato;
    this.numEstabelecimento = numEstabelecimento;
    this.ifiscal = ifiscal;
    construirQuery();
    public ResultSet executarQuery() throws SQLException
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    /* This causes SQLException as a 'c' was taken from oracle in
    "jdbc:orale:oci8:@PROD" */
    conn = DriverManager.getConnection("jdbc:orale:oci8:@PROD","histmain", "histmain");
    stmt = conn.createStatement();
    rs = stmt.executeQuery(strQuery);
    return rs;
    private void construirQuery()
    strQuery = "SELECT num_serie_equipamento, num_contrato,
    nome_estab_instalacao" +
         " FROM anmpf04" +
         " WHERE 1 = 1";
    if (numSerieMaquina != null)
    if (numSerieMaquina.indexOf('%') == -1)
    strQuery += " AND num_serie_facturacao = " + numSerieMaquina;
    else     
    strQuery += " AND num_serie_facturacao LIKE '" + numSerieMaquina + "'";
    When I execute the JSP I see a page with the text FINALLY !!!
    But an exception was thrown and I can't,
    see
    out.println("<P>" + "There was an error doing the query:");
    out.println ("<PRE>" + sqlEx + "</PRE> \n <P>");
    in the jsp page
    application.log("Exception lan?ada", sqlEx);
    don't know where to find the log file
    throw new Exception(sqlEx.toString());
    isn't caught by the error page error.jsp
    What am I missing here ? a lot of stuff no doubt !
    Can anyone give me suggestion(s) on how to detect an Exception ?
    I would also apreciate a site with documentation regarding Exception processing inside JSP.
    Many thanks,
    MGoncalv

    Hi there,
    I'm building my first JSP application. I still don't
    know what happens to an exception thrown inside a
    scrptlet in a JSP page.I believe that any scriptlet exceptions get wrapped into a ServletException. At that time, if you have an errorPage defined for you JSP page, then it will go there. If you don't then the server will try to find the particular exception type in an <error-page> stanza in the web.xml. If it finds a mapping, it will go to that mapping, otherwise it will go to a default error page (container specific).
    A quick glance at your design shows some big problems though that you may or may not hit (depending on how often you hit the page in your testing). The primary one is that in your PCliente class, you are opening up database connections/statements/results sets w/o closing them. You will run out of connections/cursors at some point b/c of this. You need to do your reads from the database and then close those resources (in a finally block to make sure they get closed). Read the data in a lightweight java object that the JSP can use to actually get the data.
    Also, you only need to register the driver manager once. You can do this in static initialization block.
    ncuka

Maybe you are looking for

  • DW CS5.5 Testing server setup - Help!!

    Hi everyone, Sorry if this is in the incorrect place for this error but I an having difficulties running a test server for php testing. I am running MacBook Pro, Lion and have Xampp installed. DW CS5.5 Databases access via phpmyadmin works fine. Ok s

  • Adobe Reader 9.3.2 Quits  - Opening Show Stamps Palette

    Dear All, We have updated all our adobe reader 9.3.2 in our domain systems. When opening Tools-> Comment & Markup->Stamps->Show Stamps Palette, the Adobe Reader quits automatically. Some time it works and some time it is not working. Is there any sol

  • How to use central output server in JSP application

    Dear All, We have developed a jsp application which is running on JBoss.We want to create receipts in PDF format.For this we are using central output server.Our approach is as follows: When request comes from the user, we are generating .dat file by

  • List of files in application server

    Hi, I would like to get the list of files in the directory of application server. Is there any standard function module to acieve this?. Regards Elini.P

  • Sub picture highlight - missing the big picture

    Windows 7 64-bit, Photoshop and Encore CS5, everything patched I have been banging around on this for days, off and on, and I'm sure I must be missing something obvious. I created a menu in Photoshop but even if I use a built-in Encore menu (like Sun