ID value to servlet

Quick qeustion: Is there a way to send the id value of a html input tag to a servlet?
I've been struggling with this problem for some time now and I'm just not sure how to solve it.

Well, I'm using jstl's foreach tag to create a html table from a list of objects.
At the end of each row I place a submit button to delete the record. Problem is
it deletes the very first record instread of the one selected.
Here is the code to better explain my delema:
<c:forEach var="person" items="${persons}">
            <tr>
                <td>
                    <input size="5" name="id" type="text" value="<c:out value="${person['id']}"/>"/>
                </td>
                <td>
                    <input type="text" name="name" value="<c:out value="${person['name']}"/>"/>
                </td>
                <td>
                    <input id="<c:out value="${person['id']}"/>" type="submit" value="Delete" name="submit"/>
                </td>
            </tr>
        </c:forEach>Basicly what I am trying to do is give each delete button created by the foreach tag the same id
as the person object and when it is clicked pass that id to the servlet where the object is deleted
from the database.

Similar Messages

  • Getting the values from   Servlet

    Hi EveryOne,
    I have done one thing using Flex,i have send the parmeters
    from flex to servlet using HttpService and in the servlet i
    captured them and used them.Now what i want is i have to capture
    the values from servlet to flex .
    Response content in servlet is set to text/xml,any one please
    give me the idea how to do thsi or please send me some code to do
    this.
    {Sorry for my English} Thanks,
    Namala.

    Hi,
    You have to handle the result event of the HTTPService
    component. In the result handler you will have access to the
    ResultEvent object which will contain the response from the server
    in the "result" property. Please visit the URL below for more
    details on how to handle result from the server.
    http://livedocs.adobe.com/flex/3/html/data_access_6.html#235586
    Hope this helps.

  • Which table stores this value Transmission Servlet Base URL

    Hi All,
    EBS r12 12.1.3
    From the screen in Payment
    Update Payment System: FirstDataNorth
    i am looking for table that stores this value
    Transmission Servlet Base URL
    did look in these tables FND_PROFILE*but not available.
    Please help!
    Regards,

    Hi,
    I am not sure, whether you are looking at the correct place. Can you also let us know what made you ask to check the infromation from table.
    But there are configuration file which stores these information. I believe the source we are looking info might be wrong.
    Also have a look at:
    Oracle Payments Implementation Guide
    Best Regards,

  • How to send the values from servlet to jsp

    hi folks,
    I need to send a lot of values from servlet to jsp so that i can display the values in jsp. Any sollution for this. Its very urgent.
    Thanks in advance

    Hi lieo,
    Can u send me the sample code for that.
    Thank q

  • Want to display from database but javaclass not returning values to servlet

    I am trying to view values stored in database using jsp, servlets and java class. Jsp is calling servlet and servlet calls java class file. and javaclass file retrieves data from database and sends it back to servlet. But my problem is javaclass file doesnt return the value to servlet and print. Here is my code
    This is the javaclass file.
    package pack;
    import java.util.*;
    import java.sql.Driver.*;
    import java.sql.Connection.*;
    import java.sql.*;
    import java.sql.DriverManager.*;
    import java.sql.SQLException.*;
    import java.io.*;
    import java.io.Serializable;
    import java.util.Vector;
    import pack.ser1;
    /* Control is got from the servlet file */
    public class employbean implements Serializable
      public Vector result;
      public Vector getResult() throws ClassNotFoundException, InstantiationException, IllegalAccessException
                /* Connection is established to retrieve data from the database */
                Vector v = new Vector();
                ResultSet rs = null;
                PreparedStatement st = null;
                try
                 Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                 Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/sample?user=user&password=password");
                  st = connection.prepareStatement("Select * from samp");
                  rs = st.executeQuery();
                  while(rs.next())
                      v.addElement(rs.getString("empid"));
                  st.close();
                  connection.close();
                 catch(SQLException esql)
                      esql.printStackTrace();
                  this.result = v;
                 /* Control is sent back to the servlet */
                 return result;
    }Here is the servlet code.
    package pack;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import pack.employbean;
    import java.util.Enumeration;
    import java.util.Vector;
    import pack.*;
    public class ser1 extends HttpServlet
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try
              employbean ebean = new employbean();
              Vector v = ebean.getResult();
              Enumeration en = v.elements();
              while(en.hasMoreElements())
                out.println("employee id= "+ en.nextElement());
              out.println("employid"+employid);
             catch(Exception m)
               out.println(m);
             out.close();
            // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
        /** Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
        /** Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
        /** Returns a short description of the servlet.
        public String getServletInfo()
            return "Short description";
    }Please help me with my code as where i might have gone wrong and help me rectifying the errors.
    I also would like to know if this is MVC pattern.
    Thanks in Advance

    I am trying to view values stored in database using jsp, servlets and java class. Jsp is calling servlet and servlet calls java class file. and javaclass file retrieves data from database and sends it back to servlet. But my problem is javaclass file doesnt return the value to servlet and print. Here is my code
    This is the javaclass file.
    package pack;
    import java.util.*;
    import java.sql.Driver.*;
    import java.sql.Connection.*;
    import java.sql.*;
    import java.sql.DriverManager.*;
    import java.sql.SQLException.*;
    import java.io.*;
    import java.io.Serializable;
    import java.util.Vector;
    import pack.ser1;
    /* Control is got from the servlet file */
    public class employbean implements Serializable
      public Vector result;
      public Vector getResult() throws ClassNotFoundException, InstantiationException, IllegalAccessException
                /* Connection is established to retrieve data from the database */
                Vector v = new Vector();
                ResultSet rs = null;
                PreparedStatement st = null;
                try
                 Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                 Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/sample?user=user&password=password");
                  st = connection.prepareStatement("Select * from samp");
                  rs = st.executeQuery();
                  while(rs.next())
                      v.addElement(rs.getString("empid"));
                  st.close();
                  connection.close();
                 catch(SQLException esql)
                      esql.printStackTrace();
                  this.result = v;
                 /* Control is sent back to the servlet */
                 return result;
    }Here is the servlet code.
    package pack;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import pack.employbean;
    import java.util.Enumeration;
    import java.util.Vector;
    import pack.*;
    public class ser1 extends HttpServlet
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try
              employbean ebean = new employbean();
              Vector v = ebean.getResult();
              Enumeration en = v.elements();
              while(en.hasMoreElements())
                out.println("employee id= "+ en.nextElement());
              out.println("employid"+employid);
             catch(Exception m)
               out.println(m);
             out.close();
            // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
        /** Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
        /** Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
        /** Returns a short description of the servlet.
        public String getServletInfo()
            return "Short description";
    }Please help me with my code as where i might have gone wrong and help me rectifying the errors.
    I also would like to know if this is MVC pattern.
    Thanks in Advance

  • Froward  bean value to servlet

    if I want to forward bean value to servlet I use
    <%@ page import="java.util.*" %>
    <html>
      <head>
    <jsp:useBean id="formHandler" class="cedars.FormBean" scope="request">
    <jsp:setProperty name="formHandler" property="*"/>
    </jsp:useBean>
    <%
       if (formHandler.validate()) {%>
    <jsp:forward page="/servlet/Insert"/>
    <% } else { %>
    <jsp:forward page="/resubmit.jsp"/>
    <% } %>
    </body>
    </html> is that right?
    why i keep get error message like NullPointerException on <jsp:forward page="/servlet/Insert"/>
    my beab local on cedars.FormBean, my Insert.java in WEB-INF/classes
    thank you for the help

    Hi,
    don't think it will execute EL this way. However,you should be able to execute JavaScript (what you should keep in mind though is that any DOM manipulation on AMX page rendering is a risk and can put you into trouble). What is the HTML you want to insert (and to what extend do you control the metadata tags added to the AMX page this way? Wouldn't it be possible to add the content using AMX components?
    Frank

  • To get the image value in servlet.

    I have jsp page.
    in jsp.
    next button image is there.
    when I click on that image.
    I want that image value.
    How to get the image value in servlet.
    below is the code...
    <input type="image" src="./img/btn_next.gif" name="next" value="next" onClick="ValidateNext();">
    java script is
    function ValidateNext()
    document.ASCMasterView.submit()
    now I want to get the image value in servlet.
    then I will make decission for processing...
    Any one help me on this.

    Crosspost allready answered here

  • How to send a String value  from Servlet to  Action class in Struts .

    when iam trying to send string value from Servlet to Struts Action class through Http Session, iam getting null value, iam really in big confusion, help me.

    please elaborate clearly or put you code of both action and servlet here
    Are both of them in same web application

  • Request.getParameter() values in servlet? Urgent

    String str=request.getParameter();
    I am facing a problem when i submit the arabic values from hidden form fields using javascript.
    In servlet when i tries to retrive the arabic values stored in the session, it displays only
    garbage values(ie. ?????????).
    How to solve this problem?
    Please clarify and if possible give some samples.
    Thanks & Regards,
    Govindaraman

    Hi Govindaraman,
    in O'Reilly's Servlet book in the internationalization section it describes how. You have to change the String returned into bytes using the proper enconding, then back into a String to it will convert to Unicode.
    The basics are this:
    String parameterName="your param name";
    String encoding = "your charset encoding on the page";
    String value = request.getParameter(parameterName);
    value = new String(value.getBytes(), encoding);
    value is now a Unicode string that should be correctly interpreted.
    You can use new String( oldString.getBytes(), encoding) to convert between charsets.

  • Getting the values from Servlet to Flex

    Hi EveryOne,
    i have a doubt ,i can send the parameters from flex to a
    servlet application ,and i can use these parameters there,
    so now can i get the values that are created in servlet to
    flex? response content in servlet is set to Xml not Html,
    any one please give me the idea or send me some code.
    *********Sorry For My English********

    I'm assuming you're writing the generated XML to the response
    object in your servlet.
    In the HTTPService class that you're using to send data to
    servlet, register a result event listener and once that event
    fires, you should get the results thru event.data property.
    If you think about it, this is exactly like you'll handle a
    AJAX call in your servlet and send data back only this time you've
    events instead of states.
    ATTA

  • Passing values to servlet

    HI All
    I am developing a project using html and servlets. from my html page(regis.html) i am trying to pass the values which are entered by the user to the servlet (Admin_Regis.java) which is in the another package called Admin. The way i am doing is
    <form class="registerlogin" method="post" action="Adimn/Admin_Regis">
    but i am not able to send the values to the servlet. It showsr HTTP Status 404 - /Adimn/Admin_Regis.
    My question is how to pass the values from html to servlet which is the different packages . I have three more packages .
    Can any body please help me in solving this problem.

    HI
    The problem i was facing ie the values was not able to pass to the servlet i got the part of the solution for that . What actually i have done is i have kept all my web pages in one saperate folder so i was not able to send . But now when all my pages are in default folder even then i was not be send the values can any body please help me out for this problem.

  • How to get XML value using servlet?

    how to get values from a XML file using servlet ? Thank you.
    for example: how can I get the location value (aaa) from this XML file?
    abc.xml:
    <business>
    <location>aaa</location>
    </business>

    Try to use XML Parsers to do the job.
    Use DOM or SAX Parsers that are freely available.
    Some of the popular ones are xerces, DOM, SAX.

  • Best way to pass values btwn servlets?

    i have to pass multiple values from one servlet to the next, when the user submits a form.
    i don't know how many, or even the names of the parameters until the user submits the form.
    right now, i send them as hidden fields when the form is submitted.
    in the receiveing servlet, i dump them into a hashtable usng httpUtils.parse QueryString, and then parse them out of the hashtable.
    is there a better way?
    TIA,
    Scott Murray

    DrClap,
    Yes, I am working with a single user.
    Last night I reworked it as follows, dumping the parameters into a Properties object, which is easier to work with than a hashtable (at least it is for me):
    Properties props = new Properties();
    Enumeration paramNames = req.getParameterNames();
    while (paramNames.hasMoreElements()) {
    String name = (String) paramNames.nextElement();
    String[] values = req.getParameterValues(name);
    props.setProperty (name, values[0]);
    The trick is that I don't know in advance the names or how many parameters are being received; I marked them on the sending page with different prefixes (@@@, ###, $$$) so as I parse thru the Properties object, I can determine what type of parameter it is.
    Is there a better object to use than the Properties object? My ultimate goal is to have something similar to a ResultSet that I can search and step thru multiple times.
    Thanks for you time and expertise,
    Scott Murray

  • ADF BC how to access session backing bean value in servlet

    Hi everyone,
    How do I access session backing bean value in a servlet?

    Frank, thanks for your reply.
    I'm not sure how I can incorporate this example into my situation. Let me explain more detail about my problem.
    "servlet" in my post here actually means a custom servlet I wrote for rendering an image that is stored in db as ordimage. In this servlet, I get hold of my appmodule by using Configuation.createRootApplicationModule(). By doing so (If I'm not wrong) a new database session/connection is created. What I'm going to achieve is set application context for this new session/connection in db with the data stored in a session backing bean in the view layer.
    I can pass the required data to the servlet thru url parameter, but I don't want to do it this way for the reason that the data may contains sensitive information.
    I hope I have explained myself well.
    Message was edited by:
    bsmt

  • Want to display from database but javaclas not returning values to servlets

    I am trying to view values stored in database using jsp, servlets and java class. Jsp is calling servlet and servlet calls java class file. and javaclass file retrieves data from database and sends it back to servlet. But my problem is servlet doesnt print the values.
    Here is my code
    This is the javaclass file.
    package pack;
    import java.util.*;
    import java.sql.Driver.*;
    import java.sql.Connection.*;
    import java.sql.*;
    import java.sql.DriverManager.*;
    import java.sql.SQLException.*;
    import java.io.*;
    import java.io.Serializable;
    import java.util.Vector;
    import pack.ser1;
    /* Control is got from the servlet file */
    public class employbean implements Serializable
      public Vector result;
      public Vector getResult() throws ClassNotFoundException, InstantiationException, IllegalAccessException
                /* Connection is established to retrieve data from the database */
                Vector v = new Vector();
                ResultSet rs = null;
                PreparedStatement st = null;
                try
                 Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                 Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/sample?user=user&password=password");
                  st = connection.prepareStatement("Select * from samp");
                  rs = st.executeQuery();
                  while(rs.next())
                      v.addElement(rs.getString("empid"));
                  st.close();
                  connection.close();
                 catch(SQLException esql)
                      esql.printStackTrace();
                  this.result = v;
                 /* Control is sent back to the servlet */
                 return result;
    }Here is the servlet code.
    package pack;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import pack.employbean;
    import java.util.Enumeration;
    import java.util.Vector;
    import pack.*;
    public class ser1 extends HttpServlet
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try
              employbean ebean = new employbean();
              Vector v = ebean.getResult();
              Enumeration en = v.elements();
              while(en.hasMoreElements())
                out.println("employee id= "+ en.nextElement());
              out.println("employid"+employid);
             catch(Exception m)
               out.println(m);
             out.close();
            // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
        /** Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
        /** Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
        /** Returns a short description of the servlet.
        public String getServletInfo()
            return "Short description";
    }Please help me with my code as where i might have gone wrong and help me rectifying the errors.
    I also would like to know if this is MVC pattern.
    Thanks in Advance

    Try this one
    package pack;
    import java.util.*;
    import java.sql.Driver.*;
    import java.sql.Connection.*;
    import java.sql.*;
    import java.sql.DriverManager.*;
    import java.sql.SQLException.*;
    import java.io.*;
    import java.io.Serializable;
    import java.util.Vector;
    import pack.ser1;
    /* Control is got from the servlet file */
    public class employbean implements Serializable
    public Vector result;
    public Vector getResult() throws Exception
    /* Connection is established to retrieve data from the database */
    Vector v = new Vector();
    ResultSet rs = null;
    PreparedStatement st = null;
    try
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/sample?user=user&password=password");
    st = connection.prepareStatement("Select * from samp");
    rs = st.executeQuery();
    while(rs.next())
    v.addElement(rs.getString("empid"));
    st.close();
    connection.close();
    catch(SQLException esql)
         throw e;
    this.result = v;
    /* Control is sent back to the servlet */
    return result;
    Here is the servlet code.
    package pack;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import pack.employbean;
    import java.util.Enumeration;
    import java.util.Vector;
    import pack.*;
    public class ser1 extends HttpServlet
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try
    employbean ebean = new employbean();
    Vector v = ebean.getResult();
    Enumeration en = v.elements();
    while(en.hasMoreElements())
    out.println("employee id= "+ en.nextElement());
    // out.println("employid"+employid);
    catch(Exception m)
    out.println(m);
    out.close();
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /** Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    try
    processRequest(request,response);
    catch(Exception e)
    /** Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    try
    processRequest(request,response);
    catch(Exception e)
    /** Returns a short description of the servlet.
    public String getServletInfo()
    return "Short description";
    Send me the output

  • Passing value from Servlet to JSP back to Servlet

    Hi all,
    I have a jsp page where a user submits a search string into a text box. The jsp forwards to a servlet which calls some java classes and checks a database. The classes generate a string which contains some html. The servlet then forwards back to the jsp which displays the the string:
    <c:out escapeXml="false" value="${requestScope.ampList}" />The user then performs another action on this outputted html which is a listbox and when the user clicks on the listbox the onchange method submits the form. The JSP forwards the listbox value and I would like it to forward the "ampList" as well but I cant figure out how to do this.
    Using a hidden input does not work because the string contains HTML. Does anyone have any ideas. I can just keep the search string stored a hidden input box but I would prefer not to regenerate the "ampList" as it means accessing the database again which will cause performance issues.
    Thanks for any input in advance,
    Tom

    Ha,
    Writing that message gave me an idea which worked:
    <input type="hidden" name="ampList" value="<c:out escapeXml="true" value="${requestScope.ampList}" />" />

Maybe you are looking for

  • Pda cursor position property does not work

    Hi! I have a problem with cursor positionX propery on PDA. I use PDA Module 8.2 and Windows Mobile 5 OS on PocketPC. Actually problem is only when I try to get value of two cursors, it return the same value for both cursors (you can test it with atta

  • How to check if my fan is working ?

    After 30 minutes listening a dvd, my satellite A100-768 is getting slow and the CPU temperature (Speed fan) is around 86 degres... the fan does not start. If I blow into the extract system, DVD start again. How can I check my fan ??

  • Cant update to 1.1.2

    Hi, I'm having trouble getting my ipod to update. Every time that I select check for updates in iTunes, it says that I have the current ipod software 1.1.1. What am I doing wrong?

  • Ipod cd

    trying to install my ipod cd on my pc.comes up error #0x80040707 and it says access denied,please help

  • Premiere Pro CC very slow on brand new iMac

    Hi We have bought a new iMac, set up the Creative Cloud and downloaded Premiere Pro. We've started a few new projects on this machine and whenever we play them back, the video always freezes on a frame whilst the audio carries on playing. When pausin