Design issue: forms and iterations on the same page

2003-03-04 Thread Karl
I'm trying to figure out a good design strategy for building a page that 
allows viewing, adding, editing, and deleting of administrators.

At the top of the page I have the form itself:

html:form action="screen_manage_administrators.do" 
name="AdministratorUserForm" 
type="com.somewhere.aproject.AdministratorUserForm"
table
tr
thName/th
td
html:text property="userName"  maxlength="16" 
size="16"/
/td
/tr
tr
thPassword/th
td
html:password property="password"  maxlength="8" 
size="8"/
/td
/tr
tr
td
html:submit value="Set"/
/td
/tr
/table
/html:form

Under that I want a list of existing administrators (there will probabl only 
be 5-10 admins, and definitely not more than 20):

table
tr
thName/th
/tr
tr
td
me
/td
td
html:link 
href="screen_manage_administrators.do?num=0"Edit/html:linknbsp;
html:link 
href="do_administrator_remove.do?num=0"Delete/html:link
/td
/tr
tr
td
myself
/td
td
html:link 
href="screen_manage_administrators.do?num=1"Edit/html:linknbsp;
html:link 
href="do_administrator_remove.do?num=1"Delete/html:link
/td
/tr
/table


If you enter in data that does not match an existing administrator name and 
submit it, it adds the administrator.
If you click on the "edit" link of one of the administrators, it puts that 
admin's details into the edit form.
If the administrator name matches an existing name, the data is updated.
If you click on delete, it will ask confirmation and then delete the entry.


My first question is:  Is it a good idea to be placing all of this 
functionality in one page, or should I be spreading it to other pages?

My second question is: How would I implement such a layout in struts?
I can associate a UserForm object with the form, but how would I interpret 
which administrator data to load into the edit form (via the argument "num")?
Should I be making a separate form object to provide the list of 
administrators and then iterate over that list?  If so, how do I access 2 
different ActionForms within the same page?
Would I be better off making an ActionForm that contains all of the data for 
the edit form as well as the collection of administrator data?


Cheers!

Karl


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Design issue: forms and iterations on the same page

2003-03-04 Thread Karl
Oops, just realized I used my mock-up page.  The part showing the list of 
administrators will of course use an iterate tag =)


2003 3月 5 水曜日 11:39、Karl さんは書きました:
 I'm trying to figure out a good design strategy for building a page that
 allows viewing, adding, editing, and deleting of administrators.

 At the top of the page I have the form itself:

 html:form action="screen_manage_administrators.do"
 name="AdministratorUserForm"
 type="com.somewhere.aproject.AdministratorUserForm"
 table
 tr
 thName/th
 td
 html:text property="userName"  maxlength="16"
 size="16"/
 /td
 /tr
 tr
 thPassword/th
 td
 html:password property="password" 
 maxlength="8" size="8"/
 /td
 /tr
 tr
 td
 html:submit value="Set"/
 /td
 /tr
 /table
 /html:form

 Under that I want a list of existing administrators (there will probabl
 only be 5-10 admins, and definitely not more than 20):

 table
 tr
 thName/th
 /tr
 tr
 td
 me
 /td
 td
 html:link
 href="screen_manage_administrators.do?num=0"Edit/html:linknbsp;
 html:link
 href="do_administrator_remove.do?num=0"Delete/html:link
 /td
 /tr
 tr
 td
 myself
 /td
 td
 html:link
 href="screen_manage_administrators.do?num=1"Edit/html:linknbsp;
 html:link
 href="do_administrator_remove.do?num=1"Delete/html:link
 /td
 /tr
 /table


 If you enter in data that does not match an existing administrator name and
 submit it, it adds the administrator.
 If you click on the "edit" link of one of the administrators, it puts that
 admin's details into the edit form.
 If the administrator name matches an existing name, the data is updated.
 If you click on delete, it will ask confirmation and then delete the entry.


 My first question is:  Is it a good idea to be placing all of this
 functionality in one page, or should I be spreading it to other pages?

 My second question is: How would I implement such a layout in struts?
 I can associate a UserForm object with the form, but how would I interpret
 which administrator data to load into the edit form (via the argument
 "num")? Should I be making a separate form object to provide the list of
 administrators and then iterate over that list?  If so, how do I access 2
 different ActionForms within the same page?
 Would I be better off making an ActionForm that contains all of the data
 for the edit form as well as the collection of administrator data?


 Cheers!

 Karl


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Design issue: forms and iterations on the same page

