Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

raymond yadao

Ranch Hand
+ Follow
since Jan 29, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by raymond yadao

Guys, what's the difference of Service Oriented Architecture and Event Driven Architecture?
14 years ago
Hi guys! Can somebody suggest a good beginner book in linux?
Thanks in advance.


raymond
15 years ago
Hi!
I'm developing a web application using struts framework.I made a centralized error page, any exceptions that may occurred will be directed to this error page.In my error page im using the <html:errors property="ERRORS"/> to display the errors.In my action class there's a try-catch to caught the exception.
try {
.....
} catch (Exception e) {
ActionErrors errors = new ActionErrors();
errors.add("ERRORS", new ActionError("errors.100"));
saveErrors(request, errors);
request.setAttribute("GLOBAL_ERROR", e.getMessage());
throw me;
}
and added the exception attribute in my action mappings
<action --
<exception handler= ...>
</action>
here's my problem, when i run this and an exception occur in my error page
it displays nothing.But when i try to move out the code in the catch clause,
the error displays.Am i missing something? Is the request also forwarded when you throw exceptions in your action class?
thanks.
raymond
16 years ago
I've read some article on the internet that says callablestatement(stored proc) is much faster than the preparedstatement.the only problem is that using stored proc, you're tied up to a certain db.what if in the future you change db?
Hi guys! Can anyone give the advantages/disadvantages of PreparedStatement/CallableStatement?Which one is better to use?
thanks!
raymond
Hi guys! what good EJB book will you recommend for a beginner in EJB?i've already visited the javaranch bunkhouse but still undecided.I would like a book that explain thoroughly and have a lot of sample codes.
thanks.
raymond
Consider the following java code:
//in file Book.java
package com.bookstore;
public class Book
{
private String isbn;
public Book(){ isbn = "UNDEFINED_BOOK"; }
public String getIsbn(){ return isbn; }
public void setIsbn(String value){ this.isbn = value; }
}

//in file MusicCD.java
package com.bookstore;
public class MusicCD
{
private String isbn;
public MusicCD(){ isbn = "UNDEFINED_CD"; }
public String getIsbn(){ return isbn; }
public void setIsbn(String value){ this.isbn = value; }
}
Code for browse.jsp:
<jsp:useBean class="com.bookstore.Book" type="com.acme.MusicCD" id="bookorcd" />
<jsp:getProperty name="bookorcd" property="isbn" />
What is printed in the generated response of browse.jsp?



Options

Select 1 correct option.

1. UNDEFINED_BOOK


2. UNDEFINED_CD


3. It will not compile


4. It will compile but will give an exception at request time.



correct answer is 3
my answer is 4.
My explanation.Since MusicCD doesn't extends Book, it will throw ClassCastException.ClassCastException is a runtime exception not a compile time exception.but why the answer is 3?
HI Sathya. thanks for your reply.
"In your example, the attribute added is a String object "test". Now since String does not implement HttpSessionBindingListener, valueBound and valueUnbound methods will not be invoked"
so you mean, in order for the HttpSessionBindingListener to be invoked, the Object to be added in a session must implement this interface?I thought that you just declare a listener and then configure it in the deployment descriptor and its up to the container to register the listener using reflection.
raymond
Hi.Based from SCWCD book of sybex, it says that when a session timeout, the HttpSessionBindingListener will be called not the HttpSessionAttributeListener.
I have tried some sample web application, both have a HttpSessionAttributeListener and HttpSessionBindingListener.I have created a session in my servlet using request.getSession(), then added an attribute( request.getSession().setAttribute("test","test")).The attributeAdded of the HttpSessionAttributeListener was called ( not the valueBound of HttpSessionBindingListener) and when i try to call the invalidate() method(HttpSession), still the HttpSessionAttributeListener was called (thru the method attributeRemoved).
can anybody explain about this?or there's something wrong about the explanation of sybex?
btw, im using tomcat4.1.8.
thanks.
raymond
try using tomcat4.1.24
HTH
raymond
16 years ago
thanks.yeah i've read some books and on the internet that you can override the jspInit() and jspDestroy but not the _jspService().

raymond
Hi. are request attributes and multiple attributes thread safe in multiple servlets ( no implementation of single thread model and synchronization)?
thanks.
raymond
question from sybex web developer certification (chapter 9)
1. which of the following method can be overriden by the jsp author?
a. void jspInit()
b. void _jspService(HttpServletRequest request, HttpServletResponse response) throws ....
c. void jspDestroy()
d. none of the above
my answer is a and b.based from what i've read jspInit and jspDestroy can be overriden. _jspService should not be overriden.
but the book says that the correct answer is d.none of the above.Explanation jspInit() and jspDestroy() lacks the preceding _(underscore).could someone explain to me this?
let say i generated key pairs(public.pgp and secret.pgp) in one pgp program. Can i use these keys as a key pairs in other pgp programs???
thanks..
raymond
17 years ago