• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beginner Struts Problem (Solved)

 
John Sears
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind, I realized I needed to add



It works fine now.
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I marked as solved in the subject.

But Ankit is correct; it shouldn't be necessary to extract the TLD file.
 
John Sears
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ah, thank you. I will give that a shot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic