Balamaci Serban

Ranch Hand
+ Follow
since Mar 16, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Balamaci Serban

Thanks! That solved the problem. The reason i'm not doing container, hmm, well i'm not pretending to know much about it, i know that you are not tied just to that simple windows popping up, and that you can actually have the option to design your own login page. The problem is that i would like to use encrypted passwords in the database, maybe some cookies so that i can make some automatic checking and not present the form at all and it's nice to have the user redirected to the initialy requested page after succesfull login. The login page is in https, but i guess that you can do that in container managed too. Only fear i have is that the filter will not always fire and sometimes it would get the user in the protected area. Filters must cost a lot of proc time also....
19 years ago
I've got a filter that checks the session for the presence of "authentificated" for all the files in the /protected path, if it's not there i want to redirect to the /login.jsp which is just in the base directory.
So i type http://localhost/MyContext/protected/apage.jsp
i want to be redirected to http://localhost/Mycontext/login.jsp
actually to https, but that's another issue.
so if in the filter that intercepts http://localhost/MyContext/protected/* i say res.sendRedirect("/login.jsp"), guess where it sends me:
http://localhost/login.jsp Ayn't that cute?... but it's wrong!
i tried:
res.sendRedirect("/login.jsp"), guess where it sends me on the call to http://localhost/MyContext/protected/apage.jsp, it sends to
http://localhost/MyContext/protected/login.jsp that's cute also but still wrong. Any way of just getting http://localhost/MyContext/ the base context so i can append login.jsp to it?
19 years ago
Seem pretty kewl. My question is why even the java sites use PHPBB, does JavaBB suck, i see there it's only up to version 0.7.1 while PHPBB is at 2.0.17. I'm sure that it's not the same versioning sistem, but i just wonder, why i have seen so few sites using JavaBB, even Java related sites even implement their own forum, or use PhpBB.
I can't understand. I just took a short looked at some books that started talking about classes of the jakarta struts but not why one would use it, and i can;t really understand why it's used. Are many of the sites doing it? Do u consider it a necesity?From what i understand there is this model-view-controler. Model and view it's the database and the screeen output. Ok so the controle is the ActionServlet. All the pages name indiferent of what url the use requests, goes through the action servlet, which in turn forwards the request to a jsp file. But why? Is the only reason that you can set some variables and load some config files, like hibernate or log4j?

Is Struts that important? I come from a PHP background and i can't really understand it's use.
19 years ago
Not a general solution but for MySQL you can say SELECT * from bla LIMIT 5,10 where actualy 5, 10 could be passed as parameters in the finder method. But that's only MySql and BMP beans. On MS SQL server they have TOP, but that can be run only like this i guess SELECT TOP 10 FROM bla no more can u specify that i can skip the first x records. On PostgreSQL u've got SELECT FROM bla LIMIT 10 OFFSET 5. On Oracle, DB2 and others i would not know.

