How to send recomposed data in post method.

Currently, i try to build up MVC user authentication. I used login.html as View, servletA as controller to invoked Model and servletB as Model. The servletB will return queried result to servletA then servletA will decide redirected to specific url.
I has successful use the RequestDispatcher.forward(request, response) to post data from servletA to servletB. whereas i faced a trouble to post data back from servletB to servletA, which i unable put the queried result into request obj before post it back to servletA.
Any genius recommendation about this? or Any method composed data to send via post method?

Here's a quick rundown that might help:
Use request.setAttribute() to put an item in request scope in a servlet before dispatching to another servlet or JSP.
Use <useBean> tag in a JSP to read the data on the JSP that the servlet put in request scope.
Alternatively, you can use request.getAttribute(), but the useBean is preferred.
Use request.getParameter() in a servlet to read data that the <form> tag on the JSP page put in request scope.
Use request.setAttribute() and request.getAttribute() to get send/get data between servlets (it could be request.getParameter(), but I dont think so).
There is a RequestDispatcher.forward() and a RequestDispatcher.include(). I'm not sure what the differences are (you'll have to research it.
In MVC, I have a single servlet for the controller (receive all url's, and dispatch to the appropriate JSP). I dont hava a separate servlet for the model. Instead, I instansiate a business object on the servlet, pass data to it, and let it do the calcuations. Then I have it return the data to the servlet which puts it in request scope for the JSP page when I dispatch to it. My MVC usuallyconsists of:
JSP -presentation layer
servlet - control layer
business logic layer
database layer (DAO).
Each layer does not contain the functionality of one of the other layers (clean separation of concerns).
Last note: Whereas you can use a servlet for the controller, a framework such as Spring or Struts is often used instead.

Similar Messages

  • How to send Array data using Post Method?

    Var array = $_POST['myData'];
    array[0] => 'ABC'
    array[1] => 'DEF'
    how to improve this code to support send array data...?
    String url ="http://xxxxx/test.php";
    String[] arraystr={"ABC", "DEF", "EDFF"}
    String parameter = "myData=" +arraystr;    // no support this
    Strint str = postMrthod(url, parameter );
    public static String postMethod(String url, String parameter) {
            StringBuffer b = new StringBuffer("");
            HttpConnection hc = null;
            InputStream in = null;
            OutputStream out = null;
            try {
                hc = (HttpConnection) Connector.open(url);
                hc.setRequestMethod(HttpConnection.POST);
                hc.setRequestProperty("CONTENT-TYPE", "application/x-www-form-urlencoded");
                hc.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.0");
                out = hc.openOutputStream();
                byte postmsg[] = parameter.getBytes();
                for (int i = 0; i < postmsg.length; i++) {
                    out.write(postmsg);
    out.flush();
    in = hc.openInputStream();
    int ch;
    while ((ch = in.read()) != -1) {
    b.append((char) ch);
    } catch (IOException e) {
    e.printStackTrace();
    try {
    if (in != null) {
    in.close();
    if (hc != null) {
    hc.close();
    } catch (IOException e) {
    e.printStackTrace();
    return b.toString().trim();

    yes, you can send integer value like this. But I think you have to put quotes around <%= TAMID%> i.e.
    <input type="hidden" id="HTTP_CVHTAMID"
    name="HTTP_CVHTAMID" value= "<%= TAMID%>" >

  • IN ODATA, How to pass Timestamp data using POST method

    Dear all
    I am trying to insert a record into a HANA column store table using ODATA service.
    POST URL
    http://hanadrp.sial.com:8000/sial/sapnext/generic/odata/uidatetime.xsodata/UIDateTime
    Message one
      "IDTXT" : "1",
      "IDDATETIME" : "2014-09-19 10:20:10"
    Message Two
      "IDTXT" : "1",
      "IDDATETIME" : "/TO_TIMESTAMP(CURRENT_TIMESTAMP)/"
    Both give me this message
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error
        xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
        <code/>
        <message xml:lang="en-US">Syntax error at position 0.</message>
    </error>
    The table here has only two columns and the IDDATETIME is a column of time TIMESTAMP
    Please advice

    Thanks Shreyansh to take time to reply
    Here below is the preview of the message from the POSTMAN preview button
    I really am not sure what is the X-CSRF token?
    POST /sial/sapnext/generic/odata/uidatetime.xsodata/UIDateTime HTTP/1.1
    Host: hanadrp.sial.com:8000
    Authorization: Basic YXJhbWFjaGE6U3JpcmFtNjY=
    Content-Type: application/json;charset=utf-8
    Cache-Control: no-cache
    { "IDTXT" : "1", "IDDATETIME" : "2014-09-01T00:00:00" }

  • How to send the data from mac pc to External drive

    how to send the data from mac pc to External HDD
    or Pen Drive but with out deleting the preview as data

    You can use "Finder", which is in your dock, to copy files from your iMac folders over to the external hard drive.
    Hope this helps

  • How to send the data manually

    Hi Experts,
      I need small information.when messages are gone into queue state due to one message 
    When an EDI file came into wrong format and with that some messages are gone into queue state in MONI.
    if i cancel the first message then remaining all the messages are processing successfully.
    So from that cancel message i want sent the data manually as business needs that data.
    Can all please tell  me how to send the data manually with steps.
    Thanks in Advance.
    Bhaskar

    Hi,
    I think you are talking about QoS "EOIO", in which all messages are porcessed in FIFO order and whenever the preceeding message get stuck due to error in the queue, then all the messages are stoped. And yes as soon as you will cancel the message which went into error all the remaining messages will automatically will be delivered.
    In my opinion since QoS is EOIO then it will be not possible to sent the data mannually, you can do one thing, do not cancel the message. Try to correct the messge and then resend it.
    Regards,
    Sarvesh

  • How to get current date for posting date

    hi,
    how to get current date for posting date ? any sample code ?
    Thanks

    Hi......
    Use
    Select getdate()
    for current date.......
    Regards,
    Rahul

  • Hi friends, How to send any data (even binary) through XI, without using

    1) How to send any data (even binary) through XI, without using the Integration Repository .?

    hi ganga,
    Yes; 
    1. we can test adapters very easily and quickly without any IR development.
    2. we can send any formatted data without having to convert it to XML and back again, e.g. file->XI->file.
    3. we can send any document from 1 sender to multiple receivers using XI to guarantee delivery.
    /people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
    the process integration layer of the NetWeaver  define/reuse interface objects for the SAP Integration Repository. These objects include Business Scenarios, Business Processes, Message Interfaces, Message Types, Data Types, Message Mappings, and Interface Mappings. The application developer refers to these objects in defining the interactive flow between applications for the SAP Integration Directory.
    regards,
    nikhil

  • How I can pass parameters by POST method?

    How I can pass parameters by POST method?
    I use URL Template iView. I checked Requested Method - POST, but when I started the iView the program says:"It's a GET method!"
    I use httpServletRequest.getMethod()in the program.
    Environment: EP6 SP2
    Thank's! 

    Hi Kremena,
    the OSS stands for "Online Service System" - service.sap.com - messages or directly: service.sap.com/message.
    Hope it helps
    Detlev

  • How to send joystick data over TCP connection

    Hi all,
    I am a long time Labview discussion forum user for learning, but this is my first time posting a question, I hope somebody can help me!
    In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
    Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
    Again, the actual TCP communication I get, and can operate fine, just formatting all the data into a string (or whatever is required) so that I can unpack on the other side is the issue here.
    Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense...
    One final question.....I already have a solution to this but using labview for the entirety of this project would be nice. I use skype to stream 1080p video from a webcam to my computer so I can view live feed. Can labview do this? This would be awesome if so, I am just not sure if the communication protocols in use could support real time (or as close as possible to streaming) for 1080p video.
    Thanks all in advance for your help,
    Physicsnole
    Attachments:
    cameraserver.vi ‏24 KB
    cameraclient.vi ‏18 KB

    Physicsnole wrote:
    In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
    Well, you cast the axis info cluster to a string, but then you cast it back to an array of DBL. Thatr's not compatible. You should probably cast it back to an "axis info" cluster of exactly the same type. Go the the other VI and right-click the cluster wire to create a constant. Now move that diagram cluster constant to the other VI and use it as type.
    Your default ports don't seem to match. You seem to have client and server roles confused. In the sever you create a listener, but then you start sending packets, even though no connection is established. The connection needs to be initiated by the client.
    Your client stops the loop the first time a timeout is encountered. Shouldn't that be more permanent? Also, please retain code clarity and avoid unecessary complexities. For example, replace the "not or" with a plain "or" and change the loop to "stop if true"
    Physicsnole wrote:
    Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
    You can send as much as you want. The casting to/from string is the same as described above.
    Physicsnole wrote:
    Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense..
    The primary function of a "server" is to wait for a connection and then communicate with the client once a conenction is established. An established TCP/IP connection is fully two-way and both sides can send and receive.
    LabVIEW Champion . Do more with less code and in less time .

  • How to specify a date in a method signature

    How do I specify a date as a method parameter of a bean that will be used to generate
    a SOAP service? If I specify java.util.Date, I get NullPointerExceptions, perhaps
    because the internal structure of Date is not compatible with SOAP supported types.

    Hi,
    There are few simple ways for date validation as follow,
    1.If you would like to handle it in XI only, then in message mapping you could verify about it with the help of generating smart exception.
    For e.g in mapping there is one Date conversion API i.e. somthing DateTransformation It converts the incoming date format to required format. Here give the date format i.e expected from Sender File.
    If in case the format miss-matched then it will create the exception.
    You could handle this exception with the use of [Alert notification|http://help.sap.com/saphelp_nw04/helpdata/en/2c/abb2e7ff6311d194c000a0c93033f7/frameset.htm] and could be even able to notify to sender system about it.
    2. The another solution is easy for SAP synchornous communication --If you are passing the file data to SAP, then you could use below function modules to verify date format in receiver RFC/BAPI or inbound IDOC program. If the sy-subrc is not 0 then don't process further.
    CONVERT_DATE_FORMAT
    ISU_DATE_FORMAT_CHECK
    Thanks
    Swarup

  • How to send string data through socket!

    Is there any method to send string data over socket.
    and if client send string data to server,
    How to get that data in server?
    Comments please!

    Thank for your kind answer, stoopidboi.
    I solved the ploblem. ^^;
    I open the source code ^^; wow~~~~~!
    It will useful to many people. I spend almost 3 days to solve this problem.
    The program works like this.
    Client side // string data ------------------------> Server side // saving file
    To
    < Server Side >
    * Server.java
    * Auther : [email protected]
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Server extends JFrame
         private JTextField enter;
         private JTextArea display;
         ObjectInputStream input;
         DataOutputStream output;
         FileOutputStream resultFile;
         DataInputStream inputd;
         public Server(){
              super("Server");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent ev){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display),
                     BorderLayout.CENTER);
              setSize(300, 150);
              show();
         public void runServer(){
              ServerSocket server;
              Socket connection;
              int counter = 1;
              display.setText("");
              try{
                   server = new ServerSocket(8800, 100);
                   while(true){
                        display.append("Waiting for connection\n");
                        connection = server.accept();
                        display.append( counter + " connection is ok.\n");
                        display.append("Connection " + counter +
                             "received from: " + connection.getInetAddress().getHostName());
                        resultFile = new FileOutputStream("hi.txt");
                        output = new DataOutputStream(resultFile);
                        output.flush();
                        inputd = new DataInputStream(
                             connection.getInputStream()
                        display.append("\nGod I/O stream, I/O is opened\n");
                        enter.setEnabled(true);
                        try{
                             while(true){
                                  output.write(inputd.readByte());
                        catch(NullPointerException e){
                             display.append("Null pointer Exception");
                        catch(IOException e){
                             display.append("\nIOException Occured!");
                        if(resultFile != null){
                             resultFile.flush();
                             resultFile.close();
                        display.append("\nUser Terminate connection");
                        enter.setEnabled(false);
                        resultFile.close();
                        inputd.close();
                        output.close();
                        connection.close();
                        ++counter;
              catch(EOFException eof){
                   System.out.println("Client Terminate Connection");
              catch(IOException io){
                   io.printStackTrace();
              display.append("File is created!");
         public static void main(String[] args){
              Server app = new Server();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runServer();
    < Client side >
    * Client.java
    * Auther : [email protected]
    package Client;
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Client extends JFrame
         private JTextField enter;
         private JTextArea display;
         DataOutputStream output;
         String message = "";
         public Client(){
              super("Client");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent e){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display), BorderLayout.CENTER);
              message = message + "TT0102LO12312OB23423PO2323123423423423423" +
                        "MO234234LS2423346234LM2342341234ME23423423RQ12313123213" +
                        "SR234234234234IU234234234234OR12312312WQ123123123XD1231232" +
                   "Addednewlinehere\nwowowowwoww";
              setSize(300, 150);
              show();
         public void runClient(){
              Socket client;
              try{
                   display.setText("Attemption Connection...\n");
                   client = new Socket(InetAddress.getByName("127.0.0.1"), 8800);
                   display.append("Connected to : = " +
                          client.getInetAddress().getHostName());
                   output = new DataOutputStream(
                        client.getOutputStream()
                   output.flush();
                   display.append("\nGot I/O Stream, Stream is opened!\n");
                   enter.setEnabled(true);
                   try{
                        output.writeBytes(message);
                   catch(IOException ev){
                        display.append("\nIOException occured!\n");
                   if(output != null) output.flush();
                   display.append("Closing connection.\n");
                   output.close();
                   client.close();
              catch(IOException ioe){
                   ioe.printStackTrace();
         public static void main(String[] args){
              Client app = new Client();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runClient();

  • How to send multiple data files / music files using bluetooth / whatsapp / emails...

    hello everyone,,,
    is there any option to send multiple data files / music files using bluetooth / whatsapp / emails...
    as option to select multiple files using "SELECT in menu option / left aA"+ scroll tracepad" is availble with pictures only.
    and while receiving files via bluetooth i'm unable to do any other activity.

    One at time, via Bluetooth.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to send binary data in the message body

    How can we send binary data in the message body that is base64 encoded? below are the requirements
    Mime Header.
    Mime-version: 1.0
    Content-Type: application/octet_stream; name=test
    Content-Transfer-Encoding: Base64
    Submission must be named "test.sub" (lowercase)
    Submission must be base64 mime-encoded
    Submission must be sent in the body of the message (not as an attachment)
    Only one submission per mail message
    No other comments should be put in the body of the mail message (other than the submission)
    I highly appreciate your help. If you can provide few examples, that will be very helpfull.
    Thanks,
    Madan

    Use Message.setContent to set the content, or use Message.setDataHandler with
    a DataHandler constructed with a ByteArrayDataSource. If the content is not
    "naturally" encoded in base64, you can enforce it by setting the Content-Transfer-Encoding
    header to "base64". Any reasonable mail reader won't care what encoding you use, as
    long as the decoded data is correct.

  • How to send login details by post in AN, as form?

    how do I understand the edge POST Login form?
    look the code html:
    <form id="form1" name="form1" action="http://www.aniwere.com.br/LoginExterno.aspx?emp=137975"; method="post">
    <input type="text" id="txtLogin" name="txtLogin" size="20" placeholder="Login" style="height:20px; border: 1px solid #FFF; margin-bottom:5px;" />
    <input type="password" id="txtSenha" name="txtSenha" size="20" placeholder="Senha" style="height:20px; border: 1px solid #FFF;" />
    <input type="image" src="imagens/bt_entrar.jpg" name="button" id="button" style="margin: 5px 0 0 85px;" />
    </form>
    ok, i make 2 textbox and code in tigger
    sym.$("operand1").html("<input type='text' name='txtLogin' id = 'txtLogin' style = 'width:115px; height: 10px;font-size:9px; background:transparent; border-color:transparent'></input>");
    sym.$("operand2").html("<input type='password' name='txtSenha' id = 'txtSenha' style = 'width:115px; height: 10px;font-size:9px; background:transparent; border-color:transparent'></input>");

    make a form like you made those 2 inputs. ( but than form)
    put operand1 and 2 as childs of the form and make the button ( also with .html)

  • How to change value date from posting date to net due date

    Hi Gurus,
    My client wants to change value date from posting date to net due date. currently posting date is considered as value date but in future client wants to change value date to net due date of documents.
    1. what configurations need to be maintained to change value date from posting date to net due date.
    2. Will these changes effect automatic payment run.
    Thanks and Regards,
    Suresh

    Hi Suresh,
    In Future
    While posting the documents you can mention the value date as due date of the documents.
    For already posted documents
    You can change the value date to net due date.
    If the value date is display mode i.e. if you are not able to change the value date in FB02 (Document Change Mode), use OB32 transaction and make value date field as eidtable (BSEG-VALUT).
    In OB32 transaction enter all the required fields like Account type, transaction type, company code and finally activate the Field can be changed check box.
    But not sure, whether we can change the value date to previous date or not?
    This would help you..
    Regards,
    Praisty
    Edited by: Praisty on Jul 28, 2009 9:56 AM

Maybe you are looking for

  • 107 MB File - was not able to process thru File Adapter

    Hi All, I tried to send one 107 MB file using file adapter. But was getting error as "not able to write on the integration server".It seemed like XI was not able to process file with that much size...as when we did split up the file into smaller ones

  • Making a magic iMovie not magical. Having import problems

    Everytime I start the import process of "making a magic iMovie", the import process will stop after inconsistent periods of time. Sometimes 5 minutes, sometimes 30 minutes. I've only had one 60 min tape import completely without interruption. I've ch

  • Export MAM into .war

    Hi, I have imported MAM25.war into NWDS SP13 and made some changes, including to the project name. I set up the NWDS so that when I export the project into a .war and flag the "Run the mobile application" option, it runs and my modifications work. Ho

  • Upgrading logic boards

    ok know that this question has been asked several times but it mostly dealt with the AL pb's. i have a dvi TI @ 867 and i was told that there is a higher one (logic board) then the one i am currently using. what is it? also is it possible to cross ov

  • Setting a Size for JList?

    Hi, How can I set the size of this? ... it currently squeezes it into the smallest box thing... how can I give it more space...? DefaultListModel listData = new DefaultListModel(); listData.addElement("item 1"); listData.addElement("item 2"); listDat