Merrill
Consultant, Sima Solutions
Merrill
Consultant, Sima Solutions
Merrill
Consultant, Sima Solutions
Merrill
Consultant, Sima Solutions
Merrill
Consultant, Sima Solutions
Merrill
Consultant, Sima Solutions
Can I pass my FormBean back & forth in request scope with out sending any hidden parameters from page to page in struts?
Merrill
Consultant, Sima Solutions
Merrill
Consultant, Sima Solutions
Merrill
Consultant, Sima Solutions
in step2.jsp:
<html:hidden property="eventType" value="page2" />
Merrill
Consultant, Sima Solutions
Merrill
Consultant, Sima Solutions
<logic:iterate id='relationships' name='relationshipForm'
property='relationshipDTOList' indexId='ctr1'>
<TR>
<TD>
<!-- creates the check box list -->
<html:multibox property='selectedAccountIds'>
<bean:write name='relationships' property='accountNumber' />
</html:multibox>
<bean:write name='relationships' property='accountNumber' />
</TD>
<TD align='center'>
<bean:write name='relationships' property='shortName' />
</TD>
</TR>
</logic:iterate>
<html:form action="/step2" name="relationshipForm" type="com.cwrwizard.beans.RelationshipForm">
<html:hidden property="selectedAccountIds " />
Should I have new set of get/set methods in the ActionForm bean for all the hidden fields I am passing through?
Merrill
Consultant, Sima Solutions
public String[] getSelectedAccountIds() {
return selectedAccountIds;
}
public void setSelectedAccountIds(String[] stringArray) {
selectedAccountIds = (String[]) stringArray;
}
public String getSeletctedAccountsString(){
String accountsIds = null;
StringBuffer acct = new StringBuffer();
if ( getSelectedAccountIds() != null && getSelectedAccountIds().length > 0 ){
for (int i=0; i<getSelectedAccountIds().length ; i++){
accountsIds = selectedAccountIds[i];
acct.append(accountsIds);
acct.append(",");
System.out.println("acct = " + acct);
}
}
return acct.toString();
}
public void setSeletctedAccountsString(String acctIds){
StringTokenizer st = new StringTokenizer(acctIds, ",");
ArrayList selectedAccounts = new ArrayList();
try{ while (st.hasMoreTokens()) {
System.out.println("Tokens " + st.nextToken());
} }catch (Exception e){
}
}
Merrill
Consultant, Sima Solutions
Merrill
Consultant, Sima Solutions
public void setSeletctedAccountsString(String acctIds){
//selectedAccountIds = acctIds.s
StringTokenizer st = new StringTokenizer(acctIds, ",");
try{
if (acctIds == null || acctIds.length() == 0) {
selectedAccountIds = new String[0];
}
for (int i=0; i < st.countTokens(); i++){
selectedAccountIds[i] = st.nextToken();
System.out.println("Tokens values" + selectedAccountIds[i]);
}
}catch (Exception e){
}
}
Merrill
Consultant, Sima Solutions
The biggest problem I saw was in your struts-config.xml file. You had defined step 1 with a scope of session, and all the other steps with a scope of request. All the steps must be in the same scope, whether it's session or request. This would have caused the problem you were experiencing. Go ahead and make that change and see if that fixes it.
Merrill
<html:hidden property="seletctedAccountsString" />
Merrill
Consultant, Sima Solutions
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|