What is Enterprise JavaBean and Servlets?
Hi there..
I got kind of confused about enterprise JavaBean and Servlets.
Are there examples for them to help me understand each of them
Could someone kindly enlighten me. Thank u
AG
Keep a bookmark to http://java.sun.com/j2ee/tutorial/1_3-fcs/index.html
Similar Messages
-
What is a javabean and how to compose it?
Q1:although have used many java class in jsp within tomcat, but i don't is it a standard javabean. I mean is any java class can be an javabean, or what is the different between javabean and java class.
for now i found some problem with 'javabean' used in jsp.
Q2:what is ther difference between use jsp:setProperty,jsp:getProperty and direct give value like 'myBean.variable=100'?
thanks!javabeans are standard classes but have :
- default constructor
- getter and setter methods
javabean can be used on custom tags, so no code on your jsp !
why don't directly use attributes ?
look this thread :
http://forum.java.sun.com/thread.jsp?forum=45&thread=314643
this is one, but it's not the only, reason.
Regards. -
Compiling Enterprise JavaBeans and Its Interfaces
I've downloaded j2sdk1.4.1_02 and can't compile any code that imports
javax.servlet.* and javax.servlet.http.*
The install ZIP file has a JAVAX directory but no SERVLET or SERVLET.HTTP subdirectory.
What's the going on? Am I missing some isoteric point? Shouldn't the JAVAX contain SERVLET and SERVLET.HTTP stuff?That's just the base SDK. If you want J2EE, you either need to get the J2EE reference implementation or a J2EE-compliant container. Several have been suggested on this forum: Tomcat, JBoss (JETTY or Tomcat), Orion, etc.
J2EE is not part of the default package. -
Enterprise JavaBeans and SNMP Java Connector
There is possible to develop a Java Connector that will allow my J2EE application to collaborate ( send , receive) SNMP commands with various network devices ( sensors, Access Points, hardware devices).
The information eventualy will be pushed back to the subscribed users using AJAX technologies.
MikeHi,
I do not get your question.....
You want to connect from MI7.1 directly to a BAPI in the Middleware? Well, in 7.0 there was Generic Sync to do that - and I think this should be still there. With Generic sync it was possible to connect to call any BAPI in the middleware directly - if your user had appropiate rights. Check MDK for details.
And if you want to do that in our own app - if this is the intention of your question.... well.... then I would tell you this is under SAP (C), so as you know you could decompile the MI client code, but this is not allowed.
But I guess it was the first thing you are after, so see if that answer helps. But even there you need the running MI middleware - and this thing confused me in your question - are you using MI already or not and what do you want to do?
Regards,
Oliver -
What is the diffrence between a javabean and EJB
hi!
what is the diffrence between a javabean and entreprise jvaabeans! i mean which are the uitilization featires of eaxh one !i am seeking for a solution for my problem , in fact i ma trying to implement and develop an application with java that allows a certain range of IP adresses to be connected to a database server in order to extract the suitable data from the server .
let me explain mor ethe suitation , in fact what i am loking for is to use javabeans to grant my application much more consistence and pertinence : si i am asking if it could be possible to use javabeans in my case especially if i am not trying to developp a web application but a cleint /server one allowing some services.
The application is in fact dealing with a stock exchange market and what i am trying to do is to grant particilar registrated customers to have the informations that they need ( portofolio, currency's status, market indicators, .) also drawing some charts decribing rates, variations, and others specefic financial caracterestics .So , if we consider that this application is not a web application ( no HTTP request and no servers like apache or others ) how it is possible to use javabeans and not EJB to build the application? i mean what could be suitable and preferable to rely on and dvelop to ensure a good java application !!
if you need more details to help you find the answer for me don't hesitate to answer me back !!
Someone here gave me that answer
use RMI to code the services and (Updateable) Value Objects to pass the information between tiers.
RMI is an all-java distributed component framework (ie. EJB, CORBA, DCE/RPC, DCOM, etc.), that is very suitable for developing non-containerized multi-tier applications. Refer to the RMI trail in the Java Tutorial as a starting point for coding RMI solutions (http://java.sun.com/docs/books/tutorial/index.html). Under this scenario you would code the database access service as an RMI service (server-side). Client/server communication should be facilitated through the use of JavaBeans/classes that wrap the information being passed (customer information, portfolio details, market information, etc.) - these are refered to as 'Updateable Value Objects' (a design pattern). Graphing and charting would be handled in your client from the information received from the (RMI) server. GUI JavaBeans can be used to provide this functionality as well as other client-side services. There are numerous "shrink-wrapped" components for GUIs available on the market just peruse any Java magazine to find them.
but how comes? how can i do it !! and where can i find more information please about 'Updateable Value Object "
thanks -
Dear All,
what is the conceptual and functional difference between peripheral target and Enterprise peripheral target?Does anyone get a chance to see this ?
-
What server to install on win XP for learning jsp and servlets
Hi !
If any one knows what server/servlet I have to install if I want to test
JSP and SERVLETS ?
How I'm installing it if I'm using JBuilder and windows XP
Tank'sIf I will download the Tomcat 4.1.24, I will must to use jsp 1.2 and servlet 2.3 version ?
I have jsdk2.1 now declared in Jbuilder, is it also ok for using tomcat ?
If i"m using jbuilder, what the next step after i will download it ?
The tomcat has some shared folder with jsdk/servlet ?
Tank's !
I have so many question, because I just started with jsp/servlets. -
What is relationship between javabeans and Ejb ?
I am new to javabeans and Ejb .
thanks in advance.
zzl_hz_cnnada. null. nil. void. zero. zilch.
-
What is the diff between jsp and servlet
is thr any other difference betwwen jsp and servlet, tht: jsp is automatic generated servlet and jsp has different types of tag, due this we have write less amount of code.any other technically difference between these two?
As you mentioned JSP automatically gets converted into a Servlet and then compiled. From the server's perspective other than the transformation process, there is no real difference.
However, in coding there are some minor differences such as additional access to pre-defined variables and different syntax for some minor things such as imports and etc.
Perhaps somebody else more knowledgeable can fill you in further.
Hope that was helpful. -
JavaBeans VS Enterprise JavaBeans
Hi everyone,
I hope someone can clarify this little problem for me. I am a starting developer with the J2EE technology. I am impressed what it is capable of and I want to continu my study in it. I have been using JavaBeans for a while now and I have noticed that in the J2EE design, there is almost no word about the place of javabeans. Is it that javabeans should be completely replaced by Enterprise Beans or not?
Does a EJB have every advantages that a javabean has?
I hope someone can help me with an answer.
Thx a lot...Hi everyone,
I hope someone can clarify this little problem for me.
I am a starting developer with the J2EE technology. I
am impressed what it is capable of and I want to
continu my study in it. I have been using JavaBeans
for a while now and I have noticed that in the J2EE
design, there is almost no word about the place of
javabeans. Is it that javabeans should be completely
replaced by Enterprise Beans or not?
Does a EJB have every advantages that a javabean has?
I hope someone can help me with an answer.
Thx a lot...Well, I guess somebody has to explain it to you :D - so, here it goes
A java bean is a configurable component (you know the story about accessors and mutators, dont you) EJBs are same and that is precisely where all the similarities end. EJBs run in a container i.e. their life cycle is controlled by an external entity, beans also can be the same way. However, if you want to learn EJB, start with Servlet to understand what containers are actually and how do they operate and behave and how they interface with servlets - EJB after that will be a cake-walk (though a bit restrictive) :D
[email protected] -
Hi friends,
[please forgive me if i am posting this in the wrong forum, all seems same to a fresher]
Now, to my problem..i need a suggestion, a way or a method to implement the following!
I am supposed to create a servlet that reads data from oracle database. Once i retrive the data (for example: 6 rows of a table having 4 attributes), i am supposed to pass this data to a JSP page where the data has to be formatted and displayed properly. If i call the same servlet from a different JSP, i should be able to access the data in that JSP and format it in a different way. How do i pass the data to JSP? what method i can use to achieve this task?
Note: I already know about PrintWriter pw = response.getWriter(); and then printing the formated HTML page..but i want to keep the formatting to JSP part and send only the data part that i can access in JSP
Thanks in adavancearun_ramachandran wrote:
[please forgive me if i am posting this in the wrong forum, all seems same to a fresher]Then you should learn to be more observant - after all, we have JSP and Servlet fora, further down the list. :)
I am supposed to create a servlet that reads data from oracle database. Once i retrive the data (for example: 6 rows of a table having 4 attributes), i am supposed to pass this data to a JSP page where the data has to be formatted and displayed properly. If i call the same servlet from a different JSP, i should be able to access the data in that JSP and format it in a different way. How do i pass the data to JSP? what method i can use to achieve this task? You can store the data in your session object. You can even use JavaBeans and the jsp:usebean tag.
[http://java.sun.com/products/jsp/tags/11/syntaxref11.fm14.html]
Note: I already know about PrintWriter pw = response.getWriter(); and then printing the formated HTML page..but i want to keep the formatting to JSP part and send only the data part that i can access in JSPA wise approach - I wish more prople woiuld be as thoughtful. -
I'm creating JSP pages to represent the view of the site and servlets to get the request and decide which JSP page to load next.
When the servlet recibes a request it generally has to query the database to get some data and then show it back to the client. To do this the servlet calls other object that is responsible to query the database and fill a ResultSet.
My question is: what is better, to load a Vector with special objects containing the data in the ResultSet and then return this vector to the jsp page for it to use it, or may a return directly the ResultSet to the jsp page? With the first option I have to cycle in the resultSet to load the vector and then cycle through the vector to show the results. With the second option I cycle only once, but I isolate from the database (column names, order in which the things are returned...)
I hope anybody can give me an opinion.
ThanksThere are a few things wrong with this:
1) MVC -> The View should have no Model work init.
For the MVC pattern, the database is Model. Use
a
a ResultSet in JSP, and now your View is lockedto
a
database with a specific column format.
Huh? I think that's backwards. The View willalmost
always require Model data unless it is a staticpage.
The Model, however, should be agnostic about what
t View technology it serves. (The Controllerbridges
the two). Also, I would call the database the
Persistence or Integration tier, a separateconcept
from the Model, though intimately coupled to it.I meant the work of the model (gathering the data to
a presentable form) is moved to the View. Yes, the
View needs to know the Model to be able to display
its data. But the Model should handle the data
collection.
Fair enough. I might have read it backwards as well.
>>
2) Any web application (or any application in
general) wether it uses MVC or not, should still
follow a 3 tier approach: Persistance (Data),Domain
(logic), Presentation (View, output) (note, thisis
different then MVC.) By moving the ResultSet inthe
JSP you would be dragging the Persistancemechanism
up two layers. Generally, a layer should only
see
the layer just below it (Presentation seesDomain.
Domain sees Persistance. Persistance never sees
s Domain or Presentation. Domain never sees
Presentation. Presentation never seesPersistance).
>
I agree that Persistence and View should not seeeach
other. However, Model and Persistence must. How
else do you write a DAO? Or even use a mapperlike
Hibernate?First the Model doesn't fit into just one of the
three tiers (Persistance Domain and Presentation).
The Model of MVC is both the Domain logic and the
e Persistance mechanism.
To me, at least, Domain logic = model. The terms I have normally read is either "business tier" or "model domain". "Patterns of Enterprise Application Architecture", M. Fowler. Though, I will concede that this tier has the least well defined set of terms.
But for the three tier architecture: the domain sees
the persistance. You always see one layer down. So
Domain sees the persistance and pulls the data into
the model. So a DAO would be part of the Domain, the
logic of collecting the data from the database to be
used in the application (in the correct object graph
and all that). The persistance though, doesn't see
the domain.
Hmm, I'm not sure which direction 'down' is. And even if 'down' meant towards the back-end or away from it, what about the controller? It parses view requests and delegates them to the model. The results are then normally returned to the controller for dispatch to a view. So, the controller seems to have its fingers in all the tiers except integration and persistence, at least to me. I think of the controller as the 'middle man' between model and view that lets the model be agnostic to the view. The view and controller will to some extent always be coupled. However, the model theoretically exists on its own.
Half of me thinks that I have a different view on
where the Domain and Persistance border is. I
thought the DAO or the Data Mapper would be in the
Domain, whereas you seem to be saying they are in the
Persistance layer?
That's interesting. I don't know if there is an absolute answer. We are dealing with the O/R boundary, and the DAO straddles the boundary. However, one could, at least theoretically, change persistence strategies. What would change? Not your model objects, but your persistence tier objects. Though, again, the definition is nebulous.
3) From a Practical matter:
In many DBs, if you close the connection fromwhich
the ResultSet was derived, the ResultSet is
closed
and you get errors if you try to access it. Ifyou
don't close the connection in the Servlet beforeyour
JSP, then you have to do it in the JSP. Thatmeans
even more DB bleed through to the JSP, and theM->V.
Or, you could just not close the Connection and
d allow it to hang around and create memory
leaks.
>
Yepper.
4) Also practical:
To use the ResultSet in JSP is going to require
scriptlet code. This is ugly and hard to manageand
update later. You have to wrap your code in
try{}catch(SQLException e) {} finally {}, so
the
code is even uglier and harder to manage(especially
if you end up not touching the thing for monthsand
forget what you had done - or god forbid someoneelse
has to keep up your code). You could make acustom
tag to handle it, which makes the JSP easier toread,
but does further damage of spreading the dataaccess
code all over the application.
Definitely!
5) Practical:
When you do this sort of thing, then later
decide
to
change the way the database is set up, digging
all
the places affected by the simple renaming of a
column, or refactoring of which columns are inwhich
tables becomes a heavy effort. Keep it all in a
DataAccessObject, and changes in DB becomestrivial
to keep track of in your code. It is all in one
place, and can be tested off line. Harder stillis
if you change persistance from a database to anXML
library, or some directory lookup or something.You
would have to completely refactor your Servlet
and
your JSP. Put it in a DataAccessObject and allyou
have to do is switch out the DAO instance. The
change is transparent to the Servlet and the JSPas
long as you maintain an interface.
Just keep in mind that for the vast majority of
projects, the RDBMS technology is rarely switched.I
generally program to interfaces in my Model, butmy
Persistence tier is always so tightly coupled thatI
simply use POJO's without an interface.
6) Practical:
I have elluded to this several times, but I will
state it specifically. When you isolate the
persistance and data access to its own layer
then
you
can swap out the presentation (the View and the
Controller) when testing all your persistance
operations. This means the data is independent
of
the container. You can run it out of theServlet/JSP
environment and it will behave EXACTLY as it
will
inside the JSP environment. You can designrobust
tests, debug, redesign, re-edit, etc... muchquicker.
Then, when all done, plug it into your web app
p without worry.
Great point.
Of course, Numbers 3 -> 6 are the reasons why
following 1->2 (MVC and the 3 Tier architecture)are
such good ideas.- Saish
BTW, please take all the above just in the interest of having a good discussion. I have been wrong many times before! ;^)
- Saish -
i am wondering whats the "correct" or best way to connect to a DB using JavaBeans and using this in JSP pages?
i read abt creating a SQL "Helper" class that has some functions like connect etc... but i am thinking its a bit confusing...
if i have a function
public static Statement Connect() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:auction","","");
stmt = con.createStatement();
} catch (SQLException e) {
System.out.println("ERROR: SQLException occured!\n" + e.getMessage());
} catch (Exception e) {
System.out.println("ERROR: An Exception occured!\n" + e.getMessage());
return stmt;
}then i use it
Statement stmt = SqlHelper.connect();when i want to close the connection how do i do it? is it a must to close connections anyway?
or shld i do it the easy way, having the code
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:auction","","");
stmt = con.createStatement();on all JSP pages?
Thank youBalusC wrote:Do it in the data layer. Write DAO classes and SQL helper classes. Then let the business layer, the Servlet, interact with the data layer and let the presentation layer, the JSP, display the results.
And don't return a Statement, but a Connection. And yes, closing a Connection is a must, otherwise you're leaking resources which will cause your web application to crash due to a memory shortage.ya thats what i am trying to do... but how do i? like this? except i return a connection instead? and also, i shld return it by reference? mmm... in java isit like return &con?
package AuctionSystem;
import java.sql.*;
public class SqlHelper {
private static Connection con;
private static Statement stmt;
public SqlHelper() {
Connection con = null;
Statement stmt = null;
public static void Connect() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:auction","","");
stmt = con.createStatement();
} catch (SQLException e) {
System.out.println("ERROR: SQLException occured!\n" + e.getMessage());
} catch (Exception e) {
System.out.println("ERROR: An Exception occured!\n" + e.getMessage());
public static Connection getCon() {
return con;
public static Statement getStmt() {
return stmt;
public static void Close() {
con.close();
stmt.close();
public static String FormatString(String string) {
return "'" + string + "'";
}Edited by: iceangel89 on May 27, 2008 3:50 AM -
While trying to import an Enterprise Javabean Model "No EJBs available"
Hi,
I´ve facing the following problem, it was working but suddenly it stopped.
I´ve created an EAR project that contains an EJB project, the EJBs are add to the public part, at least all the java classes that I want to access and the ear has another public part that references to the EJB public part, when I try to import it on Web Dynpro trying to create e new Enterprise javabeans it says to me that:No EJBs available, in fact it shows the project that contains the ejb but when i check and go next to list the EJB files in that project it says: No EJBs available.
Any idea of what is happeening?
Thanks and regards,
EduardoHi
I think you forget one step : Copy the java bean that access EJBs into this web dynpro dc.
[Help1|Using EJB in Webdynpro
Best Regards
Satish Kumar -
Applet sends SQL and servlet queries and returns results to applet
So, this is what my problem is. I've tried several different ways on this so my code probably don't work at all.
Could someone post me an example on how to send the sql query from the Applet and how to pick up the data from the servlet.
Thank you,
Derek LungI suggest you to use:
* one JavaBean that handles db connections and queries;
* a Servlet that uses the JavaBean and receives a String that rappresents the query from the Applet: such String will be passed to JavaBean in order to execute the query and retrieve the data from db;
* the Applet that uses the Servlet to retrieve the results (you can store them in a structure that MUST be serializable.
Let me know if you find problems in costructing such architecture!
-- Ivan
Maybe you are looking for
-
Navigation Tag library : lyt:container
hi, From my basic research, I found that <lyt:container id="navPanelContainer" /> uses the default iview tray for displaying its iviews in the container using Navigation Tag Library. It is mentioned tha
-
# A fatal error has been detected by the Java Runtime Environment: # SIGSEGV (0xb) at pc=0xcdb40d0c, pid=1584, tid=20 # JRE version: 6.0_14-b08 # Java VM: Java HotSpot(TM) Client VM (14.0-b16 mixed mode, sharing solaris-x86 ) # Problematic frame: # C
-
I receive very few text msgs. Most of them delete with no problem. But I have 2 text msgs that will not delete. Can anyone help?
-
550 5.7.1 This message does not comply with required standards
One of my users received this error message when using MS Word's mail merge function for email messages. <mydomain.com #5.7.1 smtp;550 5.7.1 mA7MhP7f029968 This message does not comply with required standards.> It bounced on all the recipients and wh
-
Contact person in Invoice lists
Hi All, I want to have the Contact person CP in my Invoice list partner since i want to send the output to the Contact person also. I have CP in my actual Invoice header partner and have CP also in the Invoice list partner procedure at header. Despit