Multiple servlet actions from jsp forms

Hi all ,
how can i do muliple actions from a jsp form, i need to do an action when user clicks on a column and a different action when user clicks on cell in a row .
i need to read and store the attribute from the column to pass back to the webservice to request that the service sorts the reults by that column either as desecending or as asending.
also i need to get the value from a cell that is clicked on and pass that through as a parameter to the webservice to request some further data for the specific id.
how can i do this?
currently i have a form which has as part of the row an onclick event that captures the value of cell clicked - but what i need to do is change the cell value to a href and if this is clicked capture the value of the href and submitt this to the form action and regonise that the href has been clicked (how do i do that?) and thus do soemething specific for that in the servlet and if the column with its ascending or descending image is clicked capture the asc or desc value and regonise that the column asc or desc has been clicked (how do i do that?) and thus do soemething specific for that in the servlet.
<tr onclick="selectPatCareRec(this)">
<td><netui:label value="{container.item.perId}"/></td> rest of form is :-
you dont need to pay attention to rest of stuff except that which columnHeader field was clicked and in which order (ie ascending or desc)
also if a cell is clicked to pass the values as part of a submit to the action and regonise that a herf click was done and value of that cell - i have the javascript that is used to find the cell value once the row is clicked.
<netui:form action="refresh">
      <rpb:repeaterBlock name="contacts" filter="<%=filter%>"
      ascendingImage='<%=request.getContextPath()+"/resources/images/up-arrow.gif"%>'
      descendingImage='<%=request.getContextPath()+"/resources/images/down-arrow.gif"%>'>
      <netui-data:repeater dataSource="{pageFlow.carerGpListResults}">
     <netui-data:repeaterHeader>
       <table class="tablebody" border="0">
         <tr>
           <th><rpb:columnHeader field="SYSTEMREF"></rpb:columnHeader></th>
           <th><rpb:columnHeader field="TITLE"><i18n:getMessage messageName="title"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="GIVENNAME"><i18n:getMessage messageName="given_name"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="FAMILYNAME"><i18n:getMessage messageName="family_name"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="ADDRESS"><i18n:getMessage messageName="address"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="POSTCODE"><i18n:getMessage messageName="post_code"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="DOB"><i18n:getMessage messageName="dob"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="ORGANISATION"><i18n:getMessage messageName="organisation"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="TYPE"><i18n:getMessage messageName="type"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="QUESTION"><i18n:getMessage messageName="question"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="ANSWER"><i18n:getMessage messageName="answer"/></rpb:columnHeader></th>
          <th><rpb:columnHeader field="PER_ID"><i18n:getMessage messageName="patientid"/></rpb:columnHeader></th>
         </tr>
       </netui-data:repeaterHeader>
       <netui-data:repeaterItem>
         <tr onclick="selectPatCareRec(this)">
           <!-- do an on click event to trigger another action to get all the patient list (ie. link it to the patientCasesList jsp) of cases and keep refresh to get sorting -->
          <td><netui:hidden dataInput="{container.item.SYSTEMREF}"dataSource="{actionForm.systemref}"/></td>
          <td><netui:label value="{container.item.TITLE}"/></td>
          <td><netui:label value="{container.item.GIVENNAME}"/></td>
          <td><netui:label value="{container.item.FAMILYNAME}"/></td> 
          <td><netui:label value="{container.item.ADDRESS}"/></td>
         <td><netui:label value="{container.item.POSTCODE}"/></td>
        <td><netui:label value="{container.item.DOB}"/></td>
        <td><netui:label value="{container.item.ORGANISATION}"/></td>
        <td><netui:label value="{container.item.TYPE}"/></td>
        <td><netui:label value="{container.item.QUESTION}"/></td>
       <td><netui:label value="{container.item.ANSWER}"/></td> 
          <td><netui:label value="{container.item.perId}"/></td> 
        </tr>
       </netui-data:repeaterItem>
       <netui-data:repeaterFooter></table></netui-data:repeaterFooter>
     </netui-data:repeater>
     <br />
     <rpb:firstPage label="First"/>
     <rpb:previousPage label="Previous"/>
     <rpb:nextPage label="Next"/>
     <rpb:pageNumber/>
      </rpb:repeaterBlock>
        <div>
        <netui:hidden tagId="selectedPatientId" dataSource="{actionForm.selectedPatientId}" dataInput="{actionForm.selectedPatientId}" />
        </div>
    </netui:form>thanks for any / all help.

