Not retrieving from the Java bean

Sir,

I have this code

try{

connect conn=new connect();

con=conn.createConnection();

String pattern="Noun Verb Noun";

String[] arPat=pattern.split(" ");

System.out.println("Len : "+arPat.length);

for(int i=0;i<arPat.length;i++)

{

sql="Select category_id from m_word_category where category_name='"+arPat[i]+"'";

System.out.println("SQL : "+sql);

Statement stmt=con.createStatement();

rs=stmt.executeQuery(sql);

rs.next();

int g_id=rs.getInt(1);

sql1="Select word_text from m_word_list where category_id="+g_id;

System.out.println("SQL1 : "+sql1);

ArrayList holdWords=new ArrayList();

Statement stmt1=con.createStatement();

rs1=stmt1.executeQuery(sql1);

while(rs1.next())

holdWords.add(rs1.getString("word_text"));

System.out.println("Actual Sentences : "+holdWords);

int rand=0;

while(true)

{

rand=(int)(Math.random()*100);

if(rand>holdWords.size())

{

continue;

}

else

{

dWord+=holdWords.get(rand);

System.out.println("Actual words : "+dWord);

break;

}

}

}

GenerateUrlBean sp = (GenerateUrlBean)form;

sp.seturl(dWord);

System.out.println("The generated Url is:"+sp.geturl());

return mapping.findForward("success");

}

catch(Exception e)

{

System.out.println("The Exception is:"+e);

return mapping.findForward("failure");

}

On another page I tried to retrieve the data 'dWord' which i set in the bean

The code I used in the second page was:

<jsp:useBean id="urlBean" scope="page" class="examples.simple.GenerateUrlBean" />

<jsp:setProperty name="urlBean" property="url" />

<tr>

<td>

<%

out.println("The URL: "+urlBean.geturl());

%>

</td>

</tr>

But the output it shows was:

The URL:

which seems its not retrieving anything,

Please help

Thank you

[3540 byte] By [Zorama] at [2007-11-27 11:47:51]
# 1

Help!

Help!

Help!

Help!

Help!

Help!

Help!

Help!

Zorama at 2007-7-29 18:15:38 > top of Java-index,Java Essentials,Java Programming...
# 2

Is it a dead thread?

Zorama at 2007-7-29 18:15:38 > top of Java-index,Java Essentials,Java Programming...
# 3

> Is it a dead thread?

Relax.

Okay, so you create a GenerateUrlBean in your JSP and call the getUrl() method. When does the value that getUrl() is supposed return get set?

~

yawmarka at 2007-7-29 18:15:38 > top of Java-index,Java Essentials,Java Programming...
# 4

Set the value in the bean:

GenerateUrlBean urlBean = new GenerateUrlBean();

urlBean.setUrl(rs1.getString("word_text"));

holdWords.add(urlBean);

skp71a at 2007-7-29 18:15:38 > top of Java-index,Java Essentials,Java Programming...