Results 1 to 6 of 6

Thread: Convert a Java Bean Code

  1. #1
    Join Date
    Sep 2009
    Posts
    177

    Convert a Java Bean Code

    Hello,
    I have a huge code which is written in java and I think it is the java beans source code. Now i am very new to java, my question is how can i convert this code to java script, is it possible? I did not find any information on this on internet. Any help will be great. Thank you.

  2. #2
    Join Date
    Dec 2009
    Posts
    292

    Re: Convert a Java Bean Code

    You know what a java bean? And what a jsp? In my opinion, you should just try to find a quick example on the net before asking your question. I recommend you to read some of the tutorials in java beans.

  3. #3
    Join Date
    Nov 2009
    Posts
    446

    Re: Convert a Java Bean Code

    Yes, because your class is not a java bean.
    A bean is a container that is to say that it will hold a class (the definition is somewhat flexible):
    - Private attributes
    - At least a default constructor
    - Accessors and mutators (getters and setters),

    A java bean is a class that contains information describing an object (and that is the object that passes in jsp to display the information to the user's screen). In your case, you have a business class: it will serve you what to spend it in jsp?

  4. #4
    Join Date
    Nov 2009
    Posts
    343

    Re: Convert a Java Bean Code

    To do what you want, you must have an application server that is running (at least one Tomcat). You have arranged a servlet that, when it is called, will appeal to your methods in your class. It is then that the methods of your class return a result as a java bean (an object instance that will contain all the information you want displayed). In your servlet, then you will place this bean in your HttpServletRequest, and java bean that will be accessible by your jsp.

  5. #5
    Join Date
    Mar 2010
    Posts
    197

    Re: Convert a Java Bean Code

    I agree with the above post and would like to add some more information to it. The first thing to do is install a suitable environment (if you want to make the web, you need a web server and an application server). Then you must adjust your code so that it is callable from a servlet (it is no good method on hand an application server for example), and that your methods return beans. Finally it will continue to redirect to your jsp.

  6. #6
    Join Date
    Nov 2009
    Posts
    359

    Re: Convert a Java Bean Code

    So if you understood everything I said, you should have:
    - Changed your method public static void main (String args []) in public TonBean taMethode ()
    - Created a class whose prototype is as follows: public class extends HttpServlet TaServlet
    - Overloaded the method doGet () or doPost () (or both), and in this method have instantiated your class test
    - Finally, you retrieve the return taMethode () and have it stored in a HttpServletRequest, before making a redirect to your jsp

Similar Threads

  1. Convert C++ Program to Java Code!! Please help
    By jessesaini in forum Software Development
    Replies: 1
    Last Post: 24-04-2012, 12:24 AM
  2. pls convert this c++ to java code
    By xSim21 in forum Software Development
    Replies: 4
    Last Post: 26-03-2012, 06:32 PM
  3. Convert C++ code into JAVA
    By Macario in forum Software Development
    Replies: 6
    Last Post: 13-11-2011, 07:36 PM
  4. Need help to convert c++ to java code program
    By xSim21 in forum Software Development
    Replies: 2
    Last Post: 27-11-2010, 04:42 PM
  5. convert C++ program in Java code
    By vaibhavsri in forum Software Development
    Replies: 7
    Last Post: 16-07-2010, 10:08 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,956,415.34845 seconds with 17 queries