File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Not retrieving from the Java Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Not retrieving from the Java Bean" Watch "Not retrieving from the Java Bean" New topic

Not retrieving from the Java Bean

Zoram Paul
Ranch Hand

Joined: Jul 10, 2007
Posts: 59

I have this code


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:


But the output it shows was:

The URL:

which seems its not retrieving anything,

Please help
Thank you

[BPSouther: Added code tags]
[ July 26, 2007: Message edited by: Ben Souther ]

ZORAM<br />"If it's true that we are here to help others,<br />then what exactly are the others here for?"
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Where is the that first block of code?
Is it in a bean, a servlet, a scriptlet on another page?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
It looks like you are using Struts and setting a property in an Action Form

The action for is not automatically in pageScope
<jsp:useBean id="urlBean" scope="page" class="examples.simple.GenerateUrlBean" />
<jsp:setProperty name="urlBean" property="url" />


The useBean, because the GenerateUrlBean is not found in the pageScope creates one with a default constructor. When you try to set the url property, there is no property in the request called 'url' so it sets a blank String to the url property of the GenerateUrlBean.
I agree. Here's the link:
subject: Not retrieving from the Java Bean
It's not a secret anymore!