Help with buttons on a JSP Page

Hi All,
I have a HTML page , that has certain text fields.... on entering values into the text fields, it is directed to a servlet.
The servlet(puts the values into the database) then directs to a jsp with the values entered in the form.
I would like to know whether on the jsp page i can have 2 buttons like "edit" and "OK".
(how do I code it???)
The "edit" button edits the information on the initial HTML page and
The "OK" button just confirms the inputted information.
I hope I have asked a clear question.It would be great if someone directs me in the right direction.
Thanking everyone in advance
AS

I hope I've understood your question correctly. Let
me see if I got it right. So the first page is the
form, where the user inputs the information, the
second page will display this information that they
inputted from the previous page and then have two
buttons, one that says edit and the other that says
ok. Upon hitting edit they're sent back to the form
with the values already filled out, if they hit OK,
the data is inserted into the database. If this is
correct, this is how I would do it.
You will have 3 files
parameters.jsp
<%
String firstname =
= request.getParameter("firstname");
     String lastname = request.getParameter("lastname");
%>form.jsp
<%@ include file="parameters.jsp">
<html>
     <body>
          <form action="confirmation.jsp" method="post">
<input type="text" name="firstname" value="<%=
<%= firstname %>">
<input type="text" name="lastname" value="<%=
<%= lastname %>">
               <input type="submit">
          </form>
     </body>
</html>confirmation.jsp
<%@ include file="parameters.jsp">
<html>
     <body>
<!-- the action of this form will be the page that
at inserts the data into the database -->
          <form action="insertintodb.jsp" method="post">
<input type="text" name="firstname" value="<%=
<%= firstname %>">
<input type="text" name="lastname" value="<%=
<%= lastname %>">
               <input type="submit" value="OK">
          </form>
          <form action="form.jsp" method="post">
<input type="hidden" name="firstname" value="<%=
<%= firstname %>">
<input type="hidden" name="lastname" value="<%=
<%= lastname %>">
               <input type="submit" value="Edit">
          </form>
     </body>
</html>
Hi,
Thanks a lot for the information.I will try to do as you have suggested.Will post when i go into problems...
Many thanks
AS

