This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I am facing a weird problem with struts. I have a link on the first page of my application, clicking on which I invoke a action class. It connects to database, pulls out data populates a form bean and forwards to a jsp.
In the jsp, I am accessing the properties of the form bean and I am displaying. But when I run the same, all the values displayed are empty. However logs at action classes convey that data was fetched from database and is set into the form bean. I have set the scope of the bean to be request.
In the jsp are you getting the bean or you are getting the bean without the values? Note : If the bean doesn't not exits , then its creates one.What I guess is you are setting the bean in one scope and then trying to retrieve it back from some other scope , that might be the reason that you are getting the bean and not the values.
You can even look at the serverts which is being created out of your jsp for seeing as what actually is going.
"Java Buzz", you have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.
Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Be aware that accounts with invalid display names are removed.
Are you instantiating a new instance of your Action Form in your action code or are you using the form passed in as a parameter to the execute method? If you are instantiating a new form, then you have to save it as a request attribute with the same name defined in struts-config. A better option might be to change your action mapping and use the form passed in.