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
Author

Beginner Struts Problem (Solved)

John Sears
Greenhorn

Joined: Sep 15, 2009
Posts: 14
Hi,
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:


struts.xml


Here is the form code from the input class:
NameInput.jsp



Here is a relevant excerpt from the display class:
NameDisplay.jsp



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
Person.java


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

John Sears
Greenhorn

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



It works fine now.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

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
Author
Rancher

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
Greenhorn

Joined: Sep 15, 2009
Posts: 14
ah, thank you. I will give that a shot.
 
Don't get me started about those stupid light bulbs.
 
subject: Beginner Struts Problem (Solved)