struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zimmer, Robin (SSABSA)" <rob...@ssabsa.sa.gov.au>
Subject RE: form fields not showing in jsp after being set?
Date Fri, 09 Aug 2002 06:02:44 GMT
Go to bed! You can forward from action to another (if I am reading you
correctly). Plus the first bean should still still be alive on the request,
so you should have access to it in the seconds action. (if you see what I
mean).

-----Original Message-----
From: Bill Blackmon [mailto:bill.blackmon@verizon.net]
Sent: Friday, 9 August 2002 3:23 PM
To: Struts Users Mailing List
Subject: Re: form fields not showing in jsp after being set?


Thanks - that solved the problem. Unfortunately, I have 2 pages sharing the
same bean and action. So,
there are two 'states' sent to the action. The first form, 'memberOne' sees
the bean and is displayed
correctly. The second form, 'memberTwo', is also dependent on the same bean
and is called from/references the the same action. Unfortunately, the forms
are of different types though they share an  interface that I had hoped
would get around the problem. I can't for the life of me get this to behave
the way I need it to. What I really need to do is create and call another
action created for the second page from within the first action. Is this
possible? It's very late and I'm probably not explaining myself very well!
Maybe it'll solve itself after I go to sleep.

Your sites looks very helpful. I'm new at this and have not been very
successful with the tag libary at all, as you can see by my page. There are
very few good detailed examples with realistic code illustrating their usage
so them so I imagine your site will be helpful. Unfortunately, the learning
curve for Struts has placed me under a rather serious time constaint, so I'm
forced to go with what I know at times.

Thanks again,
Bill

----- Original Message -----
From: "Zimmer, Robin (SSABSA)" <robinz@ssabsa.sa.gov.au>
To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
Sent: Thursday, August 08, 2002 11:25 PM
Subject: RE: form fields not showing in jsp after being set?