Similar Messages

  • Help with Jtext fields on JSP page?

    Hi All,
    How can I collect an integer on a JSP page from user input?
    I am looking to vallidate the user input also thought about vallidating using HTML then passing/casting the input to a Java variable for further manipulation on the page.
    I cannot use response.encodeUrl for this.
    Effectively what I would like to do is replicate what a JTextField with an action listener would do to retrieve user input in a desktop Java application.
    Any ideas and help would be welcome.
    regards
    Jim Ascroft

    Hi All ,
    I propbably didnt put my questions all that well.
    So I wil try to be more specific.
    1.How can I collect an integer on a JSP page from user input?
    I am looking to vallidate the user input. I thought about vallidating using HTML then passing/casting the input to a Java variable for further manipulation on the page.
    I cannot use response.encodeUrl for this.
    2.I understand that my Java helper classes are compiled into .class files and then used by the JSP page as required. Also the Java code within the <% %> Java tags is recognised and runs .
    So if the java between the <% %> tags can be compiled and used why can other Java components eg Swing or AWT not be used in the same way?
    Effectively what I would like to do is replicate what a JTextField with an action listener would do to retrieve user input in a desktop Java application.
    Any ideas and help would be welcome.
    regards
    Jim Ascroft

  • Help With Integrating Servlet and JSP Page?

    Hello There
    --i made jsp page that contain name and description fields and add button
    --and i made servlet that contain the code to insert name and description in the database
    --and i want to make that when the user hit the add button
    -->the entered name and description is sent to the servlet
    and the servlet sent them to database?
    here's what i 've done:
    the jsp code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="jpage.jsp" method="get">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="submit" value="Add" name="button" />
           </h3>
       </form>
        </body>
    </html:html>the servlet code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    class NewServlet1 extends HttpServlet{
         Connection conn;
         private ServletConfig config;
    public void init(ServletConfig config)
      throws ServletException{
         this.config=config;
    public void service (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
       HttpSession session = req.getSession(true);
       res.setContentType("text/html");
    try{
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
         PreparedStatement ps;
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, "aa");
          ps.setString (3, "bb");
          ps.executeUpdate();
          ps.close();
          conn.close();
      }catch(Exception e){ e.getMessage();}
      public void destroy(){}
    }

    The JSP Code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="actionServlet.do?action=Additem" method="*post*">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="button" value="Submit">
           </h3>
       </form>
        </body>
    </html:html>The Servlet Code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    public class NewServlet1 extends HttpServlet implements SingleThreadModel {
        public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
            doPost(request,response);
        public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
              String action = request.getParameter("action"); // action = "Additem"
              if (action.equals("Additem")) {
                   String name = request.getParameter("name");
                   String description = request.getParameter("description");
                         RequestDispatcher reqDisp = null;
                   try{
                  Connection conn;
                  PreparedStatement ps;
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, name);
          ps.setString (3, description);
          ps.executeUpdate();
          ps.close();
          conn.close();
          reqDisp= request.getRequestDispatcher("./index.jsp");
          reqDisp.forward(request, response);
                   catch (Exception ex){
                        System.out.println("Error: "+ ex);
    }The web.xml code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
            <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml</param-value>
            </init-param>
            <init-param>
                <param-name>debug</param-name>
                <param-value>2</param-value>
            </init-param>
            <init-param>
                <param-name>detail</param-name>
                <param-value>2</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
            </servlet>
        <servlet>
            <servlet-name>NewServlet1</servlet-name>
            <servlet-class>NewServlet1</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>NewServlet1</servlet-name>
            <url-pattern>/NewServlet1</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
            </welcome-file-list>
            <servlet>
         <servlet-name>actionServlet</servlet-name>
         <servlet-class>com.test.servlet.NewServlet1</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>actionServlet</servlet-name>
         <url-pattern>*.do</url-pattern>
    </servlet-mapping>
        </web-app>

  • Button action with onclick in a jsp page using Jscript

    hi,
    I am facing a problem in setting an action with a button in a jsp page the error is object does'nt support this function,kindly send me reply as soon as possible.
    Santhosh

    hi,
    I am facing a problem in setting an action with a button in a jsp page the error is object does'nt support this function,kindly send me reply as soon as possible.
    Santhosh

  • Help with buttons :S

    hi all,
    i'm new to flash but i have an idea whats going on with webpages. I need some help with buttons! i have a website and its has a stage and 9 different flv's (screens). I've been trying to read online and i can't find out how to navigate to different screens, example below
    home          |            |
    about us     |  stage   |
    contact       |            |
    you click one one button it updates the stage. also i'm using actionscript 2.0.
    thanks for any help ahead of time
    Thank you,

    Is it a wi-fi or cellular connection that isn't working?  If its wi-fi and other people/computers/phones can connect check your settings.  If its cellular, are other people's phones (on the same carrier) working in the same location? If other people can't connect then it is likely a network problem.  If others can you may need to reset/restore you iPhone.

  • HELP!!!!!!!!! 3 Submit Buttons on 1 JSP page

    Hi,
    I would really appreciate any assistance to my question. I have 3 submit buttons that need to be passed to another JSP page.
    1. Is it possible to use submit 3 times like here?
    <input type="submit" name="btnSub" value="Modify">
    <input type="submit" name="btnSub" value="Remove">
    <input type="submit" name="btnSub" value="Pssword Reset">
    2. Below is my code. Can you show me how to pass the values from the 3 submit buttons?
    Thanks in Advance!
    </form>
    </td>
    <td width=212 style='width:159.0pt;background:#FFE599;padding:0in 0in 0in 0in'>
    <!-- Profile Maintenance ------------------------------------------------------------------------->
    <div align=center>
    <table border=2 cellpadding=0 style='mso-cellspacing:1.5pt;mso-padding-alt:
    0in 0in 0in 0in'>
    <form NAME="queryUserName" method="GET" ENCTYPE="application/x-www-form=urlencoded"
    action="securityProfile.jsp"> <!-- onSubmit = "return checkForm();"-->
    <tr>
    <td colspan=2 style='padding:0in 0in 0in 0in'>
    <p class=MsoNormal align=center style='text-align:center'><b><span
    style='font-size:10.0pt;font-family:Geneva;color:#990000'> Profile Maintenance </span></b> </p>
    </td>
    </tr>
    <tr>
    <td align=center colspan=2 style='padding:0in 0in 0in 0in'>
    <select name="UserID" size="5">
    <option selected value="NO_VALUE"> --Select an Admin-- </option>
    <% while(rset.next())
    v_ID = rset.getString("ID");
    v_Name = rset.getString("Name");
    %>
    <option value="<%= v_ID %>"><%= v_Name%></option>
    <% System.out.println("List of Options counter: *** " + i + " ***"); %>
    <!-- <option value="<%= i %>" > <%= v_Name%> </option> -->
    <%
         i = i + 1;
    %>
    </select></font></td>
    </td>
    </tr>
    <tr>
    <td align="center" style='padding:0in 0in 0in 0in'>
    <p class=MsoNormal><span style='font-size:7.5pt;font-family:Geneva;
    color:#990000'> To modify admin's access to Corp Functions, Business Units, & Dept IDs: </span><br>
    <input type="submit" name="btnSub" value="Modify Profile"> </p>
    </td>
    </tr>
    <tr>
    <td align="center" style='padding:0in 0in 0in 0in'>
    <p class=MsoNormal><span style='font-size:7.5pt;font-family:Geneva;
    color:#990000'> To remove an admin: </span><br>
    <input type="submit" name="btnSub" value="Remove Admin"> </p>
    </td>
    </tr>
    <tr>
    <td align="center" style='padding:0in 0in 0in 0in'>
    <p class=MsoNormal><span style='font-size:7.5pt;font-family:Geneva;
    color:#990000'> To change admin's password: </span><br>
    <input type="submit" name="btnSub" value="Password Reset"> </p>
    </td>
    </tr>
    </form>

    When implementing the code below, it only reads the first form, and then stops there. It doesn't execute the 2nd form.
    <form name='form_1' action='T2.jsp'>
    <input type=hidden name="user" value="Me">
    <input type=submit value='Button1'>
    <form name='form_2' action='T3.jsp'>
    <input type=submit value='Button2'>
    </form>
    </form>
    If I put each form separtely like below, then it returns nothing.
    <form name='form_1' action='T2.jsp'>
    <input type=hidden name="user" value="Me">
    <input type=submit value='Button1'>
    </FORM>
    <form name='form_2' action='T3.jsp'>
    <input type=submit value='Button2'>
    </FORM>
    What's my other alternative? I would appreciate any help.

  • Help!!! What's wrong with this code. JSP page can't retrieve properties.

    I'v got a piece of code that was created to send some parameters to JSP page via POST method. But in server page I can't retrieve this parameters, please help me and try to find "main" bug in this code.
    try {
    URL url = new URL("http://localhost/index.jsp");
    HttpURLConnection httpCon = (HttpURLConnection)url.openConnection();
    httpCon.setRequestMethod( "POST" );
    httpCon.setDoOutput( true );
    String body = URLEncoder.encode("name=Oleg", "UTF-8");
    httpCon.setRequestProperty( "Content-length", Integer.toString( outBody.length() ));
    httpCon.setRequestProperty( "Content-type", "application/x-www-form-urlencoded" );
    OutputStream os = httpCon.getOutputStream();
    PrintWriter ow = new PrintWriter( os );
    ow.print( body );
    ow.flush();
    ow.close();
    } catch (....) {
    }

    Hi
    You must not encode all the body just the values of the parameters.
    You can do as following in order to send a post request with 2 parameters
    String param1 = "Co & sons";
    String param2 = "ltd.";
    String encParam1 = URLEncoder.encode(param1,"UTF-8");
    String encParam2 = URLEncoder.encode(param2,"UTF-8");
    String body = "param1="+encParam1+"&param2="+encParam2;
    OutputStream os = httpCon.getOutputStream();
    PrintWriter ow = new PrintWriter( os );
    ow.print( body );
    ow.flush();
    //read the response from the jsp
    InputStream inS = httpCon.getInputStream();
    byte[] buff = new byte[5000];
    StringBuffer sbuff = new StringBuffer();
    int nrBytes ;
    while( (nrBytes = inS.read(buff, 0, 5000))!=-1) {
      sbuff.append(new String(buff,0,nrBytes));
    inS.close();
    ow.close();
    ...This is the jsp page which gets the parameters
    <%
         String param1 = request.getParameter("param1");
         param1 = new String(param1.getBytes(),"utf-8");
         String param2 = request.getParameter("param2");
         param2 = new String(param2.getBytes(),"utf-8");
    %>I hope I helped you.
    Regards,
    BG

  • Help fowarding data to a jsp page

    I know your not meant to double post but i was told it would be better if i post this message in here so:
    I am trying to create a bean that will connect to a database and bring back data depending on what a user typed into a html form. However i need some help, if the database does not find any data i want to send a message saying something like "no results" to a jsp page which then be displayed, if results are found i then want to pass on these results to another jsp page.
    My question is how would i pass on this data / message to a jsp page? Also if more then one piece of data is returned from the database how would i be able to make sure everything is sent to the jsp?

    In the above code a Servlet, a JavaBean, JDBC and everything else is combined into just one class. That is not how it is.
    A Servlet is a Servlet --- it is not a JavaBean ---- So create a dedicated class that is purely a Servlet and does what a Servlet is supposed to do. Taking the tutorial on Servlets will help you understand them better.
    A JavaBean is a JavaBean ---- it is not a Servlet --- Create a JavaBean class.
    Move the Database Connection code to the Data Access Layer --- this means create separate classes that are meant to only access data.
    It is better to learn each individual concept before attempting something more complex.
    Also build small code into your class, ---- understand what it's doing then compile it frequently.
    I'll give you hints on how you should properly implement an MVC pattern.
    JSP Page
    This page contains an HTML form , with form fields and a submit button.
    In the action attribute of the form you will specify the URL-pattern for the Servlet.
    The URL-pattern for the servlet will be defined in web.xml , for example
    <form action="/MyFirstServlet" method="post" >
    </form>Then create a Servlet , in its package , so for example
    com.myapp.servlet.MyFirstServlet.java
    Place the servlet file in a proper folder structure in the Java source folder.
    When the Servlet it compiled it needs to go under the corresponding folder structure under your applications /WEB-INF/classes/ folder.
    Your servlet will look something like this:
    package com.myapp.servlet.MyFirstServlet;
    //All import statements go here
    public class MyFirstServlet extends HttpServlet{
       public void doGet(HttpServletRequest request, HttpServletResponse response) throws ......... exceptions {
            doPost(request, response);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ......... exceptions {
            //Process the request here
    request.getAttribute("someFormField");
    //similarly get all form fields
    //Store all fields into a JavaBean
    //Then call a method that saves the data to database
    saveToDatabase(pass the javabean here);
    private void saveToDatabase(SomeJavaBean someJavaBean){
        //Over here call a DataAccessObject -- DAO that saves the data
       // to the database.
    /WEB-INF/web.xml
    When you write a servlet you need to define it in web.xml and define a URL mapping also for it in web.xml
    JavaBean example
    com.myapp.beans.Person.java
    package com.myapp.beans.Person;
    //whatever import statements (if any) go here
    public class Person{
    private int age;
    private String firstName;
    public Person(){} //Every JavaBean must have a default constructor
    //Write the Getters and Setters for the private fields above.
    //in proper JavaBeans notation as follows
    public void setAge(int age){
      this.age = age;
    public int getAge(){
       return this.age;
    //Similarly write getter and setter for firstName
    }You would then use the above JavaBean to transport data between the database layer and JSP layer via the Servlet.
    If you are Saving to the Database , you read the HTML form's data and save it into one JavaBean and then pass the JavaBean to the database layer to be saved. In the Database layer you write JDBC code to save the data.
    If you are Reading from the database, you create an ArrayList of JavaBean objects in the database layer using JDBC code and then pass the ArrayList to the Servlet which stores it in the Request, then the servlet forwards control to the JSP which then reads the data from the request.
    Most of the above is pseudo code, it is just there to give you an idea about how do this properly in MVC --- you can then read tutorials on each of the above --- for example tutorial on Servlet, tutorial on JDBC, tutorial on Java Classes and then understand them more.

  • Do paging with header on a JSP page

    Hi:
    We have a data report displayed as a JSP page. The report displays 200 rows of data. We need to print these 200 rows report with a header/title on each page. And our user only wants to hit he Browser print button once. This would have been easy if we don't have to insert the header on each print page. But how can we print this multiple page report with a header? Do we need to use CSS? any help will be appreciated.
    reportPrinter

    Okay bear with me:
    Step 1: determine how many rows in a table with a header will print on a single page
    Step 2: Create a jsp that breaks your data down into tables of the row size determined above.
    For example if the data consists of 1000 rows and 50 rows w/ headers will fit on a page
    then the jsp will create 20 tables of 50 rows w/ headers each.
    Step 3: Use CSS to put page breaks between the tables.
    http://www.htmlgoodies.com/beyond/css_print.html
    Step 4: In the original JSP use the HTML LINK tag to link it to the JSP you just created
    http://www.gself.com/xbas/head/linking.htm
    <link rel="alternative" href="{new JSP url}" type="text/html" media="print" />
    Step 5: On the original JSP provide a button that when clicked on will call the JavaScript print function.
    Now what should happen is that when the button on the original JSP is clicked the JavaScript print function will be called but instead of the page displayed in the browser being printed the alternative page
    in the LINK tag will get printed. This alternative JSP page is formatted to print one table with headers per page.
    The only part of this that I have not used in a production web app iss the CSS page break part. The rest of it I know will work.

  • Problem with bean in a JSP page

    I have developped a JSP pages in wich I call a bean with
    <jsp:useBean id="db" scope="request" class="SQLBean.class" />
    The bean SQLBean.class is in the same directory as the JSP page.
    When I execute the JSP, I have the following error:
    SQLBean.class db = (SQLBean.class) JSPRuntime.instantiateBean("db", "SQLBean.class", "request", __db_was_created, pageContext, request, session, application);
    Syntax error: [expected after this token
    Syntax error: "]" inserted to complete ArrayAccess
    Syntax error: "AssignmentOperator AssignmentExpression" inserted to complete StatementExpression
    I use JRUN with IIS
    Thanks for the help

    I am assuming your class name is SQLBean.
    use:
    <jsp:useBean id="db" scope="request" class="SQLBean" />
    instead of:
    <jsp:useBean id="db" scope="request" class="SQLBean.class" />

  • NEED HELP WITH BUTTONS IN AS3!!

    Hello, I am stumped with an action scripting problem. I'm
    trying to create a really basic website in flash using buttons to
    jump from scene to scene. Let's say I want to do something as
    simple as make scene 1 jump to scene two right? I'll place in my
    scene 2 button on my first page:
    But instead of the scene changing to the next scene after I
    press the button, these errors come up!!
    1180: Call to a possibly undefined method on.
    1120: Access of undefined property release.
    1120: Access of undefined property _root.
    I've tried asking in so many different forums, I usually do
    pretty good with action scripting for buttons. But this is my first
    time doing it with cs3. I'm utterly confused, someone please help!!
    Thank you.
    The code on this page is the code I was using to try to
    change scenes...Oh! and whenever I try to put a code in the actual
    button, it won't let me. I just get a message that says something
    like "Can't have any actions applied to it".

    foxxpop,
    > But instead of the scene changing to the next scene
    > after I press the button, these errors come up!!
    >
    > 1180: Call to a possibly undefined method on.
    > 1120: Access of undefined property release.
    > 1120: Access of undefined property _root.
    You're using three terms that aren't supported in
    ActionScript 3.0: the
    on() function, the release parameter to that function, and
    _root. In
    ActionScript 3.0, you'll have to give your button an instance
    name and wire
    it up like this:
    http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3
    In that blog entry, you'll see (with explanation) something
    that looks
    like this:
    myButton.addEventListener(
    MouseEvent.CLICK,
    function(evt:MouseEvent):void {
    trace("I've been clicked!");
    Just bear in mind that you can also make that a named
    function, like
    this:
    myButton.addEventListener(MouseEvent.CLICK, clickHandler);
    function clickHandler(evt:MouseEvent):void {
    trace("I've been clicked!");
    > I've tried asking in so many different forums, I usually
    do
    > pretty good with action scripting for buttons. But this
    is
    > my first time doing it with cs3.
    Your issue isn't Flash CS3, it's that your FLA file is
    configured for
    ActionScript 3.0. If you change that to AS2, you can go right
    on using the
    same approach you used to -- and you'll be able to attach
    code directly to
    objects. ;)
    David Stiller
    Co-author, The ActionScript 3.0 Quick Reference Guide
    http://tinyurl.com/2s28a5
    "Luck is the residue of good design."

  • Help with Printing on a JSP dynamically

    Hi
    I am using a bean to list customer information like this on a JSP page
    The bean has different customer information and the products purchased
    I iterate thru the bean on the jsp and i need to print it in the following format
    Customer Price
    CUstomer1........................................................................................$20.00/month
    Cutomer238899................................................................................$59.00/month
    check....................................................................................................$45.00/Month
    Now the biggest problem i have is printing the dots so that the price and customer stay fixed...How do I figure out dynamically how many dots to display????
    Can someone help me out thanks
    ~K

    I agree with that other person in that you should just use a TABLE (without using dots). BUT, if you are really persistent, you can use the <pre> tag so that every character displayed will take the same space. Figuring out the number of dots then just becomes a problem of calculating the length of each customer and the price subtracted by the total length of the whole thing.
    Easy as pie. =)
    ~ Joe

  • Need help with Telnet command in JSP

    Here is the code I have been working on but it will not display the buffer to the page..
    String [] cmd1 = {"cmd.exe","/c","telnet hqsun1.xx.xxxxx.com"};
              Process n;
              String T = "" ;
              n = Runtime.getRuntime().exec(cmd1);
              BufferedReader in1 =
              new BufferedReader(new InputStreamReader(
              n.getInputStream()));
              while((T=in1.readLine()) != null)
              out.println(T+"");
    Maybe someone has done this before? I am trying to acomplish a telnet net session to the screen with some exicuted commands, because this tool is going to be used to help determine system status when the help desk needs to check on something.
    Thanks

    I don't want to be discouraging, but I'm not quite sure you've thought the problem through. You say that you'd like to create a web page capable of providing various pieces of information to the help desk, and you suggest ping and the output of various canned telnet commands as examples.
    What is preventing the help desk from just executing those commands at the command prompt?
    I realize that the people working the help desk are (ahem) there for a reason, but it is really much faster for me to just simply type "ping www.mpalfrey.com" at the prompt, then it is for me to fire up the web browser and wait for a response that way. You will likewise find that it is a lot more convenient to perform diagnosis on remote machines directly from the command prompt.
    Uh, it's kind of like giving someone a screwdriver, then saying, "oh wait a second" and making them wear an oven mitt in order to use the screwdriver.
    But, if you really want to do it this way, the best thing to do is create a wrapper class that directly calls the system command and captures the output to a stringbuffer. Then your JSP page simply has to clone that wrapper via a new() command and trigger it if you go the singleton route. The code would look something like this...
    <%@ import page="com.mpalfrey.shellcommands.ping" %>
    <%
       myPing foo = new myPing( request.getParameter( "victim" ) );
       foo.trigger();
    %>
    Ping results:
    <%=foo.results()%>JSP can do a lot of wonderful things, but that doesn't mean you have to do it that way. :)

  • Two buttons in same jsp page

    hello to java people
    My ? is, jsp page named as login.jsp, In this page i want to use two buttons.
    If i click on one buton it will goto sucess.jsp and for another button it will go to find.jsp.
    i.e, two actions in same page, is it possible ?
    help me by giving sample code.
    thanks

    thanks balu for ur answer.
    pure java ?
    But my doubt is see we take one form
    <form action="sucess.jsp">
    <input text...>
    <input text...>
    <input type=submit name=sucess>
    <input type=submit name=find>
    </form>
    means whether i take two buttons as submit and names r diff..
    but at top only one action is there .
    how can they know to which page it has to go?
    do u understand my ?
    can u please give some sample code so that i can understand
    thanks

  • Help with displaying errors in jsp using html:errors/

    Here is my problem.
    In my overridden ActionForm.validate() method, i am returning ActionErrors (as required). When there are input errors in my form submission, the control goes back to the JSP page i used to read user input (so far so good). The JSP page is rendered fine for taking input for the second time but no errors are displayed although i am using the tag <html:errors/>
    I tried to find the org.apache.struts.action.ERROR in my request attributes and it is there with the size of 1 (because i am reporting one error, in my sample run). Any idea why <html:errors/> won't display the errors even though they are there??? Here is what i am doing in my ActionForm class:
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    if (this.email == null || this.email.length() < 1) {
    errors.add("username", new ActionError
    ("error.username.required"));
    return errors;
    Any help is appreciated.

    First of all, thanks for taking time to look at my message. Here is how my message-resources tag look like in struts-config.xml file:
    <message-resources parameter="ApplicationResources"/>
    The "ApplicationResources.properties" file exist in the WEB-INF folder of my application and following are the entries in that file that i think are relevant:
    errors.header=<h3><font color="red">Validation Error</font></h3>You must correct the following error(s) before proceeding:<ul>
    errors.footer=</ul><hr>
    error.username.required=<li>Username is required</li>
    Is there anything else needed to go into resource file? Or should i put my resource file somewhere else?

Maybe you are looking for

  • Delivery credit check

    Dear friends I have analyzed one customer, at present time During Sales order creation credit limit checking, we have created one sales order in development server with credit limit... We cannot make the delivery for that sales order. Now we have rem

  • Intra pnat to plant transfer -STO- Freight is going to add on materialFG

    Dear Friends , I wants to transfer stock from plant -1 to plant-2 (Intra company means in one company code plant to plant) I am doing 1)STO-PO 2)MIGO_GI (Mov.type-351) 3)MIGO (Mov.type-101) using standard pricing of STO at header level. But when i pu

  • Clear Report Queue on local install

    I have 9i developer installed on my local machine, with the whole oc4j and report server running on it for development purposes. The report server queue is getting large and I want to clear it out. How do I do this?? Everything I have found is about

  • SCOM 2012 upgrade to R2 - Move SRS to new server

    I am currently working on an upgrade to our SCOM 2012 R1 environment to SCOM 2012 R2.  As part of this I would like to move our SRS database from running SQL 2008 Enterprise to SQL 2012 Standard to save some licensing costs.  The initial installation

  • Is it  possible to enhance transaction S_PL0_86000028?

    Hello Gurus, I need to add 'Cost Center' to the output of 'S_PL0_86000028'. It is a standard report created by Report Painter tool. Is it possible to enhance this report. If yes, how? . Or is it possible to copy this report and create a custom report