简体   繁体   中英

Struts 2 display tag/radio button

I had a working display tag radio button with the below code. Below is the code :

 <s:form action="deleteUser.action" method="post">
    <display:table id="conf" name="users" requestURI="viewUsers.action" pagesize="10">
        <display:column title="Edit" scope="request">
            <input type="radio" name="selectedUser" value="${conf.username}" onclick="getValue()" />
        </display:column>
        <display:column property="username" title="User Name" />
        <display:column property="email" title="Email" />
        <display:column property="role" title="Role" /></display:table><s:submit method="deleteUser" key="Delete User" align="center" />
</s:form>

I have upgraded strtus2-core-2.3.4.jar to strtus2-core-2.3.14.jar and some other jars. Now when I select a radio button and click "submit" I do not get the underlying value of the radio button instead I get ${conf.username} into my POJO field. Did anyone face this? Am I missing any libraries?

You could take a value from

<display:table uid="row" id="conf" name="users" requestURI="viewUsers.action" pagesize="10">
  <display:column title="Edit" scope="request">
    <input type="radio" name="selectedUser[%{#attr.row_rowNum - 1}]"  value="<s:property value="%{#attr.row.username}"/>" onclick="getValue()" />

to selectedUser list.

${} is for EL expressions to reference attributes that you haven't put into request or session, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM