wood burning stoves 2.0
The moose likes Struts and the fly likes Beginner Struts Problem (Solved) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Beginner Struts Problem (Solved)" Watch "Beginner Struts Problem (Solved)" New topic

Beginner Struts Problem (Solved)

John Sears

Joined: Sep 15, 2009
Posts: 14
I am trying to learn some struts2, and am running into the following problem making a trivial web application: I want to use one jsp as a form, then pass the data on to an action class and have it available to print on a second jsp. My struts.xml file is:


Here is the form code from the input class:

Here is a relevant excerpt from the display class:

However, when I submit data from my form it doesn't get carried over. I have a check in my action class (world.hello.Person) that makes sure that the name and number values were set (and I can print them to the console). They are getting through--and so the success result is displaying.

Here is the code from the action class

If anyone has any input as to what I'm doing wrong, that would be incredible. My gut says that I need to somehow bind the Person to the http request (like how you would with a standard filter). Also, I switched to the <s:property> tag from just ${person.name} style because I didn't have a name for the parmater. Anyway, thanks in advance!


John Sears

Joined: Sep 15, 2009
Posts: 14
Never mind, I realized I needed to add

It works fine now.
Ankit Garg

Joined: Aug 03, 2008
Posts: 9462

Did you manually add struts-tags.tld fine in the WEB-INF directory?? You don't need to do that. You need to use a taglib directive like this

The struts tld file is in the struts jar file so it is not needed again in WEB-INF folder...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton

Joined: Sep 29, 2008
Posts: 12617

I marked as solved in the subject.

But Ankit is correct; it shouldn't be necessary to extract the TLD file.
John Sears

Joined: Sep 15, 2009
Posts: 14
ah, thank you. I will give that a shot.
I agree. Here's the link: http://aspose.com/file-tools
subject: Beginner Struts Problem (Solved)
It's not a secret anymore!