Struts 1: Access form values ​​using bean: write

Hi,

This is a simple question that I consider, but, nevertheless, it is now attacking me.

I have a TestForm class with your usual getters / seters ... for example, I have an id field with the getId and setId methods.

My form is filled out correctly in the action class (which I know by going through the Eclipse debugger) just before submitting to the jsp page, which has the following code:

<html:form action="/AppropriateAction">  
<bean:define id="testFormA" name="TestForm" type="com.whatever.form.TestForm" />

form = <bean:write name="testFormA" />##  
id = <bean:write name="testFormA" property="id" />##  

</html:form>  

My conclusion is as follows:

form = com.whatever.form.TestForm13a3x4 ##

id = ##

Now I know that the page can see the form correctly because of the first line of output, but if it is, then why id shows that it is empty from this statement:

id = <bean:write name="testFormA" property="id" />##  

What am I doing wrong to access the id field of my form on this jsp page?

!

+3
1

bean: . :

form: <bean:write name="TestForm"/>##
id = <bean:write name="TestForm" property="id" />

,

+4

Source: https://habr.com/ru/post/1768234/


All Articles