JSP code for Alarm

Hi i need to create an Alarm UI in JSP page. Like what Time CPU,Memory ,concurrent value goes above the marked value(90% usage) should be highlight in different colour like Red. All this data are stored on Oracle database. need to show in an JSP Can some one provide code similar to that thanks

Saish wrote:
http://www.google.com/search?q=java+socket+tutorial
The very first result that came up was Sun's tutorial on sockets: http://java.sun.com/docs/books/tutorial/networking/sockets/
Writing these in a JSP is generally no different than doing so in Java source file, except you will need to surround the Java code with JSP scriptlet tokens: http://www.jsptut.com/Scriptlets.jsp
However, I would advise instead writing the socket code in a regular Java object and then invoking that from your JSP. You really don't want to have code in the JSP if you can help it.
- SaishYou advise to use scriptlets. You know you will have to spend a year or two in purgatory for that!
Be cool, use a servlet for this.

Similar Messages

  • JSP codes for running a JAVA program

    hello...
    does anyone know the JSP codes for running a Java program from my web page?? i mean i already have my java program compiled... and i just want this java program to run in the background when I click on a button or a link...
    Any idea about this?
    plz advice..
    avi

    yes... u r somewhat right... but this runs on Jakarta Tomcat...
    i'm using the Apache Http Server together with the ServletExec AS which enable the Apache server to run JSP..
    I've created a package where i've put my classes...
    WEB-INF/classes/tbd(package name)/my classes
    and i've added.. package name.. in my java program..
    and then in jsp... i've written..
    <%@ page import="tdb.*"%>
    <jsp:useBean id="exec" class="tdb.textdb" />
    <%exec.convert_data();%>
    but when i run the page it says the package does not exist...
    can anyone tell where to place the folder WEB-INF so that it can run fine?
    thx
    avi

  • Jsp code for image compression

    Hai,sir this is surendra i am doing a project using jsp and mysql.
    In that each user can put his image and i am storing that image in mysql blob but that results to that database size.
    So i need jsp code for image compression or another way for storing images.

    There's no need to store images in db. You may store them in a dedicated folder.

  • This is my Jsp code for image upload in database:

    This is my Jsp code for image upload in database:
    -----------Upload.jsp----------------
    <html>
    <head>
    </head>
    <body bgproperties="fixed" bgcolor="#CCFFFF">
    <form method="POST" action="UploadPicture.jsp" enctype="multiform/form-data">
    <%! int update=0; %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.text.*" %>
    <%@ page import="java.sql.Date" %>
    <%@ page import="java.io.*"%>
    <%@ page language = "java" %>
    <%
    try
    String ct="3";
    String path;
    File image=new File(request.getParameter("upload"));
    path=request.getParameter("upload");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:itPlusElectronics","","");
    PreparedStatement pstmt=con.prepareStatement("insert into graphics values(?,?,?)");
    pstmt.setString(2,path);
    pstmt.setString(3,ct);
    InputStream is=new FileInputStream(path);
    pstmt.setBinaryStream(1, is, (int)(image.length()));
    int s=pstmt.executeUpdate();
    if(s>0)
    out.println("Uploaded");
    else
    %>
    unsucessfull
    <%}
    is.close();
    pstmt.close();
    catch(Exception e)
    }%>
    </p>
    <p><br>
    <img src="UploadedPicture.jsp">image</img>
    <p></p>
    </form>
    </body>
    </html>
    My database name is itPlusElectronics and the table name is "graphics".
    I have seen as a result of the above code that the image is stored in database as "Long binary data". and database table is look like as follows-------
    picture path id
    Long binary data D:\AMRIT\1-1-Picture.jpg 3
    To retrive and display i use this JSP code as--
    ------------------------UploadedPicture.jsp------------------------------
    <html>
    <head>
    </head>
    <body bgproperties="fixed" bgcolor="#CCFFFF">
    <%! int update=0; %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.text.*" %>
    <%@ page import="java.io.*"%>
    <%@ page language = "java" %>
    <%@page import="javax.servlet.ServletOutputStream"%>
    <%
    try
    String path;
    path=request.getParameter("upload1");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:itPlusElectronics","","");
    PreparedStatement pst = con.prepareStatement("SELECT * FROM graphics WHERE id ='3'");
    // pst.setString(3, id);
    ResultSet rs = pst.executeQuery();
    path=rs.getString("path");
    if(rs.next()) {
    byte[] bytearray = new byte[4096];
    int size=0;
    InputStream sImage;
    sImage = rs.getBinaryStream(1);
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=path");
    while((size=sImage.read(bytearray))!= -1 )
    response.getOutputStream().write(bytearray,0,size) ;
    response.flushBuffer();
    sImage.close();
    rs.close();
    catch(Exception e)
    %>
    </body>
    </html>
    Now after browsing a jpg image file from client side and pressing submit button ;
    I am unable display the image in the Upload.jsp file.Though I use
    <img src="UploadedPicture.jsp">image</img> HTML code in Upload.jsp
    file .
    Now I am unable to find out the mistakes which is needed for displaying the picture in the Upload.jsp page..
    If any one can help with the proper jsp code to retrive and display the image ,please please help me !!!!!!!!!!!!!!!!!!!!!!!!!!

    dketcham wrote:
    cotton.m wrote:
    >
    2) I'm looking at how you called stuff, and you're trying to call the jsp file as an image? That jsp isn't the source of the image, just a page linking to an image. I think if you really want to do things that way you're going to need to just include that jsp within the jsp you're calling it from (or you can do it the easy way, and if you have the information to get the path of the image you want, you could simply call the image from the first jsp you posted)This is incorrect.
    There are two JSPs. The second when called will (if it worked) return the source of an image as stored in the database.even when called with <img src=xx.jsp>??
    Yes.
    If any of what I say next seems obvious or otherwise negative I apologize, just trying to explain and I don't know what you know vs what you don't.
    The link in the src is just a URL not a filetype. So just because it ends with JSP does not mean it has to return HTML. The content type is determined by the browser using the Content-Type header returned by the server in the HTTP response. In this case the header is set to be a jpeg so that's what the browser will attempt to interpret the content part of the response as.
    So in fact one is not limited to just HTML or images but whatever content type you would like to return (that the browser can understand anyway). This could be HTML or it could be an image of some type or it could be a PDF or it could be an Excel spreadsheet. All you have to do in the JSP is set the header appropriately and then send content that is actually in that format.
    This does not just apply to JSP by the way but all other web programming languages. You can do similar things to produce the same results in PHP, Perl, ASP etc.
    The only JSP/Servlet complication is whether or not doing this in a JSP is a "good" idea but I am not an expert enough at that to make a definitive statement. Mostly though JDBC in a JSP is a no-no.

  • Jsp code for report in text or pdf

    How to generate report in either text or pdf format from jsp page?

    How do you want to generate report?
    For pdf you can use itext(http://www.lowagie.com/iText/)..

  • Sample JSP Code for SSO

    I'm using 9iAS and 10g. either of the two versions will do. Thanks!
    Russel

    I'm using 9iAS and 10g. either of the two versions will do. Thanks!
    Russel

  • JSP Code to connect Oracle 10g Database

    Can some give the JSP code for connecting Oracle 10g database

    hi
    First u have to get ojdbc1.4.jar file ,,,, it is the driver for the oracle
    then use the following code :
    import java.sql.*;
    import java.util.*;
    public class connectionBean
         Connection con;
         Statement statement;
         connectionBean()
              try
            Class.forName("oracle.jdbc.driver.OracleDriver");
            con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:Xe","hr","hr");
            statement=con.createStatement();
              catch(Exception cnfe){     }
         public void testMethod()throws  SQLException{
              ResultSet rs=statement.executeQuery("select * from COUNTRIES");
              while(rs.next())
              System.out.print(rs.getString(1));
         public static void main (String args[])throws  SQLException
              connectionBean cb=new connectionBean();
              cb.testMethod();
    }hope this will help
    Good luck
    Mohammed

  • How to close a window of IE7 using jsp code

    Hi,
    Can any one suggest how to use window.close method for closing a window of IE7 , presently i am using below code for logging off a page but i am recieving an error saying object expected and some text undefined , can any one let me know what extra code is required to be added in below jsp code  for logging of a window in  IE7
    function logoff()
            if (EPCM.getUAType() == EPCM.MSIE)
                window.returnValue = 'logoff';
            else
                window.opener.logoff();
            closeWindow();
        function closeWindow()
            window.close();
    Thanks
    Abhai

    Hi Abhai,
    In your javascript, you can add a try catch block to check which object is null.
    Also check this:
    Portal user often can't log off because of the Log off window was blocked
    Greetings,
    Praveen Gudapati
    p.s. Points are always welcome for helpful answers

  • SSO Sample JSP Code

    Hi,
    Is there anyone here who can help or much appreciated if you can provide a sample JSP code for SSO (Single Sign On pages) of Login, Logoff and Change Password. I'll be needing this to customize/replace our SSO to pattern with our current look and feel of our website. Many thanks.
    Russel

    I'm using 9iAS and 10g. either of the two versions will do. Thanks!
    Russel

  • Errors in JSP file for htmlb code - CE 7.1

    Hi Experts,
    I am trying  created simple JSP dynpages application in NWDS 7.1 & CE 7.1.
    I am getting errors for HTMLB  code like:
    cannot find tag Library descriptor for tagLib
    In JSP page i wrote simple htmlb code like:
    <%@taglib uri="tagLib" prefix="htmlb"%>
    <htmlb:content id="myContext">
    <htmlb:page title="PageTitle">
    <htmlb:form id="myFormId">
    <htmlb:inputField id="inf1" type="String" width="125" visible="true"
    required="true" />
    </htmlb:form>
    </htmlb:page>
    </htmlb:content>
    {/code}
    For HTMLB libraries added 2 jar file in lib folder
    /PORTAL-INF/lib   com.sap.portal.htmlb.jar ; &   com.sapportals.htmlb.jar
    After adding set the Java build path for Library jar file also.
    In portalapp.xml -
    <?xml version="1.0"; encoding="UTF-8"?>
    <application>
      <application-config>
       <property name="startup" value="true"/>
        <property name="SharingReference" value="com.sap.portal.htmlb";/>
      </application-config>
      <components>
        <component name="Test_Jsp">
          <component-config>
            <property name="ClassName" value="com.Test_Jsp.Test_Jsp";/>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/Output.jsp";/>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld";/>
          </component-profile>
        </component>
      </components>
      <services/>
    </application>
    {/code}
    Please any one help to correct this errors............
    Regards,
    Satya

    Hi,
    You need not add com.sap.portal.htmlb.jar and com.sapportals.htmlb.jar to /PORTAL-INF/lib as the classes will be available at runtime through com.sap.portal.htmlb SharingReference. So remove the htmlb jars from /PORTAL-INF/lib.
    Correct the value of tagLib property to /SERVICE/com.sap.portal.htmlb/taglib/htmlb.tld
    Deploy and check if this helps.
    I see alot of unnecessary semicolons in your portalapp.xml, I think you just added them inorder to be able to post them here.
    Regards,
    Praveen Gudapati

  • Getting a JFrame to display  from a JSP, remaining JSP code waits for frame

    Hello,
    I'm new to Java and just started using JSPs. My objective is to call a display window (from a JSP) that shows the user a list of project selections. Once the user has made their selections and clicked a Submit button, the display class captures the selected projects to the request object as an attribute and then closes the window. The next command in the jsp then forwards the request attribute to a controller. I'm having trouble getting the display window to show-the JSP seems to hang and then timeout. Is there code I'm missing to get the JSP to stop processing while it waits for the choices to be made in the JFrame?
    Below is the JSP code and the class I'm calling. I'm seeing all my debug System.out statements but no JFrame pops up. In the JFrame class, the line f.addWindowListener(... does the capture of user selections to the request attribute.
    Any help will be greatly appreciated!!
    JSP:
    <%@ page language="java" contentType="text/html;charset=UTF-8" import="com.plumtree.remote.portlet.*,edu.app.projects.*" %>
    <%
        request.setAttribute("action", "prefDisplay");
        request.setAttribute("orderby", "title");
        ServletContext jc = getServletContext();
        DualListBox dual = new DualListBox(request,(String)jc.getAttribute("db.driver"), (String)jc.getAttribute("db.connectionstring"),"title");
         JFrame f = dual.getFrame();
         f.setVisible(true);//expect code to stop here and display frame, waiting for the user to finish.
            //Debug code that tests if frame is visible at this point -came true though did not see Jframe displayed
         if(f.isShowing()){
         System.out.println("Jframe visible");}
           //Send to ProjectsController
          request.getRequestDispatcher("pc").forward(request, response);%>               ---------------------------------------------------------------------------------------------
    JFrame Class (below)
    -Sets up Frame and corresponding Dialog box
    -Populates Dialog box with options from a database call (for user selection)
    -Should wait for user input - Window close or Submit! to capture selection and dispose of Jframe
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.EventQueue;
    import java.awt.Frame;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowEvent;
    import java.lang.reflect.InvocationTargetException;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.SortedSet;
    import java.util.TreeSet;
    import javax.servlet.http.HttpServletRequest;
    import javax.swing.AbstractListModel;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.ListCellRenderer;
    import javax.swing.ListModel;
    public class DualListBox extends JPanel {
      private static final long serialVersionUID = 1L;
      private static final Insets EMPTY_INSETS = new Insets(0, 0, 0, 0);
      private static final String ADD_BUTTON_LABEL = "Add >>";
      private static final String REMOVE_BUTTON_LABEL = "<< Remove";
      private static final String DONE_BUTTON_LABEL = "Submit!";
      private static final String DEFAULT_SOURCE_CHOICE_LABEL = "Available Projects";
      private static final String DEFAULT_DEST_CHOICE_LABEL = "Your Selections";
      private String orderby, mydriver, connectionString;
      private JLabel sourceLabel;
      private JList sourceList;
      private SortedListModel sourceListModel;
      private JList destList;
      private String chosenprojects;
      private SortedListModel destListModel;
      private JLabel destLabel;
      private JButton addButton;
      private JButton removeButton;
      private JButton doneButton;
      private DatabaseHelper dh;
      protected HttpServletRequest request;
      protected JFrame f;
      protected JDialog jd;
      public DualListBox(HttpServletRequest req, String driver, String connection, String ordering) {
         System.out.println("In DualList Setup");
        request =req;
         orderby =ordering;
         connectionString = connection;
         mydriver = driver;
         f = new JFrame("Projects List Selector");     
         jd =new JDialog(f,true);
         jd.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
         System.out.println("B4 initscreen");
        initScreen();
        System.out.println("After initscreen");
        String[] DBprojects = this.dbCall();
        System.out.println("After DB Call");
        this.addSourceElements( DBprojects );   
        System.out.println("Filled screen");
        jd.getContentPane().add(this, BorderLayout.CENTER);
        //f.getContentPane().add(jd, BorderLayout.CENTER);
        jd.setSize(800, 600);
        System.out.println("OK2");
        jd.setVisible(true);
        System.out.println("OK3");
        Runnable runner = new FrameShower(jd);
        EventQueue.invokeLater(runner);
      public String getSourceChoicesTitle() {
        return sourceLabel.getText();
      public String chosenprojects() {
             return chosenprojects;
      public JFrame getFrame() {
             return f;
      public void setSourceChoicesTitle(String newValue) {
        sourceLabel.setText(newValue);
      public String getDestinationChoicesTitle() {
        return destLabel.getText();
      public void setDestinationChoicesTitle(String newValue) {
        destLabel.setText(newValue);
      public void clearSourceListModel() {
        sourceListModel.clear();
      public void clearDestinationListModel() {
        destListModel.clear();
      public void addSourceElements(ListModel newValue) {
        fillListModel(sourceListModel, newValue);
      public void setSourceElements(ListModel newValue) {
        clearSourceListModel();
        addSourceElements(newValue);
      public void addDestinationElements(ListModel newValue) {
        fillListModel(destListModel, newValue);
      private String[] dbCall(){
             if(dh==null)
                  dh = new DatabaseHelper(mydriver, connectionString);
              PreparedStatement ps = null;
              ResultSet rs = null;
              ArrayList<String>children = new ArrayList<String>();
              ArrayList<String[]>tree =new ArrayList<String[]>();
              if(orderby==null || orderby.equals("")){
                   orderby ="region";
              String query = "select title,id from projects";// order by " + orderby;
              System.out.println(query);
              try {
                   Connection conn =dh.getConnection();
                   ps = conn.prepareStatement(query);
                   rs = ps.executeQuery();
                   while (rs.next()) {
                        children.add(new String(rs.getString(1)));
                        System.out.println(rs.getString(1));
                        tree.add(new String[]{rs.getString(1),rs.getString(2)});
                   request.setAttribute("ResultTree",tree);
                   return (String[])children.toArray(new String[children.size()]);
              } catch (SQLException e) {
                   throw new RuntimeException(e);
              } finally {
                   try {
                        if (null != rs) rs.close();
                   } catch (SQLException e) {
                   try {
                        if (null != ps) ps.close();
                   } catch (SQLException e) {
      private void fillListModel(SortedListModel model, ListModel newValues) {
        int size = newValues.getSize();
        for (int i = 0; i < size; i++) {
          model.add(newValues.getElementAt(i));
      public void addSourceElements(Object newValue[]) {
        fillListModel(sourceListModel, newValue);
      public void setSourceElements(Object newValue[]) {
        clearSourceListModel();
        addSourceElements(newValue);
      public void addDestinationElements(Object newValue[]) {
        fillListModel(destListModel, newValue);
      private void fillListModel(SortedListModel model, Object newValues[]) {
        model.addAll(newValues);
      public Iterator sourceIterator() {
        return sourceListModel.iterator();
      public Iterator destinationIterator() {
        return destListModel.iterator();
      public void setSourceCellRenderer(ListCellRenderer newValue) {
        sourceList.setCellRenderer(newValue);
      public ListCellRenderer getSourceCellRenderer() {
        return sourceList.getCellRenderer();
      public void setDestinationCellRenderer(ListCellRenderer newValue) {
        destList.setCellRenderer(newValue);
      public ListCellRenderer getDestinationCellRenderer() {
        return destList.getCellRenderer();
      public void setVisibleRowCount(int newValue) {
        sourceList.setVisibleRowCount(newValue);
        destList.setVisibleRowCount(newValue);
      public int getVisibleRowCount() {
        return sourceList.getVisibleRowCount();
      public void setSelectionBackground(Color newValue) {
        sourceList.setSelectionBackground(newValue);
        destList.setSelectionBackground(newValue);
      public Color getSelectionBackground() {
        return sourceList.getSelectionBackground();
      public void setSelectionForeground(Color newValue) {
        sourceList.setSelectionForeground(newValue);
        destList.setSelectionForeground(newValue);
      public Color getSelectionForeground() {
        return sourceList.getSelectionForeground();
      public String getProjects(){
           return chosenprojects;
      private void clearSourceSelected() {
        Object selected[] = sourceList.getSelectedValues();
        for (int i = selected.length - 1; i >= 0; --i) {
          sourceListModel.removeElement(selected);
    sourceList.getSelectionModel().clearSelection();
    private void clearDestinationSelected() {
    Object selected[] = destList.getSelectedValues();
    for (int i = selected.length - 1; i >= 0; --i) {
    destListModel.removeElement(selected[i]);
    destList.getSelectionModel().clearSelection();
    private void initScreen() {
    setBorder(BorderFactory.createEtchedBorder());
    setLayout(new GridBagLayout());
    sourceLabel = new JLabel(DEFAULT_SOURCE_CHOICE_LABEL);
    sourceListModel = new SortedListModel();
    sourceList = new JList(sourceListModel);
    add(sourceLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0,
    GridBagConstraints.CENTER, GridBagConstraints.NONE,
    EMPTY_INSETS, 0, 0));
    add(new JScrollPane(sourceList), new GridBagConstraints(0, 1, 1, 5, .5,
    1, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    EMPTY_INSETS, 0, 0));
    addButton = new JButton(ADD_BUTTON_LABEL);
    add(addButton, new GridBagConstraints(1, 2, 1, 2, 0, .25,
    GridBagConstraints.CENTER, GridBagConstraints.NONE,
    EMPTY_INSETS, 0, 0));
    addButton.addActionListener(new AddListener());
    removeButton = new JButton(REMOVE_BUTTON_LABEL);
    add(removeButton, new GridBagConstraints(1, 4, 1, 2, 0, .25,
    GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
    0, 5, 0, 5), 0, 0));
    removeButton.addActionListener(new RemoveListener());
    doneButton = new JButton(DONE_BUTTON_LABEL);
    add(doneButton, new GridBagConstraints(1, 6, 1, 2, 0, .25,
    GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
    0, 10, 0, 10), 0, 0));
    doneButton.addActionListener(new DoneListener());
    f.addWindowListener(new java.awt.event.WindowAdapter() {
         public void windowClosing(WindowEvent winEvt) {
              //could set to null here to force use of Done button only
         chosenprojects = destList.getSelectedValues().toString();
              request.setAttribute("ProjectIDs", destList.getSelectedValues().toString());
              System.exit(0);
    destLabel = new JLabel(DEFAULT_DEST_CHOICE_LABEL);
    destListModel = new SortedListModel();
    destList = new JList(destListModel);
    add(destLabel, new GridBagConstraints(2, 0, 1, 1, 0, 0,
    GridBagConstraints.CENTER, GridBagConstraints.NONE,
    EMPTY_INSETS, 0, 0));
    add(new JScrollPane(destList), new GridBagConstraints(2, 1, 1, 5, .5,
    1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    EMPTY_INSETS, 0, 0));
    private class AddListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    Object selected[] = sourceList.getSelectedValues();
    addDestinationElements(selected);
    clearSourceSelected();
    private class RemoveListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    Object selected[] = destList.getSelectedValues();
    addSourceElements(selected);
    clearDestinationSelected();
    private class DoneListener implements ActionListener {
         public void actionPerformed(ActionEvent e) {
         chosenprojects = destList.getSelectedValues().toString();
         request.setAttribute("ProjectIDs", destList.getSelectedValues().toString());
         System.exit(0);      
    class FrameShower implements Runnable {
         final JDialog frame;
         public FrameShower(JDialog frame) {
              this.frame = frame;
         public void run() {
              System.out.println("B4 make visible");
              frame.setVisible(true);          
         System.out.println("Made screen visible");
    class SortedListModel extends AbstractListModel {
    private static final long serialVersionUID = 8777627817685130496L;
    SortedSet model;
    public SortedListModel() {
    model = new TreeSet();
    public int getSize() {
    return model.size();
    public Object getElementAt(int index) {
    return model.toArray()[index];
    public void add(Object element) {
    if (model.add(element)) {
    fireContentsChanged(this, 0, getSize());
    public void addAll(Object elements[]) {
    Collection c = Arrays.asList(elements);
    model.addAll(c);
    fireContentsChanged(this, 0, getSize());
    public void clear() {
    model.clear();
    fireContentsChanged(this, 0, getSize());
    public boolean contains(Object element) {
    return model.contains(element);
    public Object firstElement() {
    return model.first();
    public Iterator iterator() {
    return model.iterator();
    public Object lastElement() {
    return model.last();
    public boolean removeElement(Object element) {
    boolean removed = model.remove(element);
    if (removed) {
    fireContentsChanged(this, 0, getSize());
    return removed;
    }{code}
    Edited by: redm14A on Oct 10, 2007 11:34 AM
    Edited by: redm14A on Oct 10, 2007 11:37 AM
    Edited by: redm14A on Oct 10, 2007 11:40 AM
    Edited by: redm14A on Oct 10, 2007 11:45 AM
    Edited by: redm14A on Oct 10, 2007 11:47 AM

    redm14A wrote:
    Hmm, I was trying to avoid writing an applet. Seems my only other option then is to write a JSP that returns a javascript menu populated by options from a database call. Then I'd have the user click submit to send the options to another JSP that simply sets the request attribute and forwards to the controller. Will this be a sound alternative?
    Edited by: redm14A on Oct 10, 2007 12:29 PMSounds good to me.

  • Urgently Need Code for Copy & Paste from Html Table in JSP to Excel file

    I am creating a html table in JSP file .
    I need code for 'Cut,Copy,Paste' functions ie. if someone wants to copy data from my table to excel file or from excel file to html table he shud be able to do that.
    Can someone give me code for 'Cut,Copy and Paste' i.e. some javascript functions which can do cut, copy and paste which i can put in my jsp file
    Thanks
    Message was edited by:
    javatechguru2007

    package com.chinmayananda
    public class Tetris{
    // complete here
    code]
    public abstract class AbstractTetris {
       public abstract void start();
       public abstract void stop();
    }nearly done

  • Weblogic 6.0 (SP2) generates incorrect java code for JSP with response.sendRedirect()

              Hi,
              Here are the steps to reproduce the problem with the examplesWebApp application
              bundled with wlserver6.0(sp2):
              Product: Weblogic server 6.0 (sp2)
              Browser: IE 5.0
              1. Add index.jsp as the welcome file in WEB-INF/web.xml
              2. Create index.jsp as below:
              <%
              response.sendRedirect("index.html");
              return;
              %>
              <html>
              <head>
              <title>Index JSP file</title>
              </head>
              <body>
              <font color="red">This is index.jsp file </font>
              </body>
              </html>
              3. Create index.html as below:
              <html>
              <head>
              <title>Index HTML file</title>
              </head>
              <body>
              <font color="red">This is index.html file </font>
              </body>
              </html>
              4. Run the examples server and make sure examplesWebApp is deployed on the examples
              server using the console
              5. Access the URL http://localhost:7001/examplesWebApp
              The page will display a compilation error as below:
              C:\bea\wlserver6.0\config\examples\applications\examplesWebApp\WEB-INF\_tmp_war_examplesServer_examplesServer_examplesWebApp\jsp_servlet\_index.java:89:
              unreachable statement
              out.print("\r\n<html>\r\n<head>\r\n<title>Simple html</title>\r\n</head>\r\n<body>\r\n<font
              color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
              ^
              and a look at the generated java code for index.jsp (_index.java) will reveal
              the erroneous code snippet below in the jsp service method:
              try { // error page try block
              //[ /index.jsp; Line: 1]
              response.sendRedirect("index.html"); //[ /index.jsp; Line: 2]
              return; //[ /index.jsp; Line: 3]
              out.print("\r\n<html>\r\n<head>\r\n<title>Simple html</title>\r\n</head>\r\n<body>\r\n<font
              color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
              } catch (Exception __ee) {
              while (out != null && out != _originalOut) out = pageContext.popBody();
              pageContext.handlePageException(__ee);
              The above web application works fine in Tomcat 3.2.X environment. The Weblogic
              server 6.0 servlet engine should not generate the "out.println()" corresponding
              to the html section of index.jsp. The moment it sees the "return", it should stop
              processing further.
              Can someone from Weblogic support team please verify this and let me know when
              this bug will be fixed?
              One interesting thing I noticed was when we last tried weblogic 6.0 at its beta
              stage, it worked fine after we put in a special patch jar file called "redirectfix.jar"
              we received from weblogic team but somehow it got re-introduced by the time it
              was released!!
              We are planning to migrate our product from tomcat 3.2.x to weblogic 6.0. Our
              product has a lot of pages with such conditional {response.sendRdirect("page.jsp");return;}
              blocks. We would really appreciate a faster response form weblogic team.
              Thanks in advance.
              sam...
              Sam Palanisamy
              Senior Software Engineer
              Manage.com
              2345 N. First Street First Floor
              San Jose CA 95131
              

    Why should it stop when it sees a return? Is that in the spec?
              Peace,
              Cameron Purdy
              Tangosol Inc.
              << Tangosol Server: How Weblogic applications are customized >>
              << Download now from http://www.tangosol.com/download.jsp >>
              "Sam Palanisamy" <[email protected]> wrote in message
              news:[email protected]...
              >
              > Hi,
              >
              > Here are the steps to reproduce the problem with the examplesWebApp
              application
              > bundled with wlserver6.0(sp2):
              >
              > Product: Weblogic server 6.0 (sp2)
              > Browser: IE 5.0
              >
              > 1. Add index.jsp as the welcome file in WEB-INF/web.xml
              >
              > 2. Create index.jsp as below:
              > <%
              > response.sendRedirect("index.html");
              > return;
              > %>
              > <html>
              > <head>
              > <title>Index JSP file</title>
              > </head>
              > <body>
              > <font color="red">This is index.jsp file </font>
              > </body>
              > </html>
              >
              > 3. Create index.html as below:
              > <html>
              > <head>
              > <title>Index HTML file</title>
              > </head>
              > <body>
              > <font color="red">This is index.html file </font>
              > </body>
              > </html>
              >
              > 4. Run the examples server and make sure examplesWebApp is deployed on the
              examples
              > server using the console
              >
              > 5. Access the URL http://localhost:7001/examplesWebApp
              >
              > The page will display a compilation error as below:
              >
              C:\bea\wlserver6.0\config\examples\applications\examplesWebApp\WEB-INF\_tmp_
              war_examplesServer_examplesServer_examplesWebApp\jsp_servlet\_index.java:89:
              > unreachable statement
              > out.print("\r\n<html>\r\n<head>\r\n<title>Simple
              html</title>\r\n</head>\r\n<body>\r\n<font
              > color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
              > ^
              >
              > and a look at the generated java code for index.jsp (_index.java) will
              reveal
              > the erroneous code snippet below in the jsp service method:
              >
              > try { // error page try block
              >
              > //[ /index.jsp; Line: 1]
              > response.sendRedirect("index.html"); //[ /index.jsp; Line: 2]
              > return; //[ /index.jsp; Line: 3]
              > out.print("\r\n<html>\r\n<head>\r\n<title>Simple
              html</title>\r\n</head>\r\n<body>\r\n<font
              > color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
              > } catch (Exception __ee) {
              > while (out != null && out != _originalOut) out =
              pageContext.popBody();
              > pageContext.handlePageException(__ee);
              > }
              >
              > The above web application works fine in Tomcat 3.2.X environment. The
              Weblogic
              > server 6.0 servlet engine should not generate the "out.println()"
              corresponding
              > to the html section of index.jsp. The moment it sees the "return", it
              should stop
              > processing further.
              >
              > Can someone from Weblogic support team please verify this and let me know
              when
              > this bug will be fixed?
              >
              > One interesting thing I noticed was when we last tried weblogic 6.0 at its
              beta
              > stage, it worked fine after we put in a special patch jar file called
              "redirectfix.jar"
              > we received from weblogic team but somehow it got re-introduced by the
              time it
              > was released!!
              >
              > We are planning to migrate our product from tomcat 3.2.x to weblogic 6.0.
              Our
              > product has a lot of pages with such conditional
              {response.sendRdirect("page.jsp");return;}
              > blocks. We would really appreciate a faster response form weblogic team.
              >
              > Thanks in advance.
              > sam...
              > Sam Palanisamy
              > Senior Software Engineer
              > Manage.com
              > 2345 N. First Street First Floor
              > San Jose CA 95131
              >
              >
              

  • Need Sample source code for Forum in jsp

    Hi..
    Please tell me the website which is having the sample source code for simple forum... I have to implement it into my project... kindly help me out...
    thanx in advance
    kumar

    Hi..
    Please tell me the website which is having the sample source code for simple forum... I have to implement it into my project... kindly help me out...
    thanx in advance
    kumar

  • How to get OutputStream/Writer for a file in a JSP code?

    In a JSP code as shown below, how could we get an OutputStream to write a file that resides on the server file system?
    I'm stuck after five hours struggle!
    <%
    /* simple experimental JSP program */
    ...  // get request data
    Properties pt = new Properties();
    Class clas = getClass();
    InputStream is = clas.getResourceAsStream("/users.properties");
    pt.load(is);
    String userNameDB = pt.getProperty("user");
    String passwordDB = pt.getProperty("password");
    long lastLogonDB = Long.parseLong(pt.getProperty("lastLogon"));
        // so far so good ...
    if (userName.equals(userNameDB) && password.equals(passwordDB)){
      if (lastLogonForm > lastLogonDB) {
        session.setAttribute("User", userName); //Saves user name string in the session object
        pt.setProperty("lastLogon", lastLogon);
        pt.setProperty("user", userNameDB);
        pt.setProperty("password", passwordDB);
        ...  // how to write back the new data to the users.properties file?
    %>

    I have found a solution:
    String path = application.getRealPath("/users.properties");
    InputStream is = new FileInputStream(path);
    is.close();
    OutputStream os = new FileOutputStream(path);
    os.close();getResourceAsStream() is oddly incompatible with the code using the getRealPath(). So don't use it.

Maybe you are looking for

  • How to open a comp?

    Does anyone know of a way to force a comp to open its timeline and composition windows/panels? So far, the closest thing I could find is an undocumented method for comps: ramPreviewTest(), which forces the comp to open itself in order to do the previ

  • How to display detail message in channel monitor

    Hi, I have developed a module for mail adapter. In the module, sometimes I will throw ModuleException like this: ModuleException me = new ModuleException("You are not allowed here!",e); throw me; But in channel monitor, I could only see the exception

  • Editing with Dreamweaver

    Is it possible to edit a file created in Dreamweaver so that changes can be tracked? It looks to me that you might have to use Incopy, so I've downloaded a trial version of that. But, if so, I can't figure out how to make DW and Incopy work together.

  • Regarding message spliting and posting multiple files

    Hi All, I have a requirment like i am getting multiple IDOCs as input with differend CustID(each Id may be repeated).I have to group based on a CustID ,ie all Idocs belonging to a particular CustID will be placed in one group. Then i have to make a s

  • Upgrade to SBO 2007 : a user was added outside the application....

    Hi I just completed the upgrade of a system from 2005 to 2007. But when trying to create a new user, i've got this message : -> a user was added outside the application. Delete it, or perform "Restore Numbering" Do you have any idea on the way to ove