Using serialize and deserialize methods generated by clientgen

I am trying to use the classes generated by the weblogic.webservice.clientgen tool
from the weblogic 8.1 release. I would like to be able to make direct use of
the serialize and
deserialize methods in the "Codec" classes that correspond to the various request
and
response object classes. However, these methods require SerializationContext
and
deserializationContext objects as inputs. Are these context objects things I
can construct,
manufacture and/or access? Are there any coding examples for using these methods?
Thanks.
Michael

Bruce,
Thanks for the response. I have seen the documentation before. What that shows
me is how
to write customized Serialize and Deserialize methods. What I want to do is call
the ones that
clientgen has already created for me. I would love to have these called by the
internals of the
generated code as part of the handling of service calls. My problem is that the
web site
that I'm calling for these services uses SSL, and every attempt to use the clientgen-generated
services results in the following exception being raised:
javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable
certificate was received.
Since I am successful in making SOAP calls to this same site -- certificate aren't
an issue
for these SOAP calls -- I thought that what I should try is to make the service
calls myself
using SOAP, but to use the generated Serialize and Deserialize methods
to create the request body and process the response body surrounding the SOAP
call.
However, what I'd really like to do
is figure out the cause of the SSLKeyException, and to make the service calls
the way weblogic
intended them to be made. So if you have any suggestions about what might
be causing the exception, I'd appreciate the help.
BTW. In addition to being able to make SOAP calls myself, I've also had some success
making
web service calls using code generated by Apache AXIS's wsdl2java tool and JWSDP's
wscompile
tool; however, neither of these wsdl processors are replacements for clientgen
because they
both have problems dealing with the complex structures described by wsdl files
for the web
services I'm trying to use.
Bruce Stephens <[email protected]> wrote:
Hi Michael,
The De/SerializationContext are internal/private objects. The example
in the doc (you have probably already seen) is a good starting point:
http://e-docs.bea.com/wls/docs81/webserv/customdata.html#1052981
Regards,
Bruce
BTW, Have you considered using XMLBeans?
http://dev2dev.bea.com/technologies/xmlbeans/index.jsp
Michael Horton wrote:
I am trying to use the classes generated by the weblogic.webservice.clientgentool
from the weblogic 8.1 release. I would like to be able to make directuse of
the serialize and
deserialize methods in the "Codec" classes that correspond to the variousrequest
and
response object classes. However, these methods require SerializationContext
and
deserializationContext objects as inputs. Are these context objectsthings I
can construct,
manufacture and/or access? Are there any coding examples for usingthese methods?
Thanks.
Michael

