paoh adam

Greenhorn
+ Follow
since May 26, 2006
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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by paoh adam

Hello friends.
I used my-eclipse to do hibernate reverse engineering. I created tables and set their relation base on PK and FK. My question is can hibernate reverse engineering support for inheritance relations (extends) between the tables?

Actually in my class diagram I have inheritance relation. When I used Forward Engineering - UML Class Diagrams to Java Code, yes it provide the extends in my java code. Then, I want to try using hibernate reverse engineering and I started to create tables and set their relation base on PK and FK (I changed a bit the class diagram and represent it as erd diagram)

So my dear friends, could you help me out by suggest me any url/forum that i can refer?
Thanks in advance for any hints
Regards
-paoh-
Thanks Ben. The example you gave really help me a lots =)... After I did some changing to my codes by referring to the example, finally the logout problem was solved.

Refer to my previous post in this topic, I changed the step 2 with :


And each of my Page Controller (servlets), I add the code like below, and then I forward it to jsp page (same like step 3). If I did not put this code, it will show the server error message.


Let me know if I am doing it wrong. And also thanks to Rama for the information given =)...

Terima kasih->thank you
Regards
-paoh-
11 years ago
JSP
Hi Ben,
I have read the article. So I tried to implement the PRG Technique to my application. But honestly, I not sure whether I am do it correctly or not...

To be concise on what I have done, below is the step I used during implemented this technique to my application:
1. I call my servlet page form a form. Example:

And sometimes I used jsp:forward.

2. I used this LoginAction as my Task Controller; then, after I did some processes here then I redirect it to another servlet page using this syntax:

But it got an error on it so I changed to a forward statement which is:


3. I used GetDatabase as my Page Controller, where it forward to jsp page using this syntax:


After I deployed, I can run this application (it can show the information) but it is still not solve the logout problem. If not a burden, could you (or any one) please tell me whether I�m doing it (PRG Technique/Servlet) right or not? And could you recommend/suggest me, any tutorial/web site that I can use this technique to solve the problem?

Thanks in advance for any hints
Regards
-paoh-
11 years ago
JSP
HI friends,
I developed a simple application which need user to login and logout.
The problems is when user logout and then he click the back button for more many time, he will get a message from the browser which is:

// Mozilla Firefox
The page you are trying to view contains POSTDATA that has expired from cache. If you resend the data, any action from the form carried out (such as a search or online purchase) will be repeated. To resend the data, click OK. Otherwise, click Cancel.
//or in IE
Warning: Page has expired
The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.
To resubmit your information and view this Web page, click the Refresh button.


So if he click ok(Firefox)/Refresh(IE), then he will get back the page b4 login, and of cause it is not secure if the page previous contains an important data.

Actually, I refer this article as my guidance:
http://www.javaworld.com/javaworld/jw-09-2004/jw-0927-logout.html

//this is some code in my logout.jsp


//all my jsp pages after login, I put


I have tried to print out the value of dbHost at logout.jsp, and I checked at my LogFile the value is null but then, after do a test by click the back button the value is the same like b4 logout.

When I did some searching I found this article by the same author
http://www.javaworld.com/javaworld/jw-10-2006/jw-1006-logout.html?page=1

But, it is a little bit difficult for me coz I totally don�t know about JSF and Stripe. Honestly, I am new in java.

So my dear friends, could you help me out or have any idea?
Thanks in advance for any hints
Regards
-paoh-
11 years ago
JSP
Thanks Divya Shastry for noticing me the mistake I have made in my code.

Since that I�m quite new with java, I myself also not sure which piece of code is more efficient.. but, I really enjoy to learn new things..
Thanks you again
11 years ago
Hi Divya Shastry. Below is the code:

//this method I modify from your method
public Vector myMethod() {
Vector myVector=null;
try{
this.dbConnection();
String sql="select name,email from personal order by name";
PreparedStatement prepareStmt=con.prepareStatement(sql);

ResultSet rs=prepareStmt.executeQuery();
while(rs.next()){
myVector=new Vector();
myVector.addElement(rs.getString(1));// 1st data
myVector.addElement(rs.getString(2));// 2nd data
}
rs.close();
prepareStmt.close();
}catch(Exception ex){
System.out.println(ex.getMessage());
}finally{
return myVector;
}
}

//this at main
public static void main(String[] args){
CayukPah pah=new CayukPah();
pah.dbConnection();

Vector p_vektor=new Vector();
//-------1)try:Ulf Dittmer ---------
System.out.println("TRY GET DATA (1):1\n");
p_vektor=pah.getPersonData();
for(int i=0;i<p_vektor.size();i++){
Vector vec = (Vector) p_vektor.elementAt(i);
System.out.println("Nama: "+vec.elementAt(0));
System.out.println("Email: "+vec.elementAt(1));
System.out.println("\n");
}
p_vektor.clear(); //clear the elements
//-------2)try ivya Shastry ---------
System.out.println("TRY GET DATA (2):1\n");
p_vektor=pah.myMethod();
for(int k=0;k<p_vektor.size();k++){
System.out.println("Nama: "+p_vektor.elementAt(k));
System.out.println("Email: "+p_vektor.elementAt(++k));
System.out.println("\n");

}
}

