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 ;))
(B...
(B  form.setName(student.getName ());
(B
(B
(B
(B
(B-
(BTo unsubscribe, e-mail: [EMAIL PROTECTED]
(BFor 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
(Breally easy to use purpose for your use case.
(B
(BI show you an sample code I use in my view I got :
(B
(B<%@ page session="true" %>
(B<%@ page import="org.apache.taglibs.display.test.TestList,
(B org.apache.taglibs.display.test.ListHolder,
(B java.util.List"%>
(B<%@ taglib uri="http://jakarta.apache.org/taglibs/display" prefix="display"
(B%>
(B<%@ taglib uri="/WEB-INF/struts-menu.tld" prefix="menu"%>
(B
(B
(B
(B
(B
(B
(B  
(B  
(B  
(B
(B
(B
(B
(B
(B
(B
(B
(BĀ 
(BĀ 
(BĀ 
(BĀ 
(BĀ 
(BĀ 
(B
(B
(B
(B  
(B  
(B  
(B  
(B  
(B  
(B  
(B  
(B  
(B  
(B  
(B  
(B
(B
(B
(B
(B
(BMy getstudent action :
(B
(B// Created by Xslt generator for Eclipse.
(B
(B// XSL : not found (java.io.FileNotFoundException: (Le chemin d'acces
(Bspecifie est introuvable))
(B
(B// Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xsl
(B
(Bpackage soft.ibmss.struts.action;
(B
(Bimport javax.servlet.http.HttpServletRequest;
(B
(Bimport javax.servlet.http.HttpServletResponse;
(B
(Bimport javax.servlet.http.HttpSession;
(B
(Bimport org.apache.struts.action.Action;
(B
(Bimport org.apache.struts.action.ActionForm;
(B
(Bimport org.apache.struts.action.ActionForward;
(B
(Bimport org.apache.struts.action.ActionMapping;
(B
(Bimport soft.ibmss.struts.form.StudentForm;
(B
(Bimport org.apache.struts.Globals;
(B
(Bpublic class GetstudentAction extends Action {
(B
(Bpublic ActionForward execute(
(B
(BActionMapping mapping,
(B
(BActionForm form,
(B
(BHttpServletRequest request,
(B
(BHttpServletResponse response)
(B
(Bthrows Exception {
(B
(B
(Btry {
(B
(Bform = buildStudent(request.getParameter("idPersonne"));
(B
(Bif (form == null) {
(B
(BSystem.out.println ("form nulle");
(B
(B}
(B
(Bif ("request".equals(mapping.getScope() )) {
(B
(Brequest.setAttribute(mapping.getAttribute(), form);
(B
(B}
(B
(Belse {
(B
(BHttpSession session = request.getSession();
(B
(Bsession.setAttribute(mapping.getAttribute(), form);
(B
(B}
(B
(B}
(B
(Bcatch (Exception ex) {
(B
(BSystem.out.println(ex.getMessage());
(B
(B}
(B
(Breturn mapping.findForward("success");
(B
(B}
(B
(Bpublic ActionForm buildStudent (String name) throws Exception {
(B
(B
(BStudent student = Student.getStudent (name);
(B
(Bform = new StudentForm ();
(B
(Bform.setIdPersonne (student.getName ());
(B
(Bform.setIdPersonne(student.getIdPerson ());
(B
(Bform.setName(rs.getString ("nom"));
(B
(B
(B
(Breturn form;
(B
(B
(B}
(B
(B
(B
(BI added in my struts-config :
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(B
(BThen I define an editstudent action to retrieve the updated data from
(B
(Bthe editstudent view page.
(B
(B--
(B
(BAlexandre Jaquet
(B
(B- Original Message -
(BFrom: "Karl" <[EMAIL PROTECTED]>
(BTo: "Struts Users Mailing List" <[EMAIL PROTECTED]>
(BSent: Wednesday, March 05, 2003 3:43 AM
(BSubject: Re: Design issue: forms and iterations on the same page
(B
(B
(BOops, just realized I used my mock-up page.  The part showing the list of
(Badministrators will of course use an iterate tag =)
(B
(B
(B2003 3$B7n(B 5 $B?eMKF|(B 11:39$B!"(BKarl $B$5$s$O=q$-$^$7$?(B:
(B> I'm trying to figure out a good design strategy for building a page that
(B> allows viewing, adding, editing, and deleting of administrators.
(B>
(B> At the top of the page I have the form itself:
(B>
(B>  name="AdministratorUserForm"
(B> type="com.somewhere.aproject.AdministratorUserForm">
(B> 
(B> 
(B> Name
(B> 
(B>  size="16"/>
(B> 
(B> 
(B> 
(B> Password
(B> 
(B>  maxlength="8" size="8"/>
(B> 
(B> 
(B> 
(B> 
(B> 
(B> 
(B> 
(B> 
(B> 
(B>
(B> Under that I want a list of existing administrators (there will probabl
(B> only be 5-10 admins, and definitely not more than 20):
(B>
(B> 
(B> 
(B> Name
(B> 
(B> 
(B> 
(B> me
(B> 
(B>   

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 
(Badministrators will of course use an iterate tag =)
(B
(B
(B2003 3$B7n(B 5 $B?eMKF|(B 11:39$B!"(BKarl $B$5$s$O=q$-$^$7$?(B:
(B> I'm trying to figure out a good design strategy for building a page that
(B> allows viewing, adding, editing, and deleting of administrators.
(B>
(B> At the top of the page I have the form itself:
(B>
(B>  name="AdministratorUserForm"
(B> type="com.somewhere.aproject.AdministratorUserForm">
(B> 
(B> 
(B> Name
(B> 
(B>  size="16"/>
(B> 
(B> 
(B> 
(B> Password
(B> 
(B>  maxlength="8" size="8"/>
(B> 
(B> 
(B> 
(B> 
(B> 
(B> 
(B> 
(B> 
(B> 
(B>
(B> Under that I want a list of existing administrators (there will probabl
(B> only be 5-10 admins, and definitely not more than 20):
(B>
(B> 
(B> 
(B> Name
(B> 
(B> 
(B> 
(B> me
(B> 
(B> 
(B>  href="screen_manage_administrators.do?num=0">EditĀ 
(B>  href="do_administrator_remove.do?num=0">Delete
(B> 
(B> 
(B> 
(B> 
(B> myself
(B> 
(B> 
(B>  href="screen_manage_administrators.do?num=1">EditĀ 
(B>  href="do_administrator_remove.do?num=1">Delete
(B> 
(B> 
(B> 
(B>
(B>
(B> If you enter in data that does not match an existing administrator name and
(B> submit it, it adds the administrator.
(B> If you click on the "edit" link of one of the administrators, it puts that
(B> admin's details into the edit form.
(B> If the administrator name matches an existing name, the data is updated.
(B> If you click on delete, it will ask confirmation and then delete the entry.
(B>
(B>
(B> My first question is:  Is it a good idea to be placing all of this
(B> functionality in one page, or should I be spreading it to other pages?
(B>
(B> My second question is: How would I implement such a layout in struts?
(B> I can associate a UserForm object with the form, but how would I interpret
(B> which administrator data to load into the edit form (via the argument
(B> "num")? Should I be making a separate form object to provide the list of
(B> administrators and then iterate over that list?  If so, how do I access 2
(B> different ActionForms within the same page?
(B> Would I be better off making an ActionForm that contains all of the data
(B> for the edit form as well as the collection of administrator data?
(B>
(B>
(B> Cheers!
(B>
(B> Karl
(B>
(B>
(B> -
(B> To unsubscribe, e-mail: [EMAIL PROTECTED]
(B> For additional commands, e-mail: [EMAIL PROTECTED]
(B
(B
(B-
(BTo unsubscribe, e-mail: [EMAIL PROTECTED]
(BFor additional commands, e-mail: [EMAIL PROTECTED]