-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: null value pass to .jsp--> .java --> .jsp page
PostPosted: Tue Apr 06, 2004 8:32 am 
Beginner
Beginner

Joined: Wed Mar 24, 2004 8:43 am
Posts: 42
hi

this is first .jsp code( productmodify.jsp)


<tr>
<td><%= a%></td> <td><%= b%></td> <td><%= c%></td> <td><a href='productmodify.action?oid=<%= oid%>'> modify </a></td> </tr>



here is the properties file

productmodify.action=ProductModify
productmodify.success=/WEB-INF/views/productmod.jsp

package test.hibernate.actions;

import java.util.List;

import webwork.action.ActionSupport;
import webwork.action.CommandDriven;
import net.sf.hibernate.Session;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.cfg.Configuration;
import net.sf.hibernate.HibernateException;
import test.hibernate.util.SessionManager;
import test.hibernate.data.Product;

public class ProductModify extends ActionSupport{
private List products1;
private String oid;

public List getProducts() {
return products1;
}


public String getOid() {
return oid;
}

public void setOid(String oid) {
this.oid = oid;
}


public String doExecute() {
try {


Configuration cfg=new Configuration().addClass(test.hibernate.data.Order.class).addClass(test.hibernate.data.OrderItem.class).addClass(test.hibernate.data.Product.class);
SessionFactory sf=cfg.buildSessionFactory();


Session sess=sf.openSession();
Product event = new Product();
//String s=event.getName();
products1 = sess.find("select product from product in class test.hibernate.data.Product " +" where product.id='"+ oid +"'");

sess.close();
System.out.println(""+ products1);
System.out.println(""+ oid);
System.out.println("yyes productModify class is existing ");
return SUCCESS;

} catch (HibernateException e) {
e.printStackTrace();
System.out.println("errorr");
return ERROR;
}
}


}



code from productmod.jsp

<%

test.hibernate.actions.ProductModify e=new test.hibernate.actions.ProductModify();
String s=e.doExecute();
System.out.println("mod execute is ="+ s); o/p is SUCCESS
java.util.List list=e.getProducts();
System.out.println("mod list.size()="+list); but the O/P is NULL
Iterator iter = list.iterator();


if(iter.hasNext()){

test.hibernate.data.Product p = (test.hibernate.data.Product) iter.next();
String oid=p.getId();
String a= p.getName();
double b=p.getPrice();
int c=p.getAmount();

%>



thx
gimhan

pls any one show me the error [/url][/b]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 7:02 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If ActionSupport extends Struts Action, then you must not have any attribute in this class.
There is only one Action instance for every requests

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.