Help!!!!!using multiple submit form in java servlet

I am trying to build a application where i have 2 submit buttons. This is what i want to do. This code is in html
<html>
<head>
<script language="JavaScript">
function altSubmit() {
document.MyForm.action = "Second.html";
</script>
</head>
<body>
<form name="MyForm" method="post" action="First.html">
<input type="submit" value="Default Submit">
<input type="submit" value="Alternative Submit" onclick="altSubmit()">
</form>
</body>
</html>
I want to do the same in java servlet, but if i click on any of the buttons it goes to first.html, Can anyone help me. I think i am doing wrong with the javascript code. Can anyone show me how to do this. Please

out.println("<html>");
out.println("<head>");
out.println("<script language=\"JavaScript\">");
out.println("function altSubmit() {");
out.println("document.MyForm.action = \"Second.html\";");
out.println("document.MyForm.submit();");
out.println("}");
out.println("</script>");
out.println("</head>");
out.println("<body>");
My personal suggestion is to use follow the MVC (Model View Control) pattern where in you can write all your "html" part in a JSP.
Model -> Bean
View -> JSP
Control -> Servlet

Similar Messages

  • When I try to use the Submit Form button on the Interactive PDF I created (IN Design CS6) I get this message. "There is no value in form field 'Program.' Please put in it before proceeding. What can I do to fix this and make the Submit button work?

    When I try to use the Submit Form button on the Interactive PDF I created (In Design CS6), I get this message:
    There is no value in form field "Program." Please put in it before proceeding.
    How can I fix this and make the Submit Form button work?

    Are you running modified software on your phone?  This error seems to be common if the firmware has been modified and you're trying to restore the phone again. 

  • 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

  • Help: No Parameters, HTML Output from Java Servlet

    I have a Java Servlet that reads parameters passed from an HTML form and displays them to another HTML page. I know the servlet is being invoked; however, I am not seeing any HTML output. Sending the output to a file reveals the parameters are coming in as NULL as well.
    I attempted a simple sample app with the same results. Here is what I am running:
    The HTML Form:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>Collecting Three Parameters</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FDF5E6">
    <H1 ALIGN="CENTER">Collecting Three Parameters</H1>
    <FORM ACTION="ThreeParams">
    First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR>
    Second Parameter: <INPUT TYPE="TEXT" NAME="param2"><BR>
    Third Parameter: <INPUT TYPE="TEXT" NAME="param3"><BR>
    <CENTER><INPUT TYPE="SUBMIT"></CENTER>
    </FORM>
    </BODY>
    </HTML>
    The Java Code:
    public class ThreeParams extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Reading Three Request Parameters";
    out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
         "Transitional//EN\">\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +
    "<UL>\n" +
    " <LI><B>param1</B>: "
    + request.getParameter("param1") + "\n" +
    " <LI><B>param2</B>: "
    + request.getParameter("param2") + "\n" +
    " <LI><B>param3</B>: "
    + request.getParameter("param3") + "\n" +
    "</UL>\n" +
    "</BODY></HTML>");
    What happens when I "submit" from the form is the same form reloads with the query string in the URL: "http://localhost:8080/ThreeParams/?param1=1&param2=2&param3=3"
    Any assistance with either (or both) would be thoroughly appreciated:
    a) why the parameters are not being passed correctly to the servlet
    b) why the HTML output page is not displayed
    Thanks in advance!
    - Steve

    I have found the answer to my problem listed in another thread.
    Thank you.

  • Using forward(request, response) in Java Servlet

    Hi
    I need help on how to use the forward() method in a java servlet passing a List object and riderecting to another jsp.
    when I use the following code;
    request.getRequestDispatcher(path).forward(request, response);
    I'm getting this message:
    Content modified /content...
    Status
    200
    Message
    OK
    Location
    /content...
    Parent Location
    /content
    Path
    /content...
    Referer
    Thanks,

    Looking at your traces seems like you are forwarding during POST. Seems like issue with your component implementation missing with POST & proxy scripts. Please eloborate more on the exact steps you are following. Alternatively See if this helps.
    org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper req =
    new org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper(slingRequest) {
    public String getMethod() {
    return "GET";
    String path = "/content/.../test.html";
    javax.servlet.RequestDispatcher dispatcher = slingRequest.getRequestDispatcher(path);
    dispatcher.include(req, slingResponse);

  • Help using multiple iphones and ipods on itunes

    Okay, is there any simple way to use multiple apple products thru itunes. I can log in on my account and sync my iphone/ipod, then I log out and log back in with my daughter's account info. I plug her itouch in and it wants to read all of my apps(some apps we both have on our devices). Have problems with music sharing as well. Still a PC user. Get very frustrated with itunes. spend way too much time trying to do things that should be simple. please help! Thank you!

    Are you using method 1 with different windows user accounts?
    http://support.apple.com/kb/HT1495
    Sounds like you are currently using method 2 and not happy with it.

  • I need help using multiple content types in a wiki page library

    I currently trying to used multiple custom content types based off of the wiki page content type in one wiki page library. 
    EDIT: "Allow management of content types" has been enabled with the designer
    The way i would like this library to work is:
    Click the "Files" tab in the ribbon
    Click the "New Document" drop down menu
    Select one of the content types (Client, Contact, Project)
    SharePoint Will Ask for the Page Name and content type fields
    Click create
    Then it will take you to the new created page.
    This issue I'm currently having is when i click on one of the options (Client, Contact, Project) it will ask for a page name then you have to check it in to get to the edit form. The edit form it then loads is the default content type and not the selected
    content type.
    So my questions are.
    Is there any way i can combine the page name and edit steps together into one step?
    How can I get the edit form to pull from the selected content type?
    Thanks in advanced
    James T.F

    Wiki library isn't really designed for customizations... it's a "special" library that overrides a lot of default behavior... similar evidence can be found if you're trying to add metadata columns to wiki pages... they're just not really designed to handle
    it very well.
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Help Sumitting multiple identical forms????

    I have a JSP page where i include my page navigation as another JSP on the top and bottom of the page... since the previous and next links are submits of form I get a javascript error... how can i include multiple identical forms to one jsp page////

    I believe the OP is talking about the "Merge Comments?" pop-up that i'm getting as well.
    I can't figure out how to stop it from prompting people to do this... it's causing quite a lot of confusion!!
    I attached a screen shot of it so we can get rid of any ambiguity =P
    Thanks,
    Alice

  • Help with Error on tomcat and java servlet

    i've just recently installed Dialect Payment client onto my server and is using Java to correspond with the server. I can run the diagnostic test run perfectly fine but when I have compiled the form and the app, I keep getting the error:
    javax.servlet.ServletException: Invoker service() exception
         org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:478)
         org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:170)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    root cause
    com.qsipayments.utility.AssertionError: InvalidConfigException can only be thrown on reload
         com.qsipayments.utility.Assert.shouldNotReachHere(Assert.java:246)
         PaymentClient.util.PCConfigurationService.getConfiguration(PCConfigurationService.java:72)
         com.qsipayments.utility.logging.Logging.initialise(Logging.java:198)
         PaymentClient.PaymentClientBase.initialiseLogging(PaymentClientBase.java:1179)
         PaymentClient.PaymentClientBase.<init>(PaymentClientBase.java:106)
         PaymentClient.PaymentClientImpl.<init>(PaymentClientImpl.java:26)
         Java_3DS_3P_AuthPay_DO.doPost(Java_3DS_3P_AuthPay_DO.java:116)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:420)
         org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:170)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    If anyone can help or advise me on this matter, it would be incredibly fantastic! I've tried asking the people who have provided me with the program but they dont seem to have anything useful that i can do to fix the error. I was told by my server admin that it was in the coding, but they claim that it has nothing to do with the coding.
    PLEASE HELP.I've been working on this for months and about to die from frustration!

    I haven't worked with this vendor product, but here are some ideas you might find useful:
    It appears is a configuration problem when using the vendor software (but they already told you that, didn't they!!!).
    I say the above because these lines in your printout are from vendor supplied objects (that you didn't create):
    com.qsipayments.utility.AssertionError: InvalidConfigException can only be thrown on reload
    com.qsipayments.utility.Assert.shouldNotReachHere(Assert.java:246)
    PaymentClient.util.PCConfigurationService.getConfiguration(PCConfigurationService.java:72)
    I suggest creating a brand new project with the simplist use of the above vendor project and get it to work.
    You can use the vendor's (on line) documentation to do this. Deploy it in production to ensure there are no deployment issues. Work closely with one of
    your fellow employees (more than one pair of eyes can pick up stuff that you miss). Next, look at what features of the vendor software the originial project uses and what features the sample project uses. Try to implement a subset of functionality of the orginial project into the sample project and get that to work. Implement the next feature, test, etc. Do small experiments at a time so you can easily isolate what doesnt work.
    If none of the above works for you, try contacting the manufacturer or thier support web site. If none of the above works, look into using a compeditors product.

  • [HELP] using multiple value parameter in c:import tag

    I need to pass a multi-value parameter to a included page. e.g.
    http://myhost/MyContext/dir1/page1.jsp?abc=value1&abc=value2/dir1/page1.jsp includes /dir2/page2.jsp, and would like to pass this multi-value parameter over, but change the name to xyz, some what like
    <c:import url="/dir2/page2.jsp?xyz=value1&xyz=value2"/>The problem is that the number of values is not fix number, so I have to write some logic to iterate thru its parameter values. But the <c:import> tag body allows only simple listed <c:param> tags, it doesn't allow other logic/condition/iteration.
    <!-- gives java.io.IOException: javax.servlet.jsp.JspException: The taglib validator rejected the page: "Illegal child tag in "c_rt:import" tag: "c:forEach" tag at runtime -->
    <c:import url="/dir2/page2.jsp">
    <c:forEach var="xyz" items="${paramValues.abc}">
    <c:param name="xyz" value="${xyz}"/>
    </c:forEach>
    </c:import>{code}
    I also tried <c:url> tag. The good news is that it supports jsp logic in body:
    {code}<c:url var="url" value="/dir2/page2.jsp">
    <c:forEach var="xyz" items="${paramValues.abc}">
    <c:param name="xyz" value="${xyz}"/>
    </c:forEach>
    </c:url>
    <c:out value="${url}"/>{code}but it prefixes the url with the current context:
    {code}/MyContext/dir2/page2.jsp?xyz=value1&xyz=value2{code}
    Now I run into a dead end. It seems the only way out is to use <% %> scriptlet to do my own url composite, which is pretty similar to <c:url> but avoid the context part.
    Any suggestion?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    out.println("<html>");
    out.println("<head>");
    out.println("<script language=\"JavaScript\">");
    out.println("function altSubmit() {");
    out.println("document.MyForm.action = \"Second.html\";");
    out.println("document.MyForm.submit();");
    out.println("}");
    out.println("</script>");
    out.println("</head>");
    out.println("<body>");
    My personal suggestion is to use follow the MVC (Model View Control) pattern where in you can write all your "html" part in a JSP.
    Model -> Bean
    View -> JSP
    Control -> Servlet

  • Need help building email submit form...

    Someone please help me or point me to the proper thread.  I am new to LiveCycle and I am realizing that the terminology is a bit complex.  So I am having a hard time explaining and finding what I need.  So here's a try...
    I am building a student directory, which will include parent information and student information.  I am trying to simplify the input process and not require the parents to have to complete multiple forms for multiple children (when all that is different on the form is three lines).
    So my question is can I build a form that will allow me to give the parent the option to add multiple children to the form...AND the output (responses in Tracker) show a different record for each child the parent added (possible with a button and adding an instance?) however ALL the other fields will be duplicated?
    I have built a form that has a button that links to the Subform which contains (ChildfirstName, Childlastname, teacher/grade).  Once this button is pressed it adds those fields to the form.  However, when I distributed the form and completed and submitted the data input into the subform was not included.  Here's my hierarchy to give you an idea:
    WelcomeBack
         Master Pages
              Page1
                   Untitled Content Area
         Directory
              FatherFirstName
              MotherFirstName
              Address
              City
              zip
              number
              email
              childfirst
              childlast
              teacherdropbox
              Child1SubForm
                   childfirst
                   childlast
                   teacherdropbox
              AddChild (BUTTON)
    Please someone respond!
    Anna Mae

    >
    http://www.feelgoodproject.net/SpaExpo2009/index.php
    We would need to see the server scripting on this page. We
    cannot get that
    by just visiting the page.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "haha72" <[email protected]> wrote in
    message
    news:fqj3d7$77c$[email protected]..
    > Hi all professionals,
    > I has a website with an area letting people to input
    email address to join
    > email list and I am doing it the same to my client's
    website. Every code
    > is the
    > same and I just copy and paste and checked carefully.
    HOWEVER, the
    > "log.txt"
    > file which is supposed to collect email address for me
    is with nothing
    > appeared(even I had input several emails for testing.
    Can you check for
    > me? ><"
    > THANK YOU VERY MUCH
    >
    >
    http://www.feelgoodproject.net/SpaExpo2009/index.htm
    >
    http://www.feelgoodproject.net/SpaExpo2009/index.php
    >

  • Help using multiple ComboBoxes

    I am working on a JSP to add a new Property in my application. On the insert page the user must select an existing County and Township in order to add their new entry. I use the following code to implement the County ComboBox...
    RowEditor.useComboBox("CountyCode", "select County_Code from County order by County_Code ASC", "COUNTY_CODE", "COUNTY_CODE");
    RowEditor.getFieldRenderer("CountyCode").setPromptText("County Code");
    The next step for the user is to select the appropriate Township. Each County has multiple Townships so for that piece of code I need to find a way to restrict my Query to only those Townships that apply for the selected County. Does anyone know how to build that particular Query? Here is what I am currently entering...
    RowEditor.useComboBox("TownshipId", "select Township_Id, County_Code from Township where County_Code = ? order by Township_Id ASC", "TOWNSHIP_ID", "TOWNSHIP_ID");
    RowEditor.getFieldRenderer("TownshipId").setPromptText("Township Id");
    null

    I4ve been trying to do this and couldn4t do it.
    Can you JDev guys send us some example of a scriplet that does this ?
    Thanks !

  • Help using multiple computers and one shared external drive

    I just "bought" the new LR / PS combo special.  I have 3 computers, 2 PC's in seperate cities and a laptop that I use on the road. I would like to use an external hard drive as the main drive.  This way I could take the drive with me.
    2 Questions....First I tried to learn the basics using the internal hard drive on PC#2.  I then set up a external drive with multiple folders but within one main folder. I then started importing to the external drive using PC#2 (which is at my vacation property). Everything went smooth until I tried to import from that external drive,  It does not open that catalog. I am saving them as digital negatives.
    Question #2 which I have not tried yet is PC#1 which is my main home computer does not have LR.  I have years of photos in hundreds of files sorted in bridge that have to be renamed and put on the hard drive.  It does not have the latest version of PS and I have lots of money invested in plug ins. How can I get lightroom on that computer and will it talk to what I believe is the prior version of photoshop. I don't even want to think about all the plug ins.
    It's pretty clear that I am lost.  I was going to continue using bridge and PS but there is no bridge on the new version, at least not on the $9.99 special.  From what I've seen, LR is the way to go.
    HELP

    Mantis wrote:
    I was going to continue using bridge and PS but there is no bridge on the new version, at least not on the $9.99 special.  From what I've seen, LR is the way to go.
    Bridge should be included in the $9.99 bundle http://www.adobe.com/products/creativecloud/faq.html#pslr-bundle

  • Using multiple DLL instances from Java

    Hi All
    I have an application which uses JSP/RMI/JNI in combination. I have JSPs on webserver and my application DLL developed in C++ on another machine (lets say appserver). So I run a RMI server on my appserver and RMI client on my webserver. Now RMI server tries to load a DLL for each client everytime it receives a request. However, it is obviously failing because there can't be multiple instances of a DLL in memory at the same time.
    My question is how to resolve this situation.
    I can use a executable program representing the DLL functionality. However, I am not sure if there can be more than one instances of .exes in memory at the same time.
    Any suggestions?
    Regards
    Nikhil

    Something is loading the dll.
    Instead of loading it each time only load it once.

  • I need help using multiple internal drives

    I have 3 internal drives and 24GB of Ram on an early 2009 G5. I've recently upgraded one drive to yosemite but my current applications are on the other drive;  running 10.7.5.
    I didn't want to reinstall all the apps on the yosemite drive so I was wondering
    if there is any issue with using one drive for applications and another for work/storage.
    Keeping all my apps on drive running 10.7.5 while everything else is on the Yosemite drive.
    Is it advisable to do? Do the apps run any slower this way?
    Thanks for any help.
    M

    You could add a fourth drive, clone your 10.7.5 system to it, and upgrade the clone to Yosemite. That way you still have your clean Yosemite drive and your working 10.7.5 system in case of trouble with the upgrade.
    In the event that an app needs to be re-authorized when moved to a different drive, do you have a record of the relevant serial numbers?

Maybe you are looking for