Li Xin

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

Recent posts by Li Xin

Does any one know if Ajax request can be sent to another server in the same machine? I have Tomcat and IIS on the same pc, I tried to send Ajax request from JSP in Tomcat to a PHP in IIS, it seems does not work.
But even if I specified some complete URL like http://www.oreillynet.com/onjava/blog/2006/08/the_future_of_netbeans_and_i_h.html

it is still the same.
18 years ago
JSP
I tried to use c:import in my jsp like this:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>opusOFFICE</title>
</head>
<body>
<c:import url="http://www.google.com" />
</body>
</html>

However, I got this error on Tomcat 5.5.

javax.servlet.ServletException: javax.servlet.jsp.JspException: Problem accessing the absolute URL "http://www.google.com". java.net.ConnectException: Connection timed out: connect
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:844)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.import_jsp._jspService(org.apache.jsp.import_jsp:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

The strange thing is that I can access google from IE directly, does anyone have idea about this?

Thanks.
18 years ago
JSP
In my servlet, I read the variable stored in the ServletContext and forward to JSP to display, but sometimes, after the variable is updated in ServletContext, the JSP page does not reflect it on some machine. Is this the problem of the browser? Any one can help?

Thanks.
19 years ago
Hi!

Can someone tell how to cache some global data (writable) in a clustered environment? According to the spec, we cannot cache the data in ServletContext in a clustered environment. And also we cannot cache in a static variable since it is difficult to synchronize.

Thanks.
20 years ago
Hi!
Can someone explain what is the meaning of <distrbutable> tag in web.xml? If the tag is not present, does it mean my web application cannot run in a cluster?
20 years ago
Hi!

Can anybody tell me in Ant how to copy file from one drive to another? I tried this in my build file but does not work:


<path id="source.java.dir"><pathelement location="C:\project\src"/></path>
<path id="backup.java.dir"><pathelement location="D:\project\backup"/> </path>
<copy todir="${backup.java.dir}">
<fileset dir="${source.java.dir}" ><include name="*.java"/></fileset>
</copy>
20 years ago
Hi!
May I ask is there any time limit between taking part 1 and part 2?
Thanks.
No doubt Head First EJB
The specification mentions that J2EE classes/interfaces should not be included in the JAR file, does it mean that if my bean needs another helper class or extends another class, these classes cannot be included in the JAR file? Then how does the container know where to look for these classes?
Thanks.
It is known that onMessage in MDB can only be specified as Required or NotSupported, but what about any other method that onMessage invokes? Can we specify other Tx attribute?
Thanks.
Which of the following statements are true when a session bean's client receives a java.rmi.RemoteException? [Check all correct answers]
1. The container does not throw the java.rmi.RemoteException if the container performs a transaction rollback.
2. The client will never receives a java.rmi.RemoteException.
3. The client calls the session bean from another JVM.
4. The client calls the session bean from within the same JVM.
5. The throws clauses of all methods in the remote home and component interface must declare a java.rmi.RemoteException.
The provided answer is 1, 3 and 5, I don't understand why 1 is correct, can anyone explain?
Thanks!
Here is a question about EJB exception:
Which one of the following statements regarding the client view of exceptions received from an enterprise bean invocation is correct?
1. The client can safely continue the transaction by retrying the operation if an application exception is received.
2. The client can safely continue the transaction by retrying the operation if an application exception is received, but only after checking the transaction has not been marked for rollback.
3. The client can safely continue the transaction by retrying the operation if a non-application exception is received.
4. A local client cannot continue a transaction if javax.transaction.TransactionRolledbackLocalException is received.
5. A remote client cannot continue a transaction if javax.transaction.TransactionRolledbackException is received.
The provided answer is 5 only, but I think 2 and 4 are also correct, any idea about this?
Thanks.
For a BMT MDB, what will happen if the onMessage() method just returns before the transaction is committed? Like this:
void onMessage() {
UserTransaction ut = ctx.getUsertransaction();
ut.begin();
.
.
return;
ut.commit();
}
Will an exception be thrown?
Here is a question from www.ejbcertificate.com:
Which of the following statements regarding an enterprise bean's environment are correct?
1. The container provides the tools that allow the deployer to create and manage the enterprise bean's environment.
2. Enterprise bean instances can modify the values of the environment entries at runtime.
3. The deployer sets and modifies the values of the environment entries by editing the enterprise bean's deployment descriptor.
4. Enterprise bean instances obtain the values of the environment entries from the enterprise bean's deployment descriptor.
5. Enterprise bean instances use the JNDI interfaces to obtain the values of the environment entries.
The provided answer is 1 and 5, it says:
Answers 3 and 4 are incorrect because the deployment descriptor is used to define only the environment entries, as opposed to the values that the enterprise bean expects to be provided at runtime.
I am not sure what it means, why cannot we set and modify the values of the env entry?