Similar Messages

  • Serialize and Deserialize

    Serialize and Deserialize with Oracle 9 and Oracle 10
    We have developed a client/server application. Client is a Java application and Server is written in C-Language; link between Java and C is RPC/JRPC.
    We have to serialize and then deserialize a stream in a clob field in Oracle DB. When we deserialize with Oracle 9 we have no problem; now, after a migration to Oracle 10G, the deserialize failed at client level.
    If we test in test environment (Oracle 9) with the same client and the same server we have no problem. The only difference between two enviroenment is only the version of Oracle (9 is OK - 10G is KO).
    We use the OCI api.
    The error message at client level is:
    java.io.InvalidClassException: rpc.wDichiarazione; local class incompatible: stream classdesc serialVersionUID = 2960125282182152041, local class serialVersionUID = 2960125281578161001
    Thanks of all
    Marco

    You've changed a class definition. It has nothing to do with the Oracle version. Recompile that class with
    private static long serialVersionUID = 2960125282182152041L;If you then get another exception, you need to evaluate the changes you've made to the class in the light of what it says about Versioning in the Serialization specification.

  • [svn:bz-trunk] 22429: Adding the default fallback of serializer and deserializer classes to amf deserializer and amf serializer

    Revision: 22429
    Revision: 22429
    Author:   [email protected]
    Date:     2011-09-07 08:04:46 -0700 (Wed, 07 Sep 2011)
    Log Message:
    Adding the default fallback of serializer and deserializer classes to amf deserializer and amf serializer
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/io/SerializationContext.java

  • Using mutator and accessor methods in main.

    Would somebody explain to me exactly how mutator and accessor methods make a class and it's driver program work together. I understand the principle of encapsulation, but I'm obviously missing something. I get the syntax, but what actually happens? I'm hoping a fresh perspective on it will help me understand better.
    I guess another way to ask the question could be: how do you use accessor and mutator methods in the main program that calls them?

    >
    the assignment says to have a
    "reasonable set of accessor and mutator methods
    whether or not you use them". So in my case I have
    them written in the class but do not call them inthe
    driver program. And like I said, the program does
    what it's supposed to do.This class you're in worries me. I'm sure what
    polytropos said is true: they're trying to make you
    think about reuse. But adding to an API without cause
    is widely considered to be a mistake, and there are
    those who are strongly opposed to accessors/mutators
    (or worse, direct field access) on OOP design grounds.The class is based on the book Java: Introduction to Computer Science and Progamming, by Walter Savitch. Until now I've been pretty happy with it. Another problem, to me anyway, is that so far we've done a few, cumulative programming projects per chapter. This time, there was one assignment for the whole chapter that is suppsoed to incorporate everything. But that's just me complaining.
    Here is the code I have and that it looks like I'll be turning in... criticisms welcome.
    Here is the class:
    public class GradeProgram//open class
         private double quiz1;
         private double quiz2;
         private double mid;
         private double fin;
         private double finalGrade;
         private char letterGrade;
         public void readInput()//open readInput object
              do
                   System.out.println("Enter the total points for quiz one.");
                   quiz1 = SavitchIn.readLineInt();
                   System.out.println("Enter the total points for quiz two.");
                   quiz2 = SavitchIn.readLineInt();
                   System.out.println("Enter the mid term score.");
                   mid = SavitchIn.readLineInt();
                   System.out.println("Enter final exam score.");
                   fin = SavitchIn.readLineInt();
                   if ((quiz1>10)||(quiz2>10)||(quiz1<0)||(quiz2<0))
                   System.out.println("Quiz scores are between one and ten.  Re-enter scores");
                   if ((mid>100)||(fin>100)||(mid<0)||(fin<0))
                   System.out.println("Exam scores are between zero and one hundred.  Re-enter scores.");
              while ((quiz1>10)||(quiz2>10)||(quiz1<0)||(quiz2<0)||(mid>100)||(fin>100)||(mid<0)||(fin<0));
         }//end readInput object
         public void output()//open output object
              System.out.println();
              System.out.println("You entered:");
              System.out.println("Quiz 1: " + (int)quiz1);
              System.out.println("Quiz 2: " + (int)quiz2);
              System.out.println("Mid term: " + (int)mid);
              System.out.println("Final exam: " + (int)fin);
              System.out.println();
              System.out.println("Final grade: " + (int)percent() + "%");
              System.out.println("Letter grade: " + letterGrade());
         }//end output object
         public void set(double newQuiz1, double newQuiz2, double newMid, double newFin, double newFinalGrade, char newLetterGrade)
              if ((newQuiz1 >= 0)&&(newQuiz1 <= 10))
              quiz1 = newQuiz1;
              else
                   System.out.println("Error: quiz scores are between zero and ten.");
                   System.exit(0);
              if ((newQuiz2 >= 0)&&(newQuiz2 <= 10))
              quiz2 = newQuiz2;
              else
                   System.out.println("Error: quiz scores are between zero and ten.");
                   System.exit(0);
              if ((newMid >= 0)&&(newMid <= 100))
              mid = newMid;
              else
                   System.out.println("Error: exam scores are between zero and one hundred.");
                   System.exit(0);
              if ((newFin >= 0)&&(newFin <= 100))
              fin = newFin;
              else
                   System.out.println("Error: exam scores are between zero and one hundred.");
                   System.exit(0);
              letterGrade = newLetterGrade;
         public double getQuiz1()
              return quiz1;
         public double getQuiz2()
              return quiz2;
         public double getMid()
              return mid;
         public double getFin()
              return fin;
         public char getLetterGrade()
              return letterGrade;
         private double finalPercent()//open finalPercent object
              double quizPercent = (((quiz1 + quiz2) /2) * 10) / 4;
              if (((((quiz1 + quiz2) /2) * 10) % 4) >= 5)
                   quizPercent++;
              double midPercent = mid / 4;
              if ((mid % 4) >= 5)
                   midPercent++;
              double finPercent = fin / 2;
              if ((fin % 2) >= 5)
                   finPercent++;
              finalGrade = (quizPercent + midPercent + finPercent);
              return (finalGrade);
         }//end final percent object
         private double percent()//open percent object - helping object
              double percentGrade = finalPercent();
              return (percentGrade);
         }//end percent object
         private char letterGrade()//open letterGrade object
              double letter = percent();
              if (letter >= 90)
                   return ('A');
              else if (letter >= 80)
                   return ('B');
              else if (letter >= 70)
                   return ('C');
              else if (letter >= 60)
                   return ('D');
              else
                   return ('F');
         }//end letterGrade object
         private double quizScore()//open quizScore object
              double quizes = ((quiz1 + quiz2) /2) * 10;
              return (quizes);
         }// close quizScore object
    }//end classAnd here is the driver program:
    public class GradeProgramDemo
         public static void main(String[] args)
              String cont;
              do
                   GradeProgram firstStudent = new GradeProgram();
                   firstStudent.readInput();
                   firstStudent.output();
                   System.out.println();
                   System.out.println("Enter more student grades?  Enter Y to continue");
                   System.out.println("or press enter to quit.");
                   cont = SavitchIn.readLine();
                   System.out.println();
              while (cont.equalsIgnoreCase("y"));

  • How to refresh table display using slis and 'reuse_alv_grid_display method.

    hello,
    how to refresh table display using slis and 'reuse_alv_grid_display method'.
    when i'm refreshing table display it performs once again reuse_alv_grid_display.and when i back the previous value appear.how to solve it?
    neon

    are you chaning any value in the gird if so use this..
    Pass the user_command form name to the Import parameter
    I_CALL_BACK_USERCOMMAND .
    and have the Dynamic form implementation..
    FORM user_command USING ucomm TYPE sy-ucomm
                selfield TYPE slis_selfield.
    "The below is important for Editable Grid.
      DATA: gd_repid LIKE sy-repid, "Exists
      ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data .
      ENDIF.
      CASE ucomm.
        WHEN 'REFRSH'.
      ENDCASE.
           selfield-refresh = 'X'.
    ENDFORM.                    "user_command

  • Help: Using Record and Collection Methods

    I have created a record and I have to loop for as many records in the "RECORD". However if I attempt using any of the Collection Methods, I get the following error:
    ERROR at line 1:
    ORA-06550: line 41, column 14:
    PLS-00302: component 'EXISTS' must be declared
    ORA-06550: line 41, column 4:
    PL/SQL: Statement ignored
    ORA-06550: line 47, column 26:
    PLS-00302: component 'COUNT' must be declared
    ORA-06550: line 47, column 7:
    PL/SQL: Statement ignored
    Here is the SQL I am trying to execute:
    DECLARE
    TYPE Emp_Rec is RECORD (
    Emp_Id Emp.Emp_no%TYPE
    , Name Emp.Ename%TYPE
    ERec Emp_Rec;
    Cursor C_Emp IS
    SELECT
    Emp_No, Ename
    From Emp;
    begin
    OPEN C_Emp;
    LOOP
    FETCH C_Emp INTO Erec;
    EXIT WHEN C_Emp%NOTFOUND;
    END LOOP;
    IF Erec.Exists(1) THEN
    dbms_output.Put_line('exists' );
    else
    dbms_output.Put_line('does not exists');
    end if;
    CLOSE C_Emp;
    FOR I IN 1..ERec.COUNT
    LOOP
    dbms_Output.Put_Line( 'Row: ' || To_Char(I) || '; Emp: ' || ERec(i).Name) ;
    END LOOP;
    end;
    Can anyone help, please?
    Thanking you in advance,

    You only defined a Record and not a collection, therefore you cannot use .EXISTS
    This is how you would use record, collection and exists together
    DECLARE
    TYPE Emp_Rec is RECORD
             (Emp_Id Emp.Empno%TYPE,
              EName Emp.Ename%TYPE );
    TYPE Emp_tab is table of emp_rec index by binary_integer;
    ERec Emp_tab;
    Idx  INTEGER;
    Cursor C_Emp IS
         SELECT EmpNo, Ename    From Emp;
    begin
    IDX := 1;
    OPEN C_Emp;
    LOOP
           FETCH C_Emp INTO Erec(IDX);
                     EXIT WHEN C_Emp%NOTFOUND;
           IDX := IDX + 1;
    END LOOP;
    IF Erec.Exists(1) THEN
           dbms_output.Put_line('exists' );
    else
           dbms_output.Put_line('does not exists');
    end if;
    CLOSE C_Emp;
    FOR I IN 1..ERec.COUNT  LOOP
            dbms_Output.Put_Line( 'Row: ' || To_Char(I) || '; Emp: ' || ERec(i).eName) ;
    END LOOP;
    end;I hope you realize that this is only an example of how to use RECORD, COLLECTIONS and Collection Methods (.EXISTS, .COUNT)
    and not the best way to display the contents of a table.

  • Comparing dynamic fields of objects using equals and hashCode methods

    To compare the different objects of the same class with their contents like jobTitleId, classificationId, deptId & classificationId was to be done and do some manipulations later using Set and Map. I was able to do that by simply overriding the equals and hashCode methods of Object class and was able to fetch the information (like in the following Map).
        Map<LocationData, List<LocationData>>
    The following is the class I used (its been shown to you so that it can be referred for my problem statement):
    LocationData class
        package com.astreait.bulkloader;
        public class LocationData {    
            String locId, deptId, jobTitleId, classificationId;
            @Override  
            public boolean equals(Object obj) {        
                LocationData ld = (LocationData)obj;       
                return this.deptId.equals(ld.deptId) && this.jobTitleId.equals(ld.jobTitleId) && this.classificationId.equals(ld.classificationId) &&
        this.locId.equals(ld.locId);   
            @Override  
            public int hashCode() {        
                return deptId.hashCode() + jobTitleId.hashCode() + classificationId.hashCode() +locId.hashCode();  
    Problem:
    I'm already known to which all fields of this object I need to make the comparison.
    i.e I'm bound to use the variables named classificationId, deptId, jobTitleId & locId etc.
    Need:
    I need to customize this logic such that the fields Names (classificationId, deptId, jobTitleId & locId etc) can be pulled dynamically along with their values. So, as far as my understanding I made use of 2 classes (TableClass and ColWithData) such that the List of ColWithData is there in TableClass object.
    I'm thinking what if I override the same two methods `equals() & hashCode();`
    such that the same can be achieved.
        TableClass class #1
        class TableClass{
            List<ColWithData> cwdList;
            @Override
            public boolean equals(Object obj) {
                boolean returnVal = false;
                        // I need to have the logic to be defined such that
                        // all of the dynamic fields can be compared
                return returnVal;
            @Override
            public int hashCode() {
                int returnVal = 0;
                        // I need to have the logic to be defined such that
                        // all of the dynamic fields can be found for their individual hashCodes
                return returnVal;
    ColWithData class #2
        class ColWithData{
            String col; // here the jobTitleId, classificationId, deptId, locId or any other more fields info can come.
            String data; // The corresponding data or value for each jobTitleId, classificationId, deptId, locId or any other more fields.
    Please let me know if I'm proceeding in the right direction or I should make some any other approach. If it is ok to use the current approach then what should be performed in the equals and hashCode methods?
    Finally I need to make the map as: (Its not the concern how I will make, but can be considered as my desired result from this logic)
        Map<TableClass, List<TableClass>> finalMap;

    Hello,
    What is the relation with the Oracle Forms tool ?
    Francois

  • OptionalDataException when using serialize and socket timeout

    hi,
    i'm using ObjectInputStream and ObjectOutputStream to send objects through a socket.
    I sometimes get the following exception: OptionalDataException, with the exception message as null.
    does anyone know why or how can i handle it?
    i'm sure that all i'm sending is objects.

    yes i did.
    they talk about not sending object,
    or increasing the timeout to around 3 seconds.
    i'm writing a program that its consept is writing diffrent objects, and 3 sec of blocking time is a lot for me.
    i saw that there is a lot of confusion about this problem, and thought that we might put it to an end (plus i'll solve the problem in my program :-) ).
    alon

  • A problem using serialization and/or not overwritten variables

    I have a problem while writing objects in ObjectOutputStream :
    Here is a simplified version of the program :
    class InDData implements serializable
         private Vector shapeVector = new Vector ();
         public InDData (Vector shapeV)
              this.shapeVector = shapeV;
         public int getShapeVectorSize ()
              return (this.shapeVector.size());
    class InDShape implements serializable
         private Vector points = new Vector();
    // client side
    ObjectOutputStream p = new ObjectOutputStream(new BufferedOutputStream (connection.getOutputStream()));
    InDData objectData = (InDData) vectorObjectsToBeSentThroughNetwork.remove(0);
    System.out.println(objectData.getShapeVectorSize(); //print 1
    p.writeObject(objectData);
    p.flush();
    //server side
    ObjectInputStream in = new ObjectInputStream(new BufferedInputStream (connection.getInputStream()));
    Object oTemp = in.readObject();
    if (oTemp instanceof InDData)
         InDData objectData2 = (InDData) oTemp;
         System.out.println(objectData2.getShapeVectorSize(); //print 2
    Some explanations before the main dish :)
    I am writing a client that allows you to draw a figure and send it to the network. The drawing is composed of shapes and each shape (class InDShape) is composed of points. For the drawing to be sent to the network, i add the shapeVector (== drawing) to the class named InDData (this class allows me to add some more information about the client and the object sent, not shown here) and then i write the object InDData created in the ObjectOutputStream.
    Before writing InDData to the ObjectOutputStream, i test to see if it has a good shapeVector by drawing the shapeVector at the screen. This always shows the same copy as the last drawn panel.
    We suppose that the drawing is sent to the network after each drawn shape
    (mousePressed -> mousseDragged -> mousseReleased)
    (<------------------------------- shape ------------------------------->)
    now the problem ;)
    When i start drawing, the first shape is sent through the network without any problem.
    As soon as i add a second shape to the drawing (shapeVector.size() == 2) things get weird.
    The drawing sent to the network is made only of the first shape, nothing more.
         output of program after the 2nd shape was drawn
         client print 1 : size is 2
         server print 2 : size is 1
    Alright seems like the shapeVector is truncated...
    Now i tried something else to see if the it's only the Vector which is truncated or anything else.
    After adding a second shape to the drawing, i delete the first shape of it:
         reprenstation of the shapeVector:
         ([shape1])
         ([shape1][shape2]) // added the 2nd shape
         ([shape2]) // deleted the first shape
         ([shape2][shape3]) // added a third shape. Vector sent to the network via InDData
         output of program with the vector shown above
         client print 1 : size is 2
         server print 2 : size is 1
    Additionnaly you might expect me to say that first element of shapeVector inside both class InDData (client and server) are the same, but unfortunately they are not.
    The shapeVector received by the server via InDData is the same as when i drew the first shape :((
    Here is the problem (!) :(
    I think that i have a variable that is not overwritten somewhere but i don't know because:
    objectData is overwritten each time a message is sent to the server and has the correct values inside.
    objectData2 is overwritten each time a message is received from clients.
    Sorry for the huge post, but i believe that explanations are necessary ;)
    I am using the 1.4.2 jvm (not tested on others) with Xcode (apple powerbook g4 12").
    Thank you all :)

    Update :)
    In my way of making my program "simple" i forgot an important point in the client side :
    // client side
    ObjectOutputStream p = new ObjectOutputStream(new BufferedOutputStream (connection.getOutputStream()));
    while (connectionNotEnded)
         synchronized (waitingVector)
              try
                   waitingVector.wait();     // the only purpose of the Vector is to make the thread wait until it is interrupted to send InDData
              catch (InterruptedException ie)
                   System.out.println("Thread interrupted");
         InDData objectData = (InDData) vectorObjectsToBeSentThroughNetwork.remove(0);
         System.out.println(objectData.getShapeVectorSize(); //print 1
         p.writeObject(objectData);
         p.flush();
    I need it to explain the solution of my problem.
    when I am creating a client, a thread is created with the above code. It creates the ObjectOutputStream and then wait patiently until said to proceed (Thread.interrupted()).
    I do not close the ObjectOutputStream during the program running time.
    So whenever I am writing an object to the stream, the stream "sees" if the object was created before. I suppose that the ObjectOutputStream has a kind of memory for past written objects.
    So when i send the first InDData, the ObjectOutputStream's memory is "empty", thus the correct sending (and serialization) of InDData.
    But whenever I try to write another object of the same type InDData containing approximately the same data (shapeVector), the ObjectOutputStream calls its "memory" and tries to find it in the past written objects. And finds it in my case ! That's why whatever i put in the shapeVector, it ends by being the first shapeVector sent through the network. (I assume that the recall memory process lacks of "precision" in identifying the memory's object or that the process to give a unique serial to the written object in the ObjectOutputStream "memory" is limited).
    I tried the different ObjectOutputStream writing methods :
    instead of p.writeObject(objectData) i put p.writeUnshared(objectData).
    But as it is said in the docs : " While writing an object via writeUnshared does not in itself guarantee a unique reference to the object when it is deserialized, it allows a single object to be defined multiple times in a stream, so that multiple calls to readUnshared by the receiver will not conflict. Note that the rules described above only apply to the base-level object written with writeUnshared, and not to any transitively referenced sub-objects in the object graph to be serialized."
    And that is exactly my case !
    So i had to take it to the next level :)
    instead of trying to make each written object unique, i simply reset the stream each time it is flushed. That allows me to keep the stream opened and as fresh as new ;) I think the cost of resetting the stream is higher than writeUnshared but lower than closing and creating a new stream each time otherwise it would not have been implemented ;)
    Here is the final code for the client side, the server side remains unchanged :
    // client side
    ObjectOutputStream p = new ObjectOutputStream(new BufferedOutputStream (connection.getOutputStream()));
    while (connectionNotEnded)
         synchronized (waitingVector)
              try
                   waitingVector.wait();     // the only purpose of the Vector is to make the thread wait until it is interrupted to send InDData
              catch (InterruptedException ie)
                   System.out.println("Thread interrupted");
         InDData objectData = (InDData) vectorObjectsToBeSentThroughNetwork.remove(0);
         System.out.println(objectData.getShapeVectorSize(); //print 1
         p.writeObject(objectData);
         p.flush();
         p.reset();
    And that solves my problem :)

  • Login to a website using httpURLConnection and GET methods

    Hello,
    I would like to write a java program that connects to a website, logs in by sending relevant data to the javascript I copy-pasted below and then retrieves the information of the webpage reached after successful login.
    <FORM method="post" name="loginForm" action="/cvg/dispatch/login/submit">
    <TABLE>
    <TR>
    <TD>
    <TABLE BGCOLOR=#D0E2FF WIDTH="100%" BORDER="0" CELLPADDING="3" CELLSPACING="0">
    <TR><TD COLSPAN=2>�</TD></TR>
    <TR>
    <TD ALIGN="RIGHT"><FONT SIZE=3>login</FONT></TD>
    <TD><input type="text" name="loginValues.userName" value="" size="15" maxlength="30" ><input type="hidden" name="priority-normal" value="loginValues.userName"></TD>
    </TR>
    <TR>
    <TD ALIGN="RIGHT"><FONT SIZE=3>password</FONT></TD>
    <TD><input type="password" name="loginValues.password" value="" size="15" maxlength="30" ><input type="hidden" name="priority-normal" value="loginValues.password">
    </TD>
    </TR>
    <TR>
    <TD ALIGN="CENTER" COLSPAN=2>
    <input type="image" name="Login" value="Login" src="/cvg/images/login-button.gif" alt="Login" border="0" width="67" height="33" ><input type="hidden" name="submitButton" value="Login"><input type="hidden" name="Login-action" value="Login">
    </TD>
    </TR>
    </TABLE>
    Thanks for your help

    Using POST
    http://forum.java.sun.com/thread.jspa?threadID=645830
    second POST
    Using GET
    URL u = new URL("http://server/cvg/dispatch/login/submit?loginValues.userName=user&priority-normal=loginValues.userName&loginValues.passwor=password&priority...")
    By the way the html you provided does not use GET at all, it uses POST
    <FORM method="post" ring any bell?
    As for javascript, I don't see any script on the html page you provide, nor
    do I see any onsubmit or onclick action.

  • Is it possible to use doGet() and doPost method in one jsp

    i am having a jsp form which will perform upload as well as download.There is a seperate servlet for download and upload.For downloading i use doGet method and doPost for the upload.how can i change the method dynamically for the above cases.

    Hi,
    in your jsp, if you call:
    request.getMethod();
    it should the string "GET" or "POST" depending on the HTTP method used, so you could do something like
    <%
    String httpMethod = request.getMethod();
    if ( "GET".equals(httpMethod) ) {
    // code to handle get requests
    else if ( "POST".equals(httpMethod) ) {
    // code to handle post requests
    %>
    I probably would of done it in a servlet(override doGet and doPost), or 2 seperate jsps
    Hope this helps
    Dominic

  • Why do we need get and set methods?

    It is considered good design practice to keep all class data private and
    provide get and set methods for accessing the data in a controlled
    manner.
    So, instead of directly accessing the class data, you use getter and setters.
    I do not really feel the need to use get and set methods.
    How does that achieve encapsulation when ultimately the class data is being exposed?

    A couple of reasons why to use get and set:
    1. For example you can set an int value for month, if a user sets this to somting
    higher than 12 (or 11 if it's zero based) you want to handle that by either
    throwing an exception or adding a year for every time it can be devided by 12.
    If you dont do it in set you'll have a whole bunch of methods that might need to
    correct the value before retreiving the eventual date.
    2. If for some reason you have security set up for certain values you can
    implement this in the get method. When this is done somewhere else you have
    a whole bunch of methods retreiving the info in other classes that need to check
    first. (a canGet method could allso be used). Another good reason to use get
    is when the information needs to be converted depending on the consumer
    calling the get method.
    3. If any logic in 1 or 2 changes you'll have a bunch of code to change.
    If you feel there is no need to implement any security, error handling (on
    compiling because get and set might throw something) or validation when
    setting/getting these values there is still the argument of readabillity.
    Eclipse has a feature that will generate getters and setters for you so it's not
    like there is a lot of extra typing involved.
    Got interupted whyle typig so sorry to repeat any answer given before.

  • Serialization and circular dependancies

    I am hoping to save some objects using serialization. However, I am worried about some circular dependacies.
    I have a list of authors and books. Each book is associated with an author. And each other has a list of books. Therefore there is a circular depedancy in that in each author is a reference to a book which has a reference to the author.
    Does std serialization take care of this or does it cause a problem?
    Thanks.

    I am hoping to save some objects using serialization.
    However, I am worried about some circular
    dependacies.
    I have a list of authors and books. Each book is
    associated with an author. And each other has a list
    of books. Therefore there is a circular depedancy in
    that in each author is a reference to a book which
    has a reference to the author.
    Does std serialization take care of this or does it
    cause a problem?What happened when you wrote a little program to test this?
    Did it create an infinitely large file? Were you able to serialize and deserialize successfully?

  • Javascript array ;Add and remove elements without using push and pop

    Hi
     I need to perform add and remove  operation in Javascript with following scenarios
    i) Add element, if element does not exist in array(javascript)
    ii) Remove element, if element exist in array(javascript)
    Without using push and pop method how to achieve this?
    Regards
    Siva

    Completed the Scenario.

  • What is the disadvantages of using Serialization?

    HAi all,
    I want to store objects in a file. I am preferred to use serialization. But I want to know what are the disadvantages of using Serialization over other methods (direct file, Keyed File)?
    Can we store as many records using serialization? Is there any limit? Is there any security related issues?
    Pls help me.
    regards,
    namanc

    I don't think there is disadvantage using serialization compare to direct i/o access to file or any storage, except that you need to design your code such as it is serializable (hence, you may want to use transient keyword, or use externalizable, to be able to store/load the object properly).
    Use serialization if possible, it saves you from inventing new+uncompatible mechanism of doing something in java.

Maybe you are looking for

  • Problem in getting Generic Delta records to BW

    Hi BW Gurus, I have got one issues with which I have been struggling a lot for several days . i.e I am extracting data from R/3 using Generic Extractor (View) from CATSCO and CATSDB. At the time of delta, I tried using Personal  No with Time Stamp gi

  • MacBook connection to HDMI

    Is it possible to connect your MacBook to an HDTV using the HDMI outlets? What cables are necessary since there is no HDMI outlet on the MacBook? I'm guessing there has to be some sort of conversion cable..

  • ICal not syncing with iCloud and iPhone.

    Hi. I entered events in iCal on my laptop (It's old ... running 10.7.5), but they are not being sent to my iCloud account of my iPhone 4. I never had this problem until 2 weeks ago. HELP! THANK YOU.

  • Migration of Open Tasks when BPM Processes Change during major releases

    Hi This is the most often scenario faced by many project teams during Go-Lives of BPM Processes. We would like to migrate BPM tasks from older BPM processes to newer BPM process. And there is substantial changes done between two releases. Though I am

  • Iphone google redirect virus

    I have iPhone 4S and using chrome app. Google recently give me a lot of problem, it redirect to me to some website I never heard before such as http://corp.kaltura.com/. It was different website couple days ago. I tried on Safari, both app will have