Results 1 to 7 of 7

Thread: Converting java class to java bean class

  1. #1
    Join Date
    Jan 2010
    Posts
    119

    Converting java class to java bean class

    Hello,
    I have a java code with me that I use regularly, but the problem is that I need a java bean to do a same kind of work. Is it possible to covert the java code to java bean code. I do no have much idea about it, also I did not found any meaningful information on internet. Expecting for a help. Thank you.

  2. #2
    Join Date
    Nov 2009
    Posts
    330

    Re: Converting java class to java bean class

    You know what a java bean? And what is jsp? In my opinion, you should just try to find a quick example on the net before asking your question. I recommend you some of the tutorial about java bean and jsp.
    See if these threads can help me
    1) How can I convert my java program to an .exe file?
    2) Convert a Java Bean Code

  3. #3
    Join Date
    Dec 2009
    Posts
    292

    Re: Converting java class to java bean class

    Yes, because your class is not a java bean.
    A bean is a container that is to say that it is a class that will contain (the definition is slightly flexible):
    - Private attributes
    - At least a default constructor
    - Accessorize 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
    Mar 2010
    Posts
    383

    Re: Converting java class to java bean class

    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
    Nov 2009
    Posts
    446

    Re: Converting java class to java bean class

    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). Next you must adjust your code so that it is callable from a servlet (it is no use a main method of application on a server for example), and that your methods return bean. Finally he will continue to redirect to your jsp.

  6. #6
    Join Date
    Aug 2009
    Posts
    124

    Re: Converting java class to java bean class

    So if you understood everything I said, you should have:
    - Changed your method public static void main (String args []) in public Method ()
    - 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 Method() and be stored in HttpServletRequest, before making a redirect to your jsp

  7. #7
    Join Date
    Dec 2009
    Posts
    204

    Re: Converting java class to java bean class

    You can not convert *. java or *. class to *. exe files. Just the J + + IDE from MS can do this, but you can create a batch file (if you are using Windows) to start your app automatically. An other way, if you want to compress your files is to put them in a executable jar file.

Similar Threads

  1. DebugGraphics class of java
    By Prashobh Mallu in forum Software Development
    Replies: 5
    Last Post: 19-02-2010, 02:43 PM
  2. How to use RandomAccessFile class in java?
    By Migueel in forum Software Development
    Replies: 4
    Last Post: 03-02-2010, 10:32 PM
  3. Difference between Java Class and Bean
    By Bottlenecked in forum Software Development
    Replies: 5
    Last Post: 01-02-2010, 01:28 PM
  4. Java .class file
    By Kingfisher in forum Software Development
    Replies: 2
    Last Post: 05-11-2009, 12:50 PM
  5. Java Programming Language Basics: Reflection Basics and Class Class
    By mayuri_gunjan in forum Guides & Tutorials
    Replies: 6
    Last Post: 29-08-2005, 12:04 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,583,359.02148 seconds with 17 queries