Regards,=)
-paoh-
11 years ago
Hi.. Thanks to Ulf Dittmer and Divya Shastry for the reply.

I have tried both. And both give me the result like I want =).. Thanks or in Malay�s language we say �Terima Kasih� !!!
But when I tried Divya Shastry�s code by adding the elements from my database, it only shows the last element in the myVector�
11 years ago
hi..Could anyone tell me, how i can get the vector element individually. here is the code:

//this is the method to add the vector element. It is from the database
public Vector getPersonData(){
Vector myVectorAll=new Vector();
try{
this.dbConnection();
String sql="select name,email from personal order by name";
PreparedStatement prepareStmt=con.prepareStatement(sql);
ResultSet rs=prepareStmt.executeQuery();
while(rs.next()){
Vector myVector=new Vector();
myVector.addElement(rs.getString(1));// 1st data
myVector.addElement(rs.getString(2));// 2nd data
myVectorAll.addElement(myVector);
}
rs.close();
prepareStmt.close();
}catch(Exception ex){
System.out.println(ex.getMessage());
}
return myVectorAll;
}

//at main method
public static void main(String[] args){
CayukPah pah=new CayukPah(); //I created the object of the class
pah.dbConnection();

Vector p_vektor=new Vector();//create the new vector
p_vektor=pah.getPersonData(); //access the vector from the //getPersonData()
for(int i=0;i<p_vektor.size();i++){
System.out.println("Nama: "+p_vektor.elementAt(i));
System.out.println("Email: "+p_vektor.elementAt(i));
System.out.println("\n");
}
}

//After compile and run I got the result:
Nama: [apau, musyi@gmail.com]
Email: [apau, musyi@gmail.com]

Nama: [azlan, azlan@azlan.com]
Email: [azlan, azlan@azlan.com]

//Actually I want the output to be like this:
Name : apau
Email : musyi@gmail.com

//i tried to used split funtion but i am stuck with it. i used split(",") //and i got
Value:[apau
Value: apau @gmail.com]

Thanks in advance for any hints
Regards
-paoh-
11 years ago
hi..My problem is already settle just now. Thank you to Anuar for telling me that I need to put the mysql driver at library folder application server. A simple configuration, but I just know it..hehe..b4 this I put the mysql driver at my own folder..Tq, arigato and terima kasih =)
Hi =)
i got an exception on javax.enterprise.resource.resourceadapter..
I�m very new in j2ee and and my java actually not too strong where I�m more familiar with PHP..Actually I�m doing an exercise on creating BMP entity beans.

Before this I tried tutorial NetBeans IDE 5.0 Quick Start Guide for J2EE Applications (it use 1 CMP entity beans,1 Session Beans, a servlet page), and it running successfully..So after that, I try to create my own simple application just same like the tutorial. Only I changed to BMP entity beans and my own database(mysql).. I think, I don't have any problem with my code because I can deployed it well and do not have coding error.

After I run the application, it can show my servlet page, but when I submitted my data which is only 1 data I got an exception javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 9998 Maybe; nested exception is bla bla..

then I checked at Search Log Files, where actually this exception is coming from exception on javax.enterprise.resource.resourceadapter. The Details:

Logger:javax.enterprise.resource.resourceadapter
Name-Value Pairs:ThreadID=15;_ThreadName=httpWorkerThread-8080-0;_RequestID=077791dd-98d1-475d-a747-479bf057fa34;
Record Number:534
Message ID:RAR5099
Complete Message:
Wrong class name or classpath for Datasource Object : {0}
java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:697)
at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:595)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:216)
at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:83)
at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:83)
at com.sun.enterprise.resource.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:56)
at com.sun.enterprise.resource.AbstractResourcePool.createResourceAndAddToPool(AbstractResourcePool.java:1263)
at com.sun.enterprise.resource.AbstractResourcePool.createSteadyResources(AbstractResourcePool.java:596)
at com.sun.enterprise.resource.AbstractResourcePool.initPool(AbstractResourcePool.java:186)
at com.sun.enterprise.resource.AbstractResourcePool.internalGetResource(AbstractResourcePool.java:362)
at com.sun.enterprise.resource.AbstractResourcePool.getResource(AbstractResourcePool.java:289)
at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:248)
at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:174)
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:312)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:222)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:152)
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:145)
at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:93)
at ejb.ThePersonBean.makeConnection(ThePersonBean.java:126)
at ejb.ThePersonBean.selectByPrimaryKey(ThePersonBean.java:196)
at ejb.ThePersonBean.ejbFindByPrimaryKey(ThePersonBean.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
at com.sun.ejb.containers.EntityContainer.invokeFindByPrimaryKey(EntityContainer.java:756)
at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:220)
at $Proxy38.findByPrimaryKey(Unknown Source)
at ejb.IOPersonBean.getPersonInfola(IOPersonBean.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:107)
at $Proxy41.getPersonInfola(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:200)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:119)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:197)
at ejb._IOPersonRemote_DynamicStub.getPersonInfola(_IOPersonRemote_DynamicStub.java)
at web.PersonInformation.processRequest(PersonInformation.java:42)
at web.PersonInformation.doGet(PersonInformation.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)


could you help me out or have any idea?..i tried configure it for almost 3 week =(
Thanks in advance for any hints
Regards
-paoh-