How to get data from JSP to Action class by id instead of property in Struts 2?

后端 未结 3 1704
臣服心动
臣服心动 2021-01-24 05:03

I am doing on Java Struts 2 framework.

Normally, I can get data from my JSP through the get set method in Form.java (action class). Below is my example :

相关标签:
3条回答
  • 2021-01-24 05:36

    You can use <s:textfield name="campaignName" size="50" maxlength="50" /> and add struts tag to your jsp ( at the top ):

    <%@ taglib prefix="s" uri="/struts-tags"%>
    
    0 讨论(0)
  • 2021-01-24 05:51
    <s:textfield name="campaignName" size="50" maxlength="50" />    
    

    or

    <input type="text" name="campaignName" size="50" maxlength="50" />
    

    The name need to be matched with the field name

    0 讨论(0)
  • 2021-01-24 05:56

    The simple usage of that textbox is to use s:textfield tag.

    <s:textfield name="campaignName" size="50" maxlength="50" />
    
    0 讨论(0)
提交回复
热议问题