You can modify your connection pool management servlet so you can set the 'connection pool object' as an attribute of the request. Then forward the request to your jsp page.
Example:
in your service method of your sevlet, add something like
public void service (HttpServletRequest request, HttpServletResponse response) {
ConnectionPool pool= new ConnectionPool();
request.setAttribute("mypool", pool);
// forward the request to a jsp page.
RequestDispatcher dispatcher = request.getRequestDispatcher("jsp/myjsp.jsp");
dispatcher.forward(request, response);
}then in your myjsp.jsp, you can access the connection pool object using the 'mypool' attribute.

Similar Messages

  • How to call multiple strus actions froma single jsp

    how to call multiple strus actions froma single jsp, and that actions should be automatically called pls help me
    Thanks in advance

    how to call multiple strus actions froma single jsp, and that actions should be automatically called pls help me
    Thanks in advance

  • Inserting data from jsp form to multiple tables !

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

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

  • Passing multiple character values from parameter form to PL/SQL

    Hi,
    I am passing multiple character values from parametr form into
    the report query and a PL/SQL procedure. It works fine with the
    query, when I use &variable. But, it doesn't compile in PL/SQL,
    so I just used the :variable, but not getting any records in the
    PL/SQL procedure. Any suggestions?
    sincerely,
    gj

    gj / Fedro,
    Only using the &referecne, you can pas a string / multiple character values and this would work for query only.
    The bind parameter in PL/SQL wouls support only single value
    Thanks
    The Oracle Reports Team

  • Servlet call from jsp pages on Hosting server instead of Local system

    HI,
    We have started hoste our projects on one of the Dedicated service from US.
    We have used servlets in our projects and uploaded servlet based project on Dedicated server ,so now we are getting one ERROR ,when we try to access servlet pages from browser .
    sample Below ERROR we are getting on browser ,when we try to access the servlet...
    The requested URL /Globalcontactservlet was not found on this server
    In Web.xml i have written mappings for servlets and i have included web.xml file under the Web-inf folder as same process we do on local system server.(Tomcat 5.5)
    on browser i am trying to use the below format to request the servlet mapping
    <form method="POST" action="http://www.xyz.com/Globalcontactservlet" >
    </form>

    You can download Oracle's latest JDBC drivers from: http://otn.oracle.com/software/content.html
    You need to register, but it should be free.
    When you get the zip/jar-file, you have several options. You can either place it in the common classpath of your system/Servlet container (recommended if you use it in most of your webapps), or in the WEB-INF/lib directory of your webapp (if you only use it with that particular one).
    .P.

  • How to find out last_query from jsp form in oracle applications

    Hi
    At present i am working on Quality Module.
    in India Localization.
    In Quality module -> Results -> Inquiries -> Skip Lot Inquiry
    If i enter our organization name
    Then its openning one form.
    I am unable to find out the table names from the jsp form.
    User also unable to comment on it.
    So, please help me on this issue.
    Regards,
    Pradeep.

    Hi
    Once you open the jsp form, at below leftside corner you can see link : About This Page. If you click on the link : About this Page this again open another window, there you can see multiple tabs at header level, if you click on page tab, there you can all the VO objects used to build this page. If you click on VO object hyperlink you can see the query.

  • Working with multiple buttons on a jsp form....!

    Hi guys...!
    I have a jsp form, which has 3 buttons (submit, update, cancel), and I also have a java Servlet that processes that form.
    In my java Servlet, i have a method called submitData(). I also want to have a method called updateData(), which will be called when the user clicks on the update button.
    These are the codes in my jsp form:
    <SCRIPT language="JavaScript" type="text/javascript">
                   function submitFunction (i) {
                        if (i==1) {
                             document.theForm.action="/MyWebApp/FormServlet";
                        if (i==2) {
                             document.theForm.action="/MyBugWebApp/FormServlet";
                        if (i==3) {
                             document.theForm.action="/MyWebApp/DisplayForm.jsp";
                        document.theForm.submit()
              </SCRIPT>
    <form name="theForm">
    <input type="button" value="Submit" onClick="submitFunction(1)"></input>
    <input type="reset" value="Reset"></input>
    <input type="button" value="Cancel" onClick="submitFunction(3)"></input>
    <input type="button" value="Update" onClick="sumbitFunction(2)"></input>
    </form>
    As u can see, both the submit and the update button use the same java servlet file. But inside that java servlet file, I want to have methods that will be called inside my doPost() method when the user clicks on update or submit.
    I've tried to pass a value through the httpRequest but it doesn't work... This is what I did.
    In my javaScript, I added this value in the action attribute:
    document.theForm.action="/MyWebApp/FormServlet?id=submit";
    document.theForm.action="/MyWebApp/FormServlet?id=update";
    I did that because I wanted to be able to retrieve the value of the "id" in my servlet and check which type of action was sent and then call the appropriate function in my servlet.
    But, it doesn't work. It returns "null" as the value for "id"
    Does anyone know how to do this task??...or what am I doing wrong in my code???
    Thanks...

    So there are really two solutions to this:
    1) Use <input type="submit" instead of buttons. Give all three buttons the same name but different values. Then the button used to submit will be added to the list of parameters.
    2) Add a hidden input to the form, and when the form determines which button was pushed, set a different value for the hidden input field. For example of both, take a look at this code:
    <html>
      <head>
        <script type="text/javascript">
          function formSubmit(i)
            var toSubmit = document.getElementById("myForm")
            if (i == 1) toSubmit.doThis.value="one"
            if (i == 2) toSubmit.doThis.value="two"
            if (i == 3) toSubmit.doThis.value="three"
            toSubmit.submit()
        </script>
      </head>
      <body>
        <form id="myForm" action="" method="get">
          <input type="hidden" name="doThis" /><br />
          <input type="submit" name="whatToDo" onclick="formSubmit(1)" value="Submit" />
          <input type="submit" name="whatToDo" onclick="formSubmit(2)" value="Cancel" />
          <input type="submit" name="whatToDo" onclick="formSubmit(3)" value="Update" />
        </form>
      </body>
    </html>For method one, if the servlet did:
    String whatToDo = request.getParameter("whatToDo");
    if ("Submit".equals(whatToDo)) {
      //doSubmit();
    } else if ("Update".equals(whatToDo)) {
      //doUpdate();
    } else if ("Cancel".equals(whatToDo)) {
      //doCancel();
    } else if ("Reset".equals(whatToDo)) {
      /doReset();
    } else {
      //error situation
    }Or you could instead look at the hidden value:
    String doThis = request.getParameter("doThis");
    if ("1".equals(doThis)) { ... }I personally like the submit button with the same names and different values, since the second method breaks if the user has javascript disabled.

  • How to generate a file from JSP form

    Hi,
    I want to generate a file from the informations of a form(JSP).
    Which classes do I have to use ?
    Thanks.

    Of course you have to use the standard servlet classes to retrieve the request parameters from the form.
    ie request.getParameter();
    package "java.io" gives you File input/output ability.
    If you are generating a text file, thats probably the BufferedWriter and FileWriter classes.
    Cheers,
    evnafets

  • How to use multiple submit buttons in jsp form

    hello dextors,
    Im using a jsp page which have got some 'n' no submit buttons according to the Iterator ..each iterator display a row contains few fields plus submit button ..ex., If ' n' rows means 'n' respective submit buttons..the problem here is when i click any of the submit button only the value of the first row goes
    to the other jsp page..no matter wat ever button I click only first row goes..
    remember the page displays all the rows correctly and though the values of submit button are also different it gives the same result...
    what could be the reason please help it out...
    my jsp page contains
    <%@ page language="java" import="java.util.*" %>
    <%@ page language="java" import="java.io.*" %>
    <form name="frmChangeCorrection" method="post" target="childwindow" action="popup.jsp" >
    <body>
    <%
    RFTrackerDAOFactory factory = new RFTrackerDAOFactory();
         DailyDataDAO dailyDAO = factory.getDailyDataDAO();
         String month = request.getParameter("month");
         String year = request.getParameter("year");
         String empNo = request.getParameter("empno");          
         Collection coll = dailyDAO.getMonthyEmployeeData(empNo,month,year);
    Iterator iter = coll.iterator();     
    %>
    <div align="center">
    <center>
    <table border="1" width="75%" bgcolor="#B6C7E5">
    <tr>
    <th width="11%">EMPNO</th>
    <th width="30%">EMPLOYEE NAME</th>
    <th width="11%">DATE</th>
    <th width="11%">IN TIME</th>
    <th width="11%" >OUT TIME </th>
    <th width="15%" >TOTAL HRS</th>
    <th width="11%" >MODIFY</th>
    </tr>
    </table>
    </center>
    </div>
    <%
    int count=0;
    while(iter.hasNext())
         EmployeeData data = (EmployeeData)iter.next();
         String str=data.getDuration();
         String str1= str.substring( 0, 5 );
    count++;
    %>
    <div align="center">
    <center>
    <table border="1" width="75%" bgcolor="#B6C7E5">
    <tr>
    <td width="11%"> <%= data.getEmpNo() %> </td>
    <input type="hidden" name="empno" value="<%=data.getEmpNo() %>">
    <td width="30%"> <%= data.getEmpName() %> </td>
    <input type="hidden" name="empname" value="<%= data.getEmpName() %>">
    <td width="11%"><%= data.getDate() %> </td>
    <input type="hidden" name="date" value="<%= data.getDate() %>">
    <td width="11%"><%= data.getInTime() %> </td>
    <td width="11%" > <%= data.getOutTime() %> </td>
    <td width="15%" > <%= str1 %> </td>
    <td width="11%" > <input type="submit" name="Change" value="<% =count%>" onclick="popupResult()" >
    <input type="hidden" name="Change" value="<%=count%>" >
    </td>
    </tr>
    </table>
    </center>
    </div>
    <%
    %>
    </form>          
    </p>
    </table>
    </body>
    <script>
    function popupResult(){
    window.open('about:blank','childwindow', 'height=300,width=300');
    </script>

    It is assumed that one submit button will function for a form..if you want more that one submit form try to build as many forms as u need and put the submit inside that
    that will cure your problem
    and y do you want to create so many submit buttons.. instead you can make use of select button

  • Is there a way to combine data from multiple responses (collected from different forms)?

    Since FormCentral (FC) doesn't support XFA-based dynamic forms (utilizing form logic), we have a long form that we may need to separate out into smaller PDF forms.  However, the data from each form needs to remain as a group. Wondering if there's a way to combine data form individual forms using FC, or maybe simple solution after-the-fact. I presume there would have to be some sort of unique identifier on each form as a reference.
    NOTE: These are PDF forms imported into FC, not web forms created in FC.

    Hi;
    There are not any methods that FormsCentral provides.  You would not be able to combine it within FormsCentral, you can experiment with exporting the data from FormsCentral to Excel and then combining in Excel.
    Thanks,
    Josh

  • Action from bean called out from jsp form

    Hello, I''ve got problem: i have a form inside a jsp site. It is some searching form: i have inputtext and a "search" button.
    I have action connected with this button <h:commandButton id="search" value="Search" action="#{MyBean.searchj}"/>. It works fine when user press that button, the method from bean is been called out, but usually when user is using so kind of form, he press "enter" key instead of pressing "search" button.
    How can I bind (or call) bean method (in this example it is MyBean.search method) when after user writes something in inputtext and press "enter" key?
    Thanks in advance.

    It is a known problem in the current jsf-ri implementation. There is a component of the third party library that sovles this problem.
    See: http://www.jsftutorials.net/defaultActionTag.html
    You can use this library (it is free) or take the javascript code and insert it into your page.

  • How to pass a object of JSP to a servlet called from JSP

    Hi,
    I am trying to display an image in the JSP through html image tag. I am using Struts Action class to get the image data from the database through a Session EJB. I am getting a byte array for the image retrieved from the database.
    To display the image I need to call a servlet from the JSP from the image tag like this.
    <html:img src="imageservlet" border="0"/>
    But I need to send the image byte [] array data which is available with the JSP to the servlet to build image. I have a bean object with the JSP which holds the image byte []. The servlet should receive the bean object and will use the byte [] and build the image to be displayed.
    My query here is how to send this bean object to the servlet which is getting called from the JSP as shown above.
    Thanks in advance.

    Hi,
    Thanks for your response. I knew it is possible with session objects. But I want to perform this operation with out using session objects. Is there a way to accomplish this with out using Session objects.
    Please help.
    Thanks

  • Can't create a multiple file PDF from PDF forms created in Designer

    Hi
    I want to create a single PDF which combines 6 pdf forms created in Adobe Designer (all as separate pages).
    When I try to create a single PDF from these multiple files using the "Create a PDF from Multiple files" command, my A-3D won't let me do this returning a dialog box saying
    "The file "filename.pdf" is protected. It cannot be used for this command".
    I can't find any properties that control this, either in the original file or in A-3D. Can I overcome this and how?
    Many thanks in anticipation.
    Phil

    Designer-created files aren't really PDF files any more and cannot be
    edited or combined in Acrobat (including Acrobat 3D). You CAN make a
    package of them, however, in Combine Files.
    Aandi Inston

  • Link to attachemnts from JSP forms

    Hi,
    i want to add a link for each attachment an instance may have in a JSP task form. Any suggestions how to go for it?

    See for example Content taglib from Coldtags suite:
    http://www.servletsuite.com/jsp.htm

  • Consistent calling of actions from JSP and code

    I have a question about opening up a JSP with a particular parameter (to set what we're looking at, for example).
    If I want to do it from a JSP, I can do something like this
    <af:commandLink text="Edit Scientist" action="editScientist">
    <f:param name="id" value="#{bbUserInfo.scientistId}"/>
    </af:commandLink>
    That follows the listed action, and sets #{param.id} to be the necessary value.
    If I want my action to be dynamic (using code from a bean), I can do this:
    JSFUtils.setRequestAttribute("id", scientistId);
    return "editScientist";
    (where JSFUtils is a class from various official tutorials).
    However, that sets #{requestScope.id} instead of #{param.id}. Is there a way of making these two calls consistent (for example, set the param.id from within the bean)?
    Regards,
    David C

    I have worked out one way to do this. I use this in the parameters section:
    <parameter id="sciId" value="${param.id == null ? requestScope.id : param.id}"/>
    And then I can reference bindings.sciId. Seems to work.
    David C

Maybe you are looking for

  • I'm looking for a good game on my new MacBook.

    I have never really played PC games (long time console gamer), but now that I've gotten a 13 inch MacBook (1 GB RAM) I'd like to try something out. All I'm looking for is something open ended (like Morrowind) or something with choices (like SW:KOTOR)

  • File need to be read in different formats( Tab formatted, commas separated)

    Hi All, I am reading an input text file which can be in any of the format like tab formatted, commas separated or fixed format. How can i write a code to make it work for all these file format other than writing separately for the above three cases.

  • Conect 2010 MINI to older 30: cinema display'

    When using the MINI Display Port to HDMI & DVI adaptor, the MINI does not recognise the resolution of the 30" display.  Says it's about half of the true resolution. 1280 x 960 vs 2560 X 1600 How can I fix this?

  • How to Email ALV ?

    Hi All, I have one standard report. I need to copy that to Zreport and Add additional functionality of sending email with ALV output as atachment. I know there are lot of Threads of same kind of querry but couldn't solve my purpose. My requirement is

  • Ps command , DB credentials visible on command line.

    Guys, In one of my shell scripts, I connect to the database as below: sqlplus -s /nolog <<EOF >> ${LOG_FILE} CONN ${DB_CONNECT} I would assume that my database connect credentials will not be visible in the command line , when someone executes comman