2003-03-04 Thread alexj
You may have a look to the display tag lib who provide an
really easy to use purpose for your use case.

I show you an sample code I use in my view I got :

%@ page session="true" %
%@ page import="org.apache.taglibs.display.test.TestList,
 org.apache.taglibs.display.test.ListHolder,
 java.util.List"%
%@ taglib uri="http://jakarta.apache.org/taglibs/display" prefix="display"
%
%@ taglib uri="/WEB-INF/struts-menu.tld" prefix="menu"%

html
head
/head

body
  script language="JavaScript1.2" src="./scripts/coolmenus3.js"
  /script
  script src="./scripts/coolmenu-config.js"
/script

menu:useMenuDisplayer name="CoolMenu"
bundle="org.apache.struts.action.MESSAGE"
menu:displayMenu name="ToDoListMenuFile"/
menu:displayMenu name="ToDoListMenuEdit"/
menu:displayMenu name="CaseDetailMenuCase"/
/menu:useMenuDisplayer
p
pnbsp;/p
pnbsp;/p
pnbsp;/p
pnbsp;/p
pnbsp;/p
pnbsp;/p

display:table width="85%"align="left"
  name="students"
  scope="session"
  pagesize="5"
  requestURI="/ibmss/form/viewstudent.jsp"
  export="true"
  decorator="org.apache.taglibs.display.test.Wrapper"

  display:column property="idPersonne"
  title="ID"
  href="/ibmss/getstudent.do"
  paramId="idPersonne"
  paramProperty="idPersonne"  /
  display:column property="name" title="Nom"/
  display:column property="firstName" title="Prenom"/
  display:column property="adress" title="Adresse"/
  display:column property="city" title="Ville"/
  display:column property="npa" title="Npa"/
  display:column property="phoneNumber" title="Telephone"/
  display:column property="email" title="Email" autolink="true"/
  display:column property="insuranceName" title="Assurance"/
  display:column property="insuranceNumber" title="No assure"/
  display:column property="formationSelected" title="Formation"/
  display:column property="group" title="Groupe"/
/display:table

/body
/html

My getstudent action :

// Created by Xslt generator for Eclipse.

// XSL : not found (java.io.FileNotFoundException: (Le chemin d'acces
specifie est introuvable))

// Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xsl

package soft.ibmss.struts.action;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;

import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;

import soft.ibmss.struts.form.StudentForm;

import org.apache.struts.Globals;

public class GetstudentAction extends Action {

public ActionForward execute(

ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response)

throws Exception {


try {

form = buildStudent(request.getParameter("idPersonne"));

if (form == null) {

System.out.println ("form nulle");

}

if ("request".equals(mapping.getScope() )) {

request.setAttribute(mapping.getAttribute(), form);

}

else {

HttpSession session = request.getSession();

session.setAttribute(mapping.getAttribute(), form);

}

}

catch (Exception ex) {

System.out.println(ex.getMessage());

}

return mapping.findForward("success");

}

public ActionForm buildStudent (String name) throws Exception {


Student student = Student.getStudent (name);

form = new StudentForm ();

form.setIdPersonne (student.getName ());

form.setIdPersonne(student.getIdPerson ());

form.setName(rs.getString ("nom"));



return form;


}



I added in my struts-config :



action

attribute="studentForm"

name="studentForm"

path="/getstudent"

scope="request"

type="soft.ibmss.struts.action.GetstudentAction"

validat

Re: Design issue: forms and iterations on the same page

2003-03-04 Thread alexj
I made a little mistake in my code but it's not really important for you ;))
...
  form.setName(student.getName ());




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]