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

