Here is a repost (from Oct 22) of some example code I developed that does exactly this.
--- Or you could have multiple mappings pointing to one action and one jsp. Each mapping would set a different value for the parameter, the action would use the parameter to set some beans, and the jsp would use the beans to control the output. As in the following code: ---------- struts-config.xml: <!-- Execute the Item Add action --> <action path="/itemAdd" type="com.myco.myapp.ItemLoadAction" name="itemForm" parameter="add" scope="session" validate="false"> <forward name="success" path="item.page"/> <forward name="failure" path="error.page"/> </action> <!-- Execute the Item Change action --> <action path="/itemChange" type="com.myco.myapp.ItemLoadAction" name="itemForm" parameter="change" scope="session" validate="false"> <forward name="success" path="item.page"/> <forward name="failure" path="error.page"/> </action> <!-- Execute the Item Inspect action --> <action path="/itemInspect" type="com.myco.myapp.ItemLoadAction" name="itemForm" parameter="inspect" scope="session" validate="false"> <forward name="success" path="item.page"/> <forward name="failure" path="error.page"/> </action> <!-- Execute the Item Delete action --> <action path="/itemDelete" type="com.myco.myapp.ItemLoadAction" name="itemForm" parameter="delete" scope="session" validate="false"> <forward name="success" path="item.page"/> <forward name="failure" path="error.page"/> </action> ---------- ItemLoadAction.java: String action = mapping.getParameter(); // set ACID properties if ("add".equals(action)) session.setAttribute("mode.form", "add"); if ("change".equals(action)) session.setAttribute("mode.form", "change"); if ("inspect".equals(action)) session.setAttribute("mode.form", "inspect"); if ("delete".equals(action)) session.setAttribute("mode.form", "delete"); // set view properties if ("delete".equals(action) || "inspect".equals(action)) session.setAttribute("mode.fields", "read"); else session.setAttribute("mode.fields", "update"); ---------- item.jsp: <tr> <td><bean:message key="item.date"/></td> <td align="left"> <logic:equal name="mode.fields" value="read"> <html:text property="date" disabled="true" maxlength = "8" size = "8"/> </logic:equal> <logic:equal name="mode.fields" value="update"> <html:text property="date" maxlength = "8" size = "8"/> </logic:equal> </td> </tr> <tr><td align="right"> <logic:equal name="mode.form" value="add"> <html:submit> <bean:message key="button.add"/> </html:submit> <html:submit> <bean:message key="button.cancel"/> </html:submit> </logic:equal> <logic:equal name="mode.form" value="change"> <html:submit> <bean:message key="button.update"/> </html:submit> <html:submit> <bean:message key="button.cancel"/> </html:submit> </logic:equal> <logic:equal name="mode.form" value="delete"> <bean:message key="warning.delete"/> <html:submit> <bean:message key="button.delete"/> </html:submit> <html:submit> <bean:message key="button.cancel"/> </html:submit> </logic:equal> <logic:equal name="mode.form" value="inspect"> <html:submit> <bean:message key="button.ok"/> </html:submit> </logic:equal> </td></tr> -----Original Message----- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 3:28 PM To: Struts User Mailing List Subject: Three JSPs in one Hi In my application I am currently performing add user, view user and edit user functions on separate JSPs. So I have: adduser.jsp to add users through a form viewuser.jsp to view a users details in plain text edituser.jsp to edit a users details in a populated form Instead of having three different pages I would like to perform these functions all on one page, the thing is I don't want to use any scriptlets on my page. Is there away of using the html-logic tags to test for which task I would like to perform, or some other method I can use to do this, I cant figure it out. Basically something that will do If(select view) { show details on page } else If(select edit) { show users details in a form for update } else { show form on page to add user } I was thinking some sort of logic <logic:present (view)> ..view details </logic:present> <logic:present (add)> ..view details </logic:present> <logic:present (edit)> ..view details </logic:present> Anybody done this before? Many Thanks Ciaran --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]