I have a form which the user fills with its details & the same form is visible to the admin in the disable mode. Also there are few fields the admin can edit according to its role. So basically in the admin mode there are two buttons to UPDATE & VIEW. I tried implementing it using a session variable opMode. And added a scriptlet in jsp according to the opMode the fields are visible. But here I had to COPY the same fields thrice. Example :
<% String opMode=(String)session.getAttribute("opMode");%>
<%if(opMode.equals("ADD")){ %>
<s:textfield name="caserecord.case_Name" label="Case Name." size="25" />
<%}%>
<%if((opMode.equals("VIEW")){ %>
<s:textfield name="caserecord.case_Name" label="Case Name." size="25" disabled="true"/>
<%}%>
<%if((opMode.equals("UPDATE")){ %>
<s:textfield name="caserecord.case_Name" label="Case Name." size="25" />
<%}%>
So is there a way in which I can use the same jsp for all the three tasks ie. ADD, VIEW & UPDATE without having to duplicate the fields.
Thanks in advance.