> Bill, Large jsp file! As far as I can see, the form uses action
> /loadMemberOne. Now, by default the html:text tags will be looking for the
> form bean associated to the /loadMemberOne action in your action mappings.
I
> cannot see this, so I will leave it up to you to check that you have the
> right bean. I hope this fixes your problem.
>
> PS. As a tip, you may wish to look at the Struts layouts tag library to
help
> reduce the amount of html you are using. See
> http://struts.application-servers.com
>
> -----Original Message-----
> From: Bill Blackmon [mailto:bill.blackmon@verizon.net]
> Sent: Friday, 9 August 2002 12:44 PM
> To: Struts Users Mailing List
> Subject: Re: form fields not showing in jsp after being set?
>
>
> Like this - THANKS
> <%@ page language="java" %>
> <%@ page import="java.util.*" %>
> <%@ page import="com.egps.utils.*" %>
> <%@ page import="com.egps.factories.*" %>
> <%@ page import="com.egps.beans.*" %>
> <%@ page import="com.egps.forms.*" %>
> <%@ page import="com.egps.utils.*" %>
> <%@ taglib uri="/WEB-INF/app.tld"   prefix="app" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld"  prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld"  prefix="html" %>
> <%
>
> String state = (String) session.getAttribute(IConstants.STATE);
> System.out.println("MEMBERONE PAGE LOADED - STATE IS: " + state);
> if(state == null) {
>  System.out.println("MEMBER ONE - NO STATE - SETTING TO CREATE");
>  session.setAttribute(IConstants.STATE, "create");
> }
>
> ArrayList disciplineList = (ArrayList)
> session.getAttribute("DISCIPLINE_LIST");
> ArrayList AGPAMemberList = (ArrayList)
> session.getAttribute("AGPA_MEMBER_LIST");
> ArrayList membershipCategoryList = (ArrayList)
> session.getAttribute("MEMBERSHIP_CATEGORY_LIST");
>
> DisciplineBean db = null;
> AGPAMemberBean agpaBean = null;
> MembershipCategoryBean membershipBean = null;
>
> int id = 0;
> String description = "";
> int counter = 0;
> String sid = "";
> String checked = "";
> %>
> <app:checkLogon/>
> <html:base/>
> <html:html>
> <head>
>  <title>EGPS Member page 1</title>
> </head>
> <body bgcolor="white">
>
> <center>
> <jsp:include page="mainMenu.jsp" />
> </center>
> <html:errors/>
> <html:form action="/loadMemberOne">
> <html:hidden property="action" value="memberOne" />
>
> <table width=66%>
> <tr>
> <td>
> <h2>
>  <bean:message key="label.memberOneHeading"/>
> </h2>
> </td>
> </tr>
> <tr>
>  <th align="left">
>        <bean:message key="label.lastName"/>
>     </th>
> </tr>
> <tr>
>  <td>
>        <html:text property="lastName"  size="60" maxlength="60" />
>  </td>
> </tr>
> <tr>
>  <th align="left">
>        <bean:message key="label.firstName"/>
>     </th>
> </tr>
> <tr>
>  <td align="left">
>   <html:text property="firstName" size="60" maxlength="60" />
>  </td>
> </tr>
> <tr>
>  <th align="left">
>        <bean:message key="label.degree"/>
>     </th>
> </tr>
> <tr>
>  <td align="left">
>   <html:text property="degree" size="60" maxlength="60"/>
>  </td>
> </tr>
>
> </table>
>
> <br>
> <br>
> <table width=66%>
> <tr align="left">
>  <td colspan="3">
>   <bean:message key="label.mentalHealthDiscipline"/>
>  </td>
> </tr>
> <tr align="left">
> <%
> Iterator dit = disciplineList.iterator();
> counter = 0;
>
> while(dit.hasNext()) {
>  db = (DisciplineBean) dit.next();
>  description = db.getDescription();
>  id = db.getID();
>  checked = db.getChecked();
>  sid = String.valueOf(id);
>  counter++;
> %>
>  <td align="left" width=50%>
> <input type="checkbox" name="selDisciplineList" value="<%= sid %>"
> <%=checked%> > <%=description %>
>  </td>
> <%
>  if(counter == 2) {
>   counter=0;
> %>
>  <tr>
> <%
>  } // end if
> }
> %>
> </tr>
> </table>
> <table width=66%>
> <tr>
>  <td colspan="3">
>  <bean:message key="label.otherSpecify"/>
>  </td>
> </tr>
> <tr>
>  <td align="left" width=50%>
>       <html:text property="otherMentalHealthDiscipline" size="126"/>
>  </td>
> </tr>
> </table>
> <br>
> <br>
> <table width=66%>
> <tr align="left">
>  <td align="left" width=100%>
>   <bean:message key="label.licensure"/>
>  </td>
> </tr>
> <tr align="left">
>  <td align="left" width=100%>
>       <html:text property="licensure" size="24" maxlength="24"/>
>  </td>
> </tr>
> </table>
> <br>
> <br>
>
> <table width=66%>
> <tr align="left">
> <td colspan="3"><bean:message key="label.AGPAMembership"/></td>
> </tr>
> <!-- insert new list here -->
> <%
> %>
> <tr align="left">
> <%
>
> Iterator ait = AGPAMemberList.iterator();
> counter = 0;
> while(ait.hasNext()) {
>  agpaBean = (AGPAMemberBean) ait.next();
>  description = agpaBean.getDescription();
>  id = agpaBean.getID();
>  // convert id to String
>  sid = String.valueOf(id);
>  checked = agpaBean.getChecked();
>  counter++;
> %>
>  <td align="left" width=50%>
>   <input type="checkbox" name="selAGPAList" value="<%= sid %>"
<%=checked%>
> > <%= description %>
>  </td>
> <%
>  if(counter == 2) {
>   counter=0;
> %>
>  <tr>
> <%
>  } // end if
> }
> %>
> </tr>
> </table>
> <br>
> <br>
>
>
>
> <table width=66%>
> <tr align="left">
> <td colspan="3">
>  <bean:message key="label.membershipCategory"/>
> </td>
> </tr>
>
> <tr align="left">
> <%
> Iterator mit = membershipCategoryList.iterator();
> counter = 0;
> while(mit.hasNext()) {
>  membershipBean = (MembershipCategoryBean) mit.next();
>  description = membershipBean.getDescription();
>  id = membershipBean.getID();
>  // convert id to String
>  sid = String.valueOf(id);
>  checked = membershipBean.getChecked();
>  counter++;
> %>
>  <td align="left" width=50%>
>   <input type="checkbox" name="selMembershipList" value="<%= sid %>"
> <%=checked%> > <%= description %>
>  </td>
> <%
>  if(counter == 2) {
>   counter=0;
> %>
>  <tr>
> <%
>  } // end if
> }
> %>
> </tr>
> </table>
>
>
> <table width=66%>
> <tr align="left">
>  <td align="left" width=100%>
>   <bean:message key="label.joinDate"/>
>   <html:text property="joinDateString" size="8" maxlength="8"/>
>
>  </td>
> </tr>
> </table>
> <br>
>
> <table align="left" width=66%>
> <tr>
>  <td><bean:message key="label.addresses"/></td>
> <tr>
>  <td>
>  <bean:message key="label.homeAddress"/>
>  </td>
> </tr>
> <tr>
>  <td>
>   <html:text property="homeAddress" size="100" maxlength="126"/>
>  </td>
> </tr>
> <tr>
>  <td>
>  <bean:message key="label.officeAddressOne"/>
>  </td>
> </tr>
> <tr>
>  <td>
>
>  </td>
> </tr>
> <tr>
>  <td>
>   <html:text property="officeAddressOne" size="100" maxlength="126"/>
>  </td>
> </tr>
> <tr>
>  <td>
>  <bean:message key="label.officeAddressTwo"/>
>  </td>
> </tr>
> <tr>
>  <td>
>   <html:text property="officeAddressTwo" size="100" maxlength="126"/>
>  </td>
> </tr>
> <tr>
>  <td>
>  <bean:message key="label.locations"/>
>  </td>
> </tr>
> <tr>
>  <td>
>   <bean:message key="label.home"/>
>   &nbsp;
>  <input type="checkbox" name="homeAddressOnePub"
> value="homeAddressPub">&nbsp;
>   <bean:message key="label.officeOne"/>
>   &nbsp;
>  <input type="checkbox" name="officeAddressOnePub"
> value="officeAddressOnePub">&nbsp;
>   <bean:message key="label.homeOffice"/>
>   &nbsp;
>    <input type="checkbox" name="officeAddressTwoPub"
> value="officeAddressTwoPub">
>  </td>
> </tr>
>
> <tr>
>  <td>
>   <bean:message key="label.mailing"/>
>  </td>
> </tr>
> <tr>
>  <td>
>  <bean:message key="label.home"/>&nbsp;
>   <input type="checkbox" name="homeAddressMailing"
> value="homeAddressMailing">&nbsp;
>  <bean:message key="label.officeOne"/>&nbsp;
>   <input type="checkbox" name="officeAddressOneMailing"
> value="officeAddressOneMailing">&nbsp;
>  <bean:message key="label.officeTwo"/>&nbsp;
>   <input type="checkbox" name="officeAddressTwoMailing"
> value="officeAddressTwoMailing">
>  </td>
> </tr>
>
>
> <tr align="middle">
>  <td>
>  <html:submit property="submit" value="Submit"/>
>  <html:reset value="Cancel"/>
>  </td>
> </tr>
> </table>
>
>  <!-- THESE DON'T MAKE ANY DIFFERENCE - USED ON OTHER PAGE -->
> <html:hidden property="faxHome" value="" />
> <html:hidden property="faxOffice" value="" />
> <html:hidden property="faxHomePub" value="" />
> <html:hidden property="faxOfficePub" value="" />
> <html:hidden property="faxHomeOfficePub" value="" />
> <html:hidden property="emailHome" value="" />
> <html:hidden property="emailOffice" value="" />
> <html:hidden property="emailHomeOffice" value="" />
> <html:hidden property="emailHomePub" value="" />
> <html:hidden property="emailOfficePub" value="" />
> <html:hidden property="emailHomeOfficePub" value="" />
> <html:hidden property="web" value="" />
> <html:hidden property="webPub" value="" />
> <html:hidden property="mobile" value="" />
> <html:hidden property="mobilePub" value="" />
> <html:hidden property="pager" value="" />
> <html:hidden property="pagerPub" value="" />
> <html:hidden property="affiliation" value="" />
> <html:hidden property="privatePractice" value="" />
>
>
> </html:form>
> </body>
> </html:html>
>
> ----- Original Message -----
> From: "Zimmer, Robin (SSABSA)" <robinz@ssabsa.sa.gov.au>
> To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
> Sent: Thursday, August 08, 2002 11:13 PM
> Subject: RE: form fields not showing in jsp after being set?
>
>
> > What does your jsp look like?
> >
> > -----Original Message-----
> > From: Bill Blackmon [mailto:bill.blackmon@verizon.net]
> > Sent: Friday, 9 August 2002 12:09 PM
> > To: Struts Users Mailing List
> > Subject: form fields not showing in jsp after being set?
> >
> >
> > I have an a large amount of input across two separate jsp pages that is
> set
> > by one bean. I'm able to write the information
> > from both pages correctly but I'm having difficulties reading the bean
and
> > then repopulating the two pages separately in order
> > to allow editing. Given the following definitions and code, I can't get
> the
> > values set in the forms to show in the pages. I'm not
> > getting any error messages, just blanks.....
> >
> >   <form-bean name="memberOneForm" type="com.egps.forms.MemberOneForm"/>
> >
> > <action
> >   path="/editMember"
> >   name="memberOneForm"
> >   scope="request"
> >   input="/membersList.jsp"
> >   type="com.egps.actions.EditMemberAction"
> >   validate="false">
> >   <forward name="Success" path="/memberOne.jsp"/>
> >  </action>
> >
> > public class EditMemberAction extends Action {
> >
> >  public ActionForward execute(ActionMapping mapping, ActionForm form,
> >    HttpServletRequest request, HttpServletResponse response) throws
> > Exception {
> >
> >    String action = "";
> >    HttpSession session = null;
> >    session = request.getSession(true);
> >    DBConnection con = null;
> >    int memberID = 0;
> >
> >    String sID = request.getParameter("memberID");
> >    Integer Int = new Integer(sID);
> >    memberID = Int.intValue();
> >    session.setAttribute(IConstants.STATE, "edit");
> >
> > System.out.println("EDIT MEMBER ACTION....");
> >
> >    if(memberID > 0) {
> >
> >     try {
> >              con = DBCommandFactory.getConnection();
> >              MemberBean memberBean =
> MemberCommandFactory.searchReturn(con,
> > memberID);
> >              session.setAttribute(IConstants.CURRENT_MEMBER_BEAN,
> > memberBean);
> >              MemberOneForm memberOneForm = (MemberOneForm) form;
> >              memberOneForm.setLastName("aaarrrrgggghhhh");        //
> HAPPENS
> > IN FORM BUT NOT VISIBLE
> >              memberOneForm.setFirstName("bbbbbbrrraaggghhh!");    //
> HAPPENS
> > IN FORM BUT NOT VISIBLE
> >              LoadLookupsFactory.setMemberLookups(con, memberID);
> >         // THE VALUES IN THE BEAN COPIED TO THE FORM ARE NOT VISIBLE IN
> THE
> > JSP THOUGH
> >         // THE SETTERS IN THE FORM ARE BEING CALLED IN THE TWO METHODS
> ABOVE
> >              PropertyUtils.copyProperties(memberOneForm, memberBean);
> >     }catch(EGPSCommandException e) {
> >      System.out.println("EditMemberAction ERROR: " + e.getMessage());
> >      e.printStackTrace();
> >     } finally {
> >      if(con != null) {
> >       try {
> >        con.close();
> >       }catch(Exception e) {}
> >      } // end if
> >     } // end try/catch
> >    }
> > }
> >    return mapping.findForward(IConstants.SUCCESS_KEY);
> >  } // end execute()
> >
> >
> > Thanks,
> > Bill
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message