This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Loading Data on Page load. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Loading Data on Page load." Watch "Loading Data on Page load." New topic

Loading Data on Page load.

Jobin Mathew
Ranch Hand

Joined: Oct 17, 2006
Posts: 83
I want to show some data in a jsp page using structs.
Let, It is a page to view user profile. No editing, just showing the details. SO no need of writing its form bean. Also I am navigating to this page by a hyperlink. So how can I load the data. Where do I write the code to initialize the DTO. Or please give me the correct steps for that.

Thanks in advance.
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
would be nice if you choose a correct name as we all do here...
[ October 24, 2006: Message edited by: Jan Groth ]
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
you do not accept private messages, so i cannot answer you privately.

the answer to this question of yours should explain our point...

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864

I know it seems like everyone is badgering you about this, but it really is an important part of the JavaRanch culture to give your real name, or at least give us a name that we can believe is your real name.

I'm afraid this policy is not optional. Failure to comply could cause your profile to be deleted without warning.

Consultant, Sima Solutions
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864

Thanks for taking the time to change your profile name. However, you're not quite there yet. The JavaRanch naming policy states that your profile must have a first and last name. If you for some reason just don't want us to know your last name, then make one up. All the policy says is that it has to be a believable last name.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I would still use a form bean (probably, it depends somewhat on what your DTO looks like and how much formatting you would need to do on the data). Say I had the form bean UserForm that had properties id, name, and age. I would create an action named DisplayProfile that would be configured to use UserForm. The URL would pass in the needed id ( In the execute method I would 1) cast form into UserForm, 2) get the id value from the UserForm, 3) pass the id into my business layer to retrieve the data, 4) populate the name and age fields on the UserForm, and 5) return the "success" forward.

- Brent
I agree. Here's the link:
subject: Loading Data on Page load.
Similar Threads
how to refresh the jsp page when onload?
Dealing with many page widget combinations.
Best way to load data file into an array
How to use struts to display initial data in JSP
Loading once with values onload