The JSP:
<s:form action = "addfriend">
<s:property value="Username" />
<s:submit value="Add friend" />
</s:form>
Does this code submit the value in the <s:property> tag to the action form?
The JSP:
<s:form action = "addfriend">
<s:property value="Username" />
<s:submit value="Add friend" />
</s:form>
Does this code submit the value in the <s:property> tag to the action form?
No, <s:property> tag doesn't generate input fields. Merely description of the <s:property> tag you can find here. It's used to print the value from the value stack to JSP output. To submit the value to the action the form needs to have a tag which generate a HTML <input> tag or <textarea> tag. That's what the <s:textfield> tag provides.
<s:textfield name="Username" value="%{Username}"/>
Note, there are many other tags that generate input fields, you can see the output generated in HTML browser source window.
If you need to send a value that is displayed through s:property, simply add an s:hidden field to it:
<s:form action = "addfriend">
<s:hidden name = "Username" />
<s:property value = "Username" />
<s:submit value = "Add friend" />
</s:form>
Remember, if a tag doesn't have the name attribute, it won't be posted to the Action.
Also avoid variables starting with an uppercase letter: username would be mapped to setUsername and getUsername, but Username could create problems, and is not standard.
As already pointed by @Roman, here's the code :
You can do :
<s:form action="addfriend">
<s:textfield name="Username"/>
<s:submit value="Add friend" />
</s:form>