Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Convert a Java Bean Code

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 23-07-2010
Member
 
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.

Reply With Quote
  #2  
Old 23-07-2010
Member
 
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.
Reply With Quote
  #3  
Old 23-07-2010
Member
 
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?
Reply With Quote
  #4  
Old 23-07-2010
Member
 
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.
Reply With Quote
  #5  
Old 23-07-2010
Member
 
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.
Reply With Quote
  #6  
Old 02-08-2010
Member
 
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Convert a Java Bean Code"
Thread Thread Starter Forum Replies Last Post
Convert C++ Program to Java Code!! Please help jessesaini Software Development 1 24-04-2012 12:24 AM
pls convert this c++ to java code xSim21 Software Development 4 26-03-2012 06:32 PM
Convert C++ code into JAVA Macario Software Development 6 13-11-2011 07:36 PM
Need help to convert c++ to java code program xSim21 Software Development 2 27-11-2010 04:42 PM
convert C++ program in Java code vaibhavsri Software Development 7 16-07-2010 10:08 AM


All times are GMT +5.5. The time now is 03:14 PM.