How to process a form servlet

I 've got a sample multiple choice form which I want to do this :write a servlet that processes the answers
and returns a web page with the results of the test?
Part code of the form.
<form action=".../servlet/service" method="get">
Question 5:To which address class does the IP address 126.11.4.3 belong?
<td>
<input type="radio" name="q17_choose1" id="q17" value="Class A">
<label for="Class A">Class A</label> <br>
<input type="radio" name="q17_choose1" id="q17" value="Class B">
<label for="Class B">Class B</label> <br>
<input type="radio" name="q17_choose1" id="q17" value="Class c">
<label for="Class c">Class c</label> <br>
</td>
</table>
</td>
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
The servlet process side...
part code.
public void doGet (HttpServletRequest request,
HttpServletResponse response
)throws IOException, ServletException {
// returns an enumeration of all the parameter names
Enumeration aEnumeration = request.getParameterNames();
String parameterName;
String value;
response.setContentType("text/html");
PrintWriter aPW = response.getWriter();
aPW.println( "<HTML><BODY>" );
while ( aEnumeration.hasMoreElements() ) {
parameterName = ( String )aEnumeration.nextElement();
value = request.getParameter( parameterName );
aPW.println( parameterName + " = " + value + "<BR>" );
aPW.println( "</BODY></HTML>" );
}

Create 1 jsp page for the form , lets call it index.jsp , here's the code for index.jsp:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head><title></title></head>
  <body>
  <form action="target.jsp" method="get">
  Question 5:To which address class does the IP address 126.11.4.3 belong?
  <table>
  <td>
  <input type="radio" name="q17_choose1" id="q17" value="Class A">
  <label for="Class A">Class A</label> <br>
  <input type="radio" name="q17_choose1" id="q17" value="Class B">
  <label for="Class B">Class B</label> <br>
  <input type="radio" name="q17_choose1" id="q17" value="Class c">
  <label for="Class c">Class c</label> <br>
  </td>
  </table>
  <input type="submit" value="Submit"> 
  </form>
  </body>
</html>Notice that the action of the form above is target.jsp , so now create another JSP page , call it target.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head><title></title></head>
  <body>
  <%=request.getParameter("q17_choose1")%>
  </body>
</html>Assuming that you have set-up your webserver correctly , when you open index.jsp for example http://localhost:8080/index.jsp , it will show you the form with radio buttons and a submit button.
When you click on submit, it opens target.jsp , which then shows the radio button you selected on index.jsp.

Similar Messages

  • How to process a form created in a pl/sql region

    Hi:
    I have a form that is generated using pl/sql and this form is displayed on a page in a 'pl/sql' region. The form displays a 'Submit' button which upon being clicked should return the user to the same page but with the contents of the form updated etc etc. What should I set the form's 'Action' attribute to for this to happen ? Is it possible for 'post-submit' processes to be specified for such a form ?
    Thanks !

    Vikas:
    The form is the product of converting a VB based application to pl/sql. The VB app. is a sort of a dynamic form generator. The form elements (what elements a form is made up of) are stored in a database. For the purpose of illustration we can assume that the application is a survey application and the VB code generates the required survey form depending on the user requesting the form, the survey being requested etc. The questions/answers and the HTML element that will be used to render the question/answer are stored in the database as mentioned previously.
    I adopted what I thought was the easiest method to convert this application into an APEX app. This method ofcourse being converting the VB to PL/SQL and then using the pl/sql Web Tool kit to generate a PL/SQL region on an APEX page.
    Now, based on your comments it appears to me that I may have started off on the wrong track !

  • How to create file form servlet in our virtual directory

    hi....
    I want to create a file form my servlet in my virtual directory..
    my directory name ia vps
    it cconatin vps -> WEB-INF -> classes-> servTest
    servTest is servlet....
    and i want to create file from servTest in vps directory..
    actually i am trying to create file but it by default saved in windows/system32 directory.

    You need to give the absolute path to create the file, if you just give the filename, the file will be created in the working directory which is system32 for Windows.
    You could either hardcode it, or you can use ServletContext.getRealPath("/") ( http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String) ) This will return the path on the server's filesystem where your application folder ( under webapps for Tomcat) is located.
    NOTE: If you application is in the form of a .war file, this may not work! The server may return a null.
    "/" specifies the root i.e., your application's highest level directory. If your application is webapps/vps then getRealPath("/") will return something like C:\Program Files\Apache Group\Tomcat 4.1\webapps\vps

  • How to debug a form (servlet) in the Forms and Reports Server

    Hi:
    I have a new install of an application that ran perfectly on a different host using the Forms and Reports Server.
    I have installed the FRS on the new host and it is working fine. I can run the test form.
    When I run my actual forms app, I only get a blank screen in the browser and on the status bar it reports "Applet Started'.
    Is there a way I can turn on debugging or something so I can see at what point it is failing or why the form is not opening properly?
    Any advise would be appreciated.
    Many thanks.
    Bruce

    Thanks for the reply Frank. I have looked all through the Start menu but see no "Configuration and Migration". I assume it's because I only installed the Forms and Reports option, so I only have Forms Services, Reports Services, and the Universal Installer. No big deal - I've already setup tnsnames manually. I just like to use the Net Assistant when I can.

  • Is it possible to secure Forms Servlet with a realm/jazn/jaas???

    Hi,
    Does anyone know how to secure the forms servlet (frmservlet 11g) with something like a realm or jazn/jaas ?
    What I would like to do is just permit access to the frmservlet with a simple login jsp page that would forbidden access to frmservlet for people that we're not authenticated... and with this i would not need the SSO...
    Regards
    Ricardo

    Hi,
    But the forms app is deployed as an ear file and there's an web.xml config for this app in the container... so... i guess that theorically it's possible isn't it?
    Take a look: http://java.dzone.com/articles/understanding-web-security
    Regards
    Ricardo
    Edited by: user12015527 on 15/Fev/2010 7:22

  • How to download adobe form in sap inbox and process it

    Hello experts,
    I have a query like how we can download the adobe forms in sap inbox and process process the forms using some program which will convert form data in to XML.
    thanks in advance.

    Hello Samad arif,
    May be you can reuse the code that placed in this document to covert the PDF form to XML format.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf80665d
    Thanks,
    Bharath.K

  • How can I let my servlet to process Chinese Character as an input?

    How can I let my servlet to process Chinese Character as an input to my simple database which is an Excel file. I have tried before and all my input values become question marks.
    Please give me some advise, thx!

    input chinese?����������
    that may result from the tomcat or other web server

  • How to create Generic Service in HCM Processes and Forms

    Hi Friend's,
      Can you tell me what are the steps to create Generic Service in HCM Processes and Forms and also tell me how to link Generic service with BADI.
       In SPRO, I defined one customized generic service, but i cant able to implement the generic service to BADI. Moreover it's asking for Composite Badi Implementation name.
       So tell me the steps which guide me to create that.. Waiting for your replies....

    hi ramesh,
                      use HRASR00GEN_SERVICE_BASIC  create ur own.
    Madhukar

  • How to create Digital Personnel Foile for HCM Processes and Forms

    Hi I am creating HCM Processes and Forms using FPM Forms. Now to print these forms Alternate Adobe forms also developed. But once the entire process is completed by HR Admin and in future if they want to see the already processed form and if they want to take print out they should be able to do it. So, based on some knowledge I am assuming we can achieve this by Digital Personnel file creation. Can any one please confirm. Whether they can open already processed form and how to get print these forms as this is FPM form and no print option is available.
    In order to configure DPF, can any one share step by step procedure to configure DPF. I dont have any idea on SAP Records Management as I felt this basic is required. Friends help me here.
    Regards,
    Nayani.

    This seems possible.
    Refer here ... Print Form (FPM Form Type Only) - HCM Processes and Forms - SAP Library
    For DPF - ensure you have used the anchor correctly refer Save PDF file added to processes and forms WDA
    Regarding the possibility of being able to print it from process browser - I am not sure.
    Process browser for latest release is documented here...
    http://help.sap.com/erp_hcm_ias_2013_02/helpdata/en/14/9a3516789f4aceb6bb910df1220869/content.htm?frameset=/en/43/1d639b3fce3566e10000000a11466f/frameset.htm
    Regards.

  • How to start sap hcm process and forms in ess

    Hi,
    Here is the requirement for us i.e., employee (Role SAP_ASR_EMPLOYEE) has to initiate the HCM Process and Forms in the ESS. But as per the standard the possibilities are initiated by the Mangers and HR Administrators... How to solve it...
    Regards,
    Santhosh Kumar R

    Hi,
    Process can be initiated by the employees in the ESS. However you need to link your HCM P & F in the ESS l.The standard initiator role for the employee is 'HRASRD'.
    Try attaching this role in the role assignment section of the process.
    Regards,
    Aravind.P

  • How to use buttons in hcm process and forms?

    Hi Experts,
    I want to know how to use buttons in HCM process and form.
    And when i click on the button it was validating all the fields and it was throwing an error ( complete SACHP fields) i am not using this filed in any where of my form.
    So, please help in getting out of this error. And help me with some document, which method will  trigger once we click on the button.
    Thanks & Regards,
    Rocky

    You do not need to add this field to your list. In the view V_T588MFPROPS (SAP delivered), this field is set as mandatory. In configuration, you must maintain the view V_T588MFPROPC (Customer area) and make sure the field is not set to mandatory. This will override the SAP delivered setting and the error message will be not be displayed.
    Derrick Banks
    Banks & Company, LLC

  • How to post a form to a servlet in CQ5.5?

    Hi all,
      I'm using CQ5 to develop some things. and now i am not so clearly how to post a 'FORM' and accept with a SERVLET.
      I've seen this 'http://forums.adobe.com/message/4932739#4932739' already, and try it. But once i add a new <input /> like :<input name="age" value="age" />.
    and i submit this form, then tell me error: javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {}age
      see the code
       jsp:
         <!-- String action = /content/myproject/en/thanks   -->
        <form id="submitForm" method="post" action="<%= action %>.POST.html" onsubmit="return validate();">
            <input type="hidden" name=":redirect" value="<%=resourceResolver.map(action)%>" />
            <input type="hidden" name=":formpath" value="<%=currentNode.getPath()%>" />
            <input type="hidden" name=":formtype" value="<%=component.getResourceType()%>" />
            <input type="hidden" name="_charset_" value="utf-8" />
            <input name="age" value="26" />  <!-- if i comment this line, it can submit success, otherwise show me Status: 500. -->
            <input type="submit" value="Submit"/>
        </form>
      servlet:
        @Component(immediate = true, metatype = false, label = "QuestionnaireServlet")
       @Service
       @Properties(value = {
                        @org.apache.felix.scr.annotations.Property(name = "sling.servlet.methods", value = { "POST" }),
                        @org.apache.felix.scr.annotations.Property(name = "sling.servlet.resourceTypes", value = { "sling/servlet/default" }),
                        @org.apache.felix.scr.annotations.Property(name = "sling.servlet.selectors", value = { "POST" }),
                        @org.apache.felix.scr.annotations.Property(name = "sling.servlet.extensions", value = { "html" })
       public class QuestionnaireServlet extends SlingAllMethodsServlet implements
                        OptingServlet {
        protected void doPost(SlingHttpServletRequest request,
                                  SlingHttpServletResponse response) throws ServletException,
                                  IOException {
              //it seems never call this function.
    can anybody told me in details ?

    1).open the system/console/bundles and i can see the information of my servlet. include 'Symbolic Name', Version, Bundle Location, Exported Packages and so on.  I think it already a service. right ?
    2). change the selector to QAPOST for sling.servlet.selectors
    3). add the slash "/" then submit and the browser show me "403 Forbidden"
    4). without slash "/" before <action_attr_value>.POST.html, show me 'Status: 500', Message: javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {}age

  • How to use DDL-Operations in before processing the form

    I want to drop and create a sequence when i make a form with
    WEBDB at the part "before processing the form" where i can add a
    PL/SQL code in a varius text area.
    Sybille Krvnert

    not sure in webdb how to do that, but I think you can put the
    code in the before proccessing form and after processing form
    block. In portal that should work, or you can place code in the
    button events for the save/insert/update buttons to do that like
    this:
    create sequence .....
    doInsert;
    drop sequence ....

  • How call Forms servlet after installation

    I have ORacle EE 8.1.7.1 and Forms 6i Patch 6 installed on the same computer. So after installation and some custom setting. I try with this link and I see the test page: http://server/servlet/oracle.forms.servlet.ListenerServlet?config=servlet
    All work fine. But my question is what is the url I need to enter to run my forms (in servlet).
    Tanks you.
    Francois

    I think what you are looking for is: http://your_server/servlet/f60servlet?config=blah
    Have you read the whitepaper on the Forms Listener Servlet? It may help with other questions you come across. http://technet.oracle.com/doc.pdf/forms/p5_listenerservlet.pdf
    Regards,
    Candace Stover
    Forms Product Management

  • How to display the form of time statement, which was created in trans. PE50

    Hi to all!
    I have created the salary statement with the PE50 and I want the form to be displayed in the ESS.
    How to display this form?
    Thank.

    Dear Siddharth,
    I am getting this error for Time Statement here also we have used PE50 to create time statement for r/3 purpose, Which would be feasible one to work with for getting the display of Time Statement.
    Form TH_TIME_ST does not exist
    com.sap.pcuigp.xssfpm.java.FPMRuntimeException: Form TH_TIME_ST does not exist
         at java.lang.Throwable.<init>(Throwable.java:194)
         at java.lang.Error.<init>(Error.java:49)
         at com.sap.pcuigp.xssfpm.java.FPMRuntimeException.<init>(FPMRuntimeException.java:34)
         at com.sap.pcuigp.xssfpm.java.MessageManager.raiseException(MessageManager.java:112)
         at com.sap.pcuigp.xssfpm.java.MessageManager.raiseException(MessageManager.java:122)
         at com.sap.xss.hr.rep.fcrfw.FcRepFramework.reportBapiRet2Error(FcRepFramework.java:525)
         at com.sap.xss.hr.rep.fcrfw.FcRepFramework.callRfcExecAction(FcRepFramework.java:357)
         at com.sap.xss.hr.rep.fcrfw.FcRepFramework.initModel(FcRepFramework.java:292)
         at com.sap.xss.hr.rep.fcrfw.wdp.InternalFcRepFramework.initModel(InternalFcRepFramework.java:256)
         at com.sap.xss.hr.rep.fcrfw.FcRepFrameworkInterface.initModel(FcRepFrameworkInterface.java:136)
         at com.sap.xss.hr.rep.fcrfw.wdp.InternalFcRepFrameworkInterface.initModel(InternalFcRepFrameworkInterface.java:198)
         at com.sap.xss.hr.rep.fcrfw.wdp.InternalFcRepFrameworkInterface$External.initModel(InternalFcRepFrameworkInterface.java:258)
         at com.sap.xss.hr.tim.per.selection.VcTimPerSelection.onInit(VcTimPerSelection.java:238)
         at com.sap.xss.hr.tim.per.selection.wdp.InternalVcTimPerSelection.onInit(InternalVcTimPerSelection.java:246)
         at com.sap.xss.hr.tim.per.selection.VcTimPerSelectionInterface.onInit(VcTimPerSelectionInterface.java:162)
         at com.sap.xss.hr.tim.per.selection.wdp.InternalVcTimPerSelectionInterface.onInit(InternalVcTimPerSelectionInterface.java:144)
         at com.sap.xss.hr.tim.per.selection.wdp.InternalVcTimPerSelectionInterface$External.onInit(InternalVcTimPerSelectionInterface.java:220)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.doProcessEvent(FPMComponent.java:467)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.doEventLoop(FPMComponent.java:438)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.wdDoInit(FPMComponent.java:196)
         at com.sap.pcuigp.xssfpm.wd.wdp.InternalFPMComponent.wdDoInit(InternalFPMComponent.java:110)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:108)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:359)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:362)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:755)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:278)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:722)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:623)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:215)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:113)
         at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:70)
         at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.sendDataAndProcessActionInternal(AbstractApplicationProxy.java:818)
         at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.create(AbstractApplicationProxy.java:220)
         at com.sap.portal.pb.PageBuilder.updateApplications(PageBuilder.java:1265)
         at com.sap.portal.pb.PageBuilder.createPage(PageBuilder.java:355)
         at com.sap.portal.pb.PageBuilder.init(PageBuilder.java:548)
         at com.sap.portal.pb.PageBuilder.wdDoRefresh(PageBuilder.java:592)
         at com.sap.portal.pb.PageBuilder$1.doPhase(PageBuilder.java:864)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processPhaseListener(WindowPhaseModel.java:750)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doPortalDispatch(WindowPhaseModel.java:715)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:113)
         at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:107)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:278)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:623)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:215)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:113)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:60)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:332)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:0)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:335)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:963)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:249)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:0)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:92)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:30)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:35)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:101)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    Appreciate your help on this.
    Regs,
    Raj