Anyway what's the catch with Statement.setFetchSize(100) and ResultSet.setFetchSize(100) do i need to call both? What does one and the other? Anyway that can't help us skipp past the result we already processed.
The container runs more instances of beans so it can service multiple clients, and these beans will run concurently, but each of these instances is single threaded(u can't start any threads inside an EJB). ->Multiple threads of single threaded instances.
What are you people doing Hibernate, EntityBeans or just plain JDBC? (of course some combinations with JDBC would be normal) too bad we can't have a vote. Any coments, problems anyone had?
The Intellij IDEA IDE for example has a mapping .dtd file on the harddisk for each URI, so when u mess up with a tag it imediatly highlights it so i guess the your appserver has the same, if it can't find it maybe then it goes online. Other servers may not even be interested in that. They would just do a check to see if all the tags have matching closing tags and all.
[ July 17, 2005: Message edited by: Balamaci Serban ]
Views can be updated, i belive, the problem, would be what to do with the values in the tables outside the view. I guess if the view contained all the columns that would be ok.

With EJB u will have to fight with the DBA designer. To hell with his experience and logical design of databases. The entity bean suplies the data to the client so u have to impose your design on him. So what if it's not optimal and by that he loses 100MB of hard disk space. Get another harddisk.
I don;t know how much of this i can take. I am really going to a phase of really just hateing java. I went for java not too long ago. The language itself, more than a year, i quite disliked it. Belive it or not, i was really enjoying the pointers in C++. Then not too long ago, mostly the time i registered on the forum, i got me a book on databases, curse the day that i did , and it had a nice picture of EJB. It talked about easying the developement. We all know how big of a lie is that.
We come to the point of App Servers. (I am currently unemployed, looking for work, guess i would settle at 400E if i am lucky to get a job anyway as i have not yet participated on any big projects as required). So what would my next employer use as an app server: WebSphere, WebLogic, JBoss also the Spring framework maybe, others...? How about the clients? Guess i will have to learn to swimm in at least 2-3. Ok let's talk about EJB and bang the J2EE a little later.

EJB really made sense for me back then. Actually no, when they talked about entity beans. The ORM mapping seemed some theoretical fad for book writters and pattern designers. Not good old sql where u can control every tinny inch of what's going on the low level database. Well i finnally got it after some time. Te answer is cache. Entity beans means data ready in the same process as the application. Not abideing by the rule that on every call of a method of the bean the container does an ejbLoad to read from the database and actually serving it from what was left in the memory from serving another user's call without doing an inter process communication with the database would really show some improvements. Granted that, but the programing overhead is a killer. They moved away from the SQL and we got a whole bigger package the EJB-QL and of course the SO MUCH HATTED BY ME XML. Everything is in xml. Whole pages of code. There is not that much java left as there is XML. Pretty soom everyone will know XML tags better that java classes. Every container with it's plus XML descr. of course. XML for servlets, tag libraries, for session, entity, message beans. How about the mappings of hibernate- come on...- Spring it seems i will have to learn, can;t coment on that i haven't got to that part yet. More XML right?
Entity Beans means you are no more tied to a particular database. Yeah right. Like i would just go in the middle of the project : Hey this database really is crap, let;s change to MS SQL or better yet lets do ORACLE.
Hibernate gives u more control, but it's much more harder to learn. With EJB you don't optimise at the database level, u don;t care if the data is in a normal form or not, you just need to think how would it fit more your object design. You wanted to have a separate a table with cities name, and pass the city id in the Person table an id to that. No more, that would mean you would have to create a Cities object and set a relationship with that also. More easily to just put the city name as a String in the Person table.

Session Beans, well they're good for mostly one thing i guess. Distributed transactions and implementing the bussiness logic at the middle level in case of another type of client besides the web tier. Anyone can think of another use for them ?
Sure the resource pooling seems nice in theory, i can;t confirm in practice.
More about descriptors now There is no problem. We have tools for descriptors generation. And IDEs. Yeah, another problem. Best IDE i've work was Intellij IDEA, only 500$(got the crack for it, of course, 500$ that's like 5 months rent for me, i;m not that stupid). More likely the companies i guess they work with Eclipse or with some Aplication Server project designer. And for Eclipse be prepared to spend some time just fixing and finding a colection of plugins that barely do the job done. And be prepared to write some descriptors by hand. For most of them, Eclipse will of course sugest the keywords for you, but not offer some graphical tool to just set the parameters, or an already configured example. No, that would be too easy. And of course, learn Ant, which is in itself a new language.
Why this seemed like a good solution? What chance do we have against .NET? Well for me something on the serverside that was supposed to run on Windows....... hmmmm........ hmmm...... bad idea i said back then. But what do u know? The Java JVM seems it's not the optimal one for linux, and the Aplication Servers run on Windows. SAY WHAT??? So we're competing with a tehnology that can and probably uses native code. Windows became more stable and there seem to be not that many patches coming up every day. So the .NET have on us the following advantages. Only one AS, u just learn that to the bone, just one IDE, and that IDE is all everyone has, and you can be as productive as anyone. Just concentrate on the bussiness developement.(the EJB motto, how funny that sounds ) That one stuff for microsoft means everyone is ussing that and so more tutorials, more people out who may have encountered your problem. The cost u say.... The most expensive asset in a company are the employs. Investment in tehnology and hardware is one time only or at least, not every month anyway. And how about the GUI Interface. That;s mostly crap in Java and a web based IDE is not enough. Most users care how theyr GUI looks and how they can interact with it.
Ok enough writting. It went away from the subject. Sorry, i should have started a new thread. On the other hand there is PHP just to take care of JSP. Most web pages just need to pull something from the database. Simplicity in it;s purrest form. You don;t get to cache at the middle tier, granted the transaction support is lacking, but...
So does anyone have the same fear that J2EE will have maybe not such a slow death?
[ July 18, 2005: Message edited by: Balamaci Serban ]
How about some homebrew stuff ->you can make the browser refresh the page, i cannot remember the method, belive that it;s set in the HttpServletResponse refreshing the page every x sec u need, and caching the data not related to the changing info, caching based on a key generated for each user(or for all) kept in a session. If the data update is very irregular or fast i guess the applet solution would work better. But personally i hate applets and a lot of people do.
[ July 17, 2005: Message edited by: Balamaci Serban ]
Well it goes like this i belive.
The home interface is a factory for a EJBObject, you need to call create() on the home interface in order for the container to create a new EJBObject or to reuse an instance that was servicing another client. U see when you invoke a method on your bean, the method it's not invoked on the bean itself as u can see the bean class does not implement Remote so it cannot be called directly from the client. The client executes the method on the EJBObject which is either created by the continer when u called create on the session bean home interface, or reuse an existing instance that has been pooled by the container, just so it won;t have to go to the trouble of creating a new instance. EJBObject is your bean with the container magic contained in it: security management,transaction management, bla bla bla so when u call a method on the bean the container could intervine before, after,... the bussiness method is processed. There is no need to call create() on the EJBObject. Lookup Home, call HomeInterface.create() call bussiness method on EJBObject.
[ July 17, 2005: Message edited by: Balamaci Serban ]
Well the name of the database is hard coded in the souce code. Supose you would want to change the database name, or you will have do deploy on another server that the admin has assigned you a database that begins with the username and so it's of different name. In that case you would have to recompile the bean class. Theoretically by puting the name in the ejb-jar.xml you would not have to recompile, as the class would use whatever name is supplied in there.
Not necesarely much improvement since the .xml file is packed inside the .jar file and so it need a repacking anyway. Could be faster just to modify any occurence and recompile the whole thing. But to take care of that posibility you can use the .xml to define the database name.
[ July 17, 2005: Message edited by: Balamaci Serban ]
Thanks, i guess it had to be so, after all, u use JMS to get away from having to block waiting for a message to be delivered.
JTA does not accept nested transactions. OK, but isn't REQUIRES_NEW starting a new transaction inside another one?
Supose the new transaction completes, if the other transaction is resumed, but rolls back is the completed transaction rolled back too?