Maybe you are looking for

  • ActiveSync mail/contacts/calendars removed after Active Directory account is locked out?

    Hey guys, Wondering if anybody has seen an issue like this.  This is a new Exchange 2010 deployment (8+ CAS servers) and the devices are all iPhones/iPads running the latest version of iOS (7.1.2).  The CAS servers are behind a load-balancer. Basical

  • Use a SQL 2012 database server with Reporting Services 2008?

    Hello, we have a SQL Server 2008 R2 Reporting Services Standard server with the reporting databases running on a SQL Server 2008 Standard database server. I would like to upgrade the database server to SQL Server 2012 before I upgrade the reporting s

  • Using Bluetooth on a C8180 All-in-One to print from Mac OS-X

    Dear folks, I have a new iMac and would like to be able to print from it to my 8180 AiO using bluetooth.  My Mac sees the printer (it's paired), and the Mac has the latest print driver installed, and I've verified the bluetooth setup on the 8180,  bu

  • How to post GI for delivery?

    Hello I need to post GI for delivery ref to Sales order (that referencies production order). I tried MIGO_GI - Other (MIGO)  but it doesnt allow 601 MT I just need to generate testing data Thanks , I know you will help me this bloody hot day!

  • Which do I need?  Extreme or Express?

    I am replacing my DLink router and am uncertain whether to purchase an Airport Extreme or Airport Express. I will only have my iBook G4 connect wirelessly as there are no other computers in the house. It is not likely that I will make use of the iTun