struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- Data Sources -->
<data-sources></data-sources>
<!-- Form Beans -->
<form-beans>
<form-bean name="loginForm" type="classpath.LoginForm">
<display-name>loginForm</display-name>
</form-bean>
<form-bean name="wbasPropsForm"
type="gov.nyc.fisa.wbas.form.WBasCodesPropsForm">
</form-bean>
</form-beans>
<global-exceptions>
</global-exceptions>
<!-- Global Forwards -->
<global-forwards>
<forward name="Login" path="/Login.jsp"></forward>
<forward name="Home" path="/Home.jsp"></forward>
<forward name="Exceptions" path="/Exceptions.jsp"></forward>
<forward name="AnnuityCodes" path="/AnnuityCodes.jsp"></forward>
<forward name="Misc" path="/Misc.jsp"></forward>
<forward name="WelfareBenefitsCodesEdit"
path="/Home.jsp"></forward>
<forward name="WelfareBenefitsCodes"
path="/WBasCodes.do"></forward>
<forward name="SearchFunds" path="/WelfareCodes.jsp"></forward>
</global-forwards>
<!-- Action Mappings -->
<action-mappings>
<action path="/Login" type="classpathLoginAction"
name="loginForm"
input="/Login.jsp" ></action>
<action path="/Menu" type="classpath.MenuAction"></action>
<action path="/SearchFunds" type="classpath.SearchFundsAction"
name="wbasPropsForm" scope="request" input="/WelfareCodes.jsp">
</action>
<action path="/FundsNavigation"
type="gov.nyc.fisa.wbas.action.FundsNavigationAction" name="wbasPropsForm"
scope="request" input="WelfareCodes.jsp">
<forward name="WelfareBenefits"
path="/WelfareCodes.jsp"></forward>
</action>
<action path="/WBasCodes" type="classpath.WBasCodesAction"
name="wbasPropsForm" scope="request" input="/WelfareCodes.jsp">
</action>
</action-mappings>
<!-- Message Resources
message-resources parameter="classpath.ApplicationResources"/> -->
</struts-config>
Thank's
Eugene
--------------------------------------------------------
Alberto A. Flores wrote:
>
> I think you forgot struts-config.xml
>
> piterskiy wrote:
>> Ok, it is going to be a lot of text
>> :working:
>>
>> If you stil can help me after seeing all these codes, I would really
>> appriciate it.
>>
>> Here is the process flow
>> for the search: jsp --> SearchFundsAction --> jsp
>> for naviation: jsp --> NavigateFundsAction --> jsp
>> for edit or view: jsp --> WBasCodesAction --> jsp
>>
>> To differentiate the text: names of files and files separators are bold
>> will
>> be bold
>>
>> I have the followin jsp:
>>
>> WBasBody.jsp
>>
>> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
>>
>> <jsp:useBean id="menu" class="someclasspath.navigation.Menu"
>> scope="session"/>
>> <jsp:useBean id="wbasPropsForm" class="someclasspath.WBasCodesPropsForm"
>> scope="request"/>
>> <jsp:useBean id="view" class="someclasspath.SearchFundColViewVO"
>> scope="session"/>
>> <jsp:useBean id="sView" class="someclasspath.WBasPropertyVO"
>> scope="request"/>
>>
>> <%
>> String mode = wbasPropsForm.getMode();
>>
>> String error = (String) request.getAttribute("error");
>> boolean editAllowed =
>> menu.findScreenAccessLevelByName("WelfareBenefitsCodesEdit")>0;
>> String label = "";
>> String action = "";
>> String results = "";
>>
>> int total = view.getSize();
>> int displayStart = view.getMiniStart();
>> int displaySize = view.getMiniSize();
>> int displayRows = view.getDisplayRows();
>>
>> if(displayStart + displaySize > total)
>> displaySize = total - displayStart;
>> if (mode==null) mode = "";
>>
>> out.println("DisplaySize: " + displaySize);
>> out.println(" TotalSize: " + total);
>> out.println(" DisplayStart: " + displayStart);
>> out.println(" Display Rows: " + displayRows);
>> %>
>>
>>
>> <!-- JAVASCRIPT VALIDATION ROUTINS -->
>> <SCRIPT language="javascript" src=theme/validations.js></SCRIPT>
>> <SCRIPT>
>>
>> function doPrev()
>> {
>> frm = document.forms['wbasPropsForm'];
>> frm.operation.value = 'prev';
>> frm.action = 'FundsNavigation.do';
>> frm.submit();
>>
>> }
>>
>> function doNext()
>> {
>> frm = document.forms['wbasPropsForm'];
>> frm.operation.value = 'next';
>> frm.action = 'FundsNavigation.do';
>> frm.submit();
>>
>> }
>>
>> function doZoom(val,val2,val3)
>> {
>> frm = document.forms['wbasPropsForm'];
>>
>> frm.zoomKey.value = val;
>> frm.countyCode.value = val2;
>> frm.effDate.value = val3;
>> alert (frm.effDate.value);
>> frm.operation.value = "zoom";
>> frm.action='WBasCodes.do';
>> frm.submit();
>> }
>>
>> function doSearch(val)
>> {
>> frm = document.getElementById("wbasPropsForm");
>> //frm.operation.value = "search";
>>
>>
>> if (checkForm(val))
>> {
>> frm.submit();
>> }
>> }
>>
>> function doSave(val)
>> {
>> frm = document.forms['wbasPropsForm'];
>> frm.operation.value = "Save";
>>
>> if (checkForm(val))
>> {
>> frm.submit();
>> }
>> }
>>
>> function doAdd(val)
>> //isSubmit indicates the mode:
>> //if isSubmit is false we present "Add New Fund" screen to users
>> //if isSubmit is true we submit the form to actually add a fund record
>> {
>> frm = document.forms['wbasPropsForm'];
>> frm.operation.value = val;
>>
>> frm.action = 'WBasCodes.do';
>> if (val == "preAdd")
>> {
>> frm.submit();
>> }
>> else if(checkForm(val))
>> {
>> frm.submit();
>> }
>> }
>> </SCRIPT>
>>
>> <table bgcolor="#d5ddff" width="100%" cellpadding=0 border=0
>> cellspacing=0>
>> <TR><TD width="100%" background="images/Beige.gif"
>> style="font-size:10px"> </TD></TR>
>> <tr><td class="spacer4"> </td></tr>
>> <tr><td class="screenTitle" align="center">Welfare Benefits
>> Codes</td></tr>
>> <tr><td align="center"></td></tr>
>> <tr><td> </td></tr>
>> <tr><td align="center">
>>
>> <table class="searchBox" cellspacing=2 cellpadding=2>
>> <html:form styleId="wbasPropsForm"
>> focus="strFundCode"
>> action="SearchFunds.do">
>> <html:hidden property="operation"
>> value="search"/>
>> <html:hidden property="zoomKey"/>
>> <html:hidden property="countyCode"/>
>> <html:hidden property="effDate"/>
>> <html:hidden property="startingRec"/>
>>
>>
>> <tr><td colspan=2>Enter a Code or partial Fund
>> Name and click
>> 'Search'</td></tr>
>> <tr>
>> <td class="searchLabel" align="right">Welfare
>> Code:</td>
>> <td class="searchField" align="left"><html:text
>> property="strFundCode"
>> styleClass="searchField"/></td>
>> </tr>
>> <tr>
>> <td class="searchLabel" align="right">Fund
>> Name:</td>
>> <td class="searchField" align="left"><html:text
>> property="strFundName"
>> styleClass="searchField"/></td>
>> </tr>
>> <tr>
>> <td colspan="2" align="center"><input
>> type="button" class="button"
>> value="Search" onclick = "doSearch('search')"></td>
>> </tr>
>> </table>
>>
>> </td></tr>
>> <tr><td class="spacer4"> </td></tr>
>> <%
>> if (mode == "search" || mode == "edit")
>> {
>> if(view.getSize() == 0)
>> {%>
>> <tr><td class="info" align=center>NO
>> RESULTS</td></tr>
>> <%}
>> else
>> {
>>
>>
>> %>
>> <tr><td class="info" align=center>Search results appear in the
>> table
>> below</td></tr>
>> <tr><td align="center">
>> <table cellspacing=2 cellpadding=0>
>> <tr>
>> <td
>> class="dataHeader"> Code </td>
>> <td class="dataHeader"> County
>> Code </td>
>> <td class="dataHeader"> Agreement
>> Num </td>
>> <td class="dataHeader"> Fund
>> Name </td>
>> <td class="dataHeader"> Part-time
>> Rate </td>
>> <td class="dataHeader"> Full-time
>> Rate </td>
>> <td class="dataHeader"> Eff
>> Date </td>
>> <td class="dataHeader"> Exp
>> date </td>
>> <%if(editAllowed)
>> {%>
>> <td class="dataHeader"> Edit
>> </td>
>> <%}%>
>> </tr>
>> <%for (int rec=0;rec<displaySize /*&&
>> rec<view.getDisplayRows()*/;rec++)
>> {
>> int recNum = rec + displayStart;
>> sView = view.getRecord(recNum);
>> String cssClass="data0";
>>
>> %>
>> <tr>
>> <td
>> class="<%=cssClass%>"> <%=sView.getRecordIndex() + " "%>
>> <%=sView.getFundCode()%></td>
>> <td
>> class="<%=cssClass%>"> <%=sView.getCountyCode()%></td>
>> <td
>> class="<%=cssClass%>"><%=sView.getAgreementNum()%></td>
>> <td
>> class="<%=cssClass%>"><%=sView.getFundName()%></td>
>> <td
>> class="<%=cssClass%>"align=right><%=sView.getPtRate()%> </td>
>> <td align=right
>> class="<%=cssClass%>"><%=sView.getFtRate()%> </td>
>> <td
>> class="<%=cssClass%>"> <%=sView.getEffDate()%></td>
>> <td
>> class="<%=cssClass%>"> <%=sView.getExpDate()%></td>
>> <% if (editAllowed){%>
>> <td align=center>
>> "javascript:doZoom('<%=sView.getFundCode()%
>> ','<%=sView.getCountyCode()%>','<%=sView.getEffDate()%>')">
>> images/Pencil.gif </td>
>> <%}%>
>> </tr>
>> <%}
>> }
>> }%>
>>
>>
>>
>> <!--<tr>
>> <td
>> class="dataSelected"> 010</td><td
>> class="dataSelected">A2034</td><td class="dataSelected">DC 37 BENEFITS
>> FUND
>> TRUST</td>
>> <td class="dataSelected"
>> align=right>1540.00 </td><td
>> align=right
>> class="dataSelected">1540.00 </td>
>> <td
>> class="dataSelected"> 07/01/2006</td><td
>> class="dataSelected"> 12/31/9999</td>
>> <td class="dataSelected"
>> align=center> </td>
>> </tr>
>> <tr>
>> <td class="data0"> 023</td><td
>> class="data0">A2549</td><td
>> class="data0">DC 37 BENEFITS FUND TRUST</td>
>> <td class="data0"
>> align=right>0.00 </td><td align=right
>> class="data0">1540.00 </td>
>> <td
>> class="data0"> 07/01/2006</td><td
>> class="data0"> 12/31/9999</td>
>> <td class="data0" align=center>
>> images/Pencil.gif </td>
>> </tr>
>> <tr>
>> <td class="data1"> 026</td><td
>> class="data1">A2628</td><td
>> class="data1">DC 37 BENEFITS FUND TRUST</td>
>> <td class="data1"
>> align=right>0.00 </td><td align=right
>> class="data1">1540.00 </td>
>> <td
>> class="data1"> 07/01/2006</td><td
>> class="data1"> 12/31/9999</td>
>> <td class="data1" align=center>
>> images/Pencil.gif </td>
>>
>> -->
>> <%if(mode != "start" && mode == "search" && mode != "edit" &&
>> view.getSize() != 0)
>> {%>
>> <tr><td colspan=9 class="dataTotals" colspan=3>
>> <table cellspacing=0 cellpadding=0
>> class=dataTotals width=100%>
>> <tr>
>> <td align=left>
>> <%if (displayStart > 0) {%>
>> javascript:doPrev()
>> <<Prev <%=view.getMiniSize()%>
>> <%} %></td>
>> <td
>> align=center><%=displayStart + 1%> through
>> <%=displayStart+displaySize%> of <%=total%> records</td>
>> <td align=right nowrap >
>> <%if(displayStart+displaySize <
>> total){ %>
>> javascript:doNext()
>> Next <%=view.getMiniSize() %>>>
>> <%}%></td>
>> </tr>
>> </table>
>> </td>
>> </tr>
>> </tr>
>> </table>
>> </td></tr>
>>
>> <%}%>
>> <tr>
>> </table>
>> </td></tr>
>> <tr>
>> <td>
>> <% if (mode != "add" || mode != "edit")
>> {%>
>> <table bgcolor="#d5ddff" width="100%"
>> cellpadding=0 border=0
>> cellspacing=0>
>> <tr>
>> <td align="center"><input
>> type="button" class="button" value="Add
>> New
>> Fund" onClick="doAdd('preAdd')"></td>
>> </tr>
>> <tr><td
>> class="spacer4"> </td></tr>
>> </table>
>> <%}%>
>> </td>
>> </tr>
>>
>>
>> <tr><td align="center">
>> <%if (mode == "edit" || mode == "add"){%>
>> <table class="entryBox" cellspacing=2 cellpadding=2>
>> <tr><td colspan=6 class="entryHeader"
>> align=center>
>>
>> <%if (mode == "add"){
>> label = "Add";
>> action = "doAdd"+"('"+label+"')";
>> %>Adding New Fund<%}
>> else if (mode == "edit" && editAllowed){
>> label = "Save";
>> action = "doSave"+"('"+label+"')";
>> %>Editing record<%}%>
>>
>> </td></tr>
>> <tr><td colspan=6 align=center>Click<%="
>> "+label+" "%>when
>> done</td></tr>
>> <tr>
>> <td class="entryLabel" align="right">Welfare
>> Code:</td><td
>> class="entryField" align="left"><html:text size="3"
>> styleClass="entryFieldRO" property="strFundCodeEdit"
>> disabled="true"/></td>
>> <td> </td>
>> <td class="entryLabel" align="right">County
>> Code:</td><td
>> class="entryField" align="left"><html:text size="3"
>> styleClass="entryFieldRO" property="countyCode" disabled="true"/></td>
>> </tr>
>> <tr>
>> <td class="entryLabel" align="right">Agrmt
>> Num:</td><td
>> class="entryField" align="left"><html:text size="9"
>> styleClass="entryField"
>> property="strAgrNum"/></td>
>> <td> </td>
>> <td class="entryLabel" align="right">Fund
>> Name:</td><td
>> class="entryField" align="left"><html:text size="30"
>> styleClass="entryField"
>> property="strFundNameEdit"/></td>
>> </tr>
>> <tr>
>> <td class="entryLabel" align="right">PT
>> Rate:</td><td
>> class="entryField"
>> align="left"><html:text size="9" styleClass="entryField"
>> property="prtRate"/></td>
>> <td> </td>
>> <td class="entryLabel" align="right">FT
>> Rate:</td><td
>> class="entryField"
>> align="left"><html:text size="9" styleClass="entryField"
>> property="fltRate"/></td>
>> </tr>
>> <tr>
>> <td class="entryLabel" align="right">Eff
>> Date:</td><td
>> class="entryField" align="left"><html:text size="9"
>> styleClass="entryField"
>> property="effDate" disabled="true"/></td>
>> <td> </td>
>> <td class="entryLabel" align="right">Exp
>> Date:</td><td
>> class="entryField" align="left"><html:text size="9"
>> styleClass="entryField"
>> property="strExpDate" value = "12/31/9999"/></td>
>> </tr>
>> <tr>
>> <tr><td class=spacer4> </td></tr>
>> <td colspan="6" align="center"><input
>> type="button" class="button"
>> value="<%=label%>" onClick="<%=action%>">
>>
>> <input type="Submit" class="button"
>> value="Reset">
>>
>> <input type="Submit" class="button" value="Cancel">
>> </td>
>> <tr><td class=spacer4> </td></tr>
>> <%}%>
>> </html:form>
>> </table>
>> <tr><td> </td></tr>
>> </table>
>>
>> -------------------------------------------------------------------------Above
>> jsp calls
>>
>> Different actions.
>>
>> FundsNavigationAction:
>>
>> package gov.nyc.fisa.wbas.action;
>>
>> imports.....
>>
>> .....
>>
>> public class FundsNavigationAction extends Action {
>>
>> private static final Logger log =
>> Logger.getLogger(WBasCodesAction.class.getName());
>>
>> public ActionForward execute(ActionMapping mapping,ActionForm form,
>> HttpServletRequest request, HttpServletResponse
>> response)
>> throws Exception
>> {
>>
>> ServletContext servletContext =
>> getServlet().getServletContext();
>> HttpSession session = request.getSession();
>>
>> if(session==null)
>> return mapping.findForward("Login");
>> Menu menu = (Menu) session.getAttribute("menu");
>> if(menu==null)
>> return mapping.findForward("Login");
>>
>> WBasCodesPropsForm wbasForm = (WBasCodesPropsForm) form;
>> request.setAttribute("wbasPropsForm", wbasForm);
>> boolean editAllowed =
>> menu.findScreenAccessLevelByName("WelfareBenefitsCodesEdit") > 0;
>>
>> SearchFundColViewVO cView =
>> (SearchFundColViewVO)session.getAttribute("view");
>>
>> if (wbasForm.getOperation().equals("next")){
>>
>> System.out.println("In Navigation");
>> wbasForm.setMode("search");
>>
>> int nRowNum = cView.getMiniStart();
>> int winSize = cView.getMiniSize();
>> int fullSize = cView.getSize();
>> if(fullSize > cView.getDisplayRows())
>> fullSize = cView.getDisplayRows();
>>
>> int nNewRowNum = nRowNum + winSize;
>> if(nNewRowNum + winSize> fullSize)
>> nNewRowNum = fullSize - winSize;
>>
>> else if (nNewRowNum < 0)
>> nNewRowNum = 0;
>>
>> cView.setMiniStart(nNewRowNum);
>>
>> System.out.println("NEXT: " + cView.getSize());
>>
>> session.setAttribute("view", cView);
>> }
>>
>> if (wbasForm.getOperation().equals("prev")){
>>
>> System.out.println("In Navigation");
>> wbasForm.setMode("search");
>>
>> int nRowNum = cView.getMiniStart();
>> int winSize = cView.getMiniSize();
>> int fullSize = cView.getSize();
>> if(fullSize > cView.getDisplayRows())
>> fullSize = cView.getDisplayRows();
>>
>> int nNewRowNum = nRowNum - winSize;
>> if(nNewRowNum + winSize> fullSize)
>> nNewRowNum = fullSize - winSize;
>>
>> else if (nNewRowNum < 0)
>> nNewRowNum = 0;
>>
>> cView.setMiniStart(nNewRowNum);
>>
>> System.out.println("PREV: " + cView.getSize());
>>
>> session.setAttribute("view", cView);
>> }
>>
>> return mapping.findForward("SearchFunds");
>>
>> }
>>
>> }
>>
>> ---------------------------------------------------
>>
>> SearchFundsAction:
>>
>> imports...
>>
>> ...
>>
>>
>> public class SearchFundsAction extends Action {
>>
>> private static final Logger log =
>> Logger.getLogger(WBasCodesAction.class.getName());
>>
>>
>> public ActionForward execute(ActionMapping mapping,ActionForm form,
>> HttpServletRequest request, HttpServletResponse
>> response)
>> throws Exception
>> {
>>
>> int maxRows = 0;
>> int miniSize = 0;
>>
>> System.out.println("Welfare Benefits Codes Action");
>>
>> ServletContext servletContext =
>> getServlet().getServletContext();
>> HttpSession session = request.getSession();
>>
>> if(session==null)
>> return mapping.findForward("Login");
>> Menu menu = (Menu) session.getAttribute("menu");
>> if(menu==null)
>> return mapping.findForward("Login");
>>
>> WBasCodesPropsForm wbasForm = (WBasCodesPropsForm) form;
>>
>> session.setAttribute("wbasPropsForm", wbasForm);
>>
>> boolean editAllowed =
>> menu.findScreenAccessLevelByName("WelfareBenefitsCodesEdit") > 0;
>>
>> String oper = request.getParameter("operation");
>> String effDate = request.getParameter("effDate");
>>
>> System.out.println("Operation: " + oper);
>>
>>
>> System.out.println("Action Eff data: " + wbasForm.getEffDate());
>> if(Utils.isBlank(wbasForm.getOperation()))
>> {
>> wbasForm.setMode("start");
>> menu.removeAllSubItems();
>> return mapping.getInputForward();
>> }
>>
>> if (Utils.isAffirmative(wbasForm.getNewSearch()))
>> wbasForm.newSearch();
>>
>> if (oper.equals("search"))
>> {
>> wbasForm.setMode("search");
>> maxRows =
>> WBasCodesPropertiesUtils.getWBasSysPropIntVal(getServlet().getServletContext(),
>> "SROWS");
>> miniSize =
>> WBasCodesPropertiesUtils.getWBasSysPropIntVal(getServlet().getServletContext(),
>> "RWIN");
>>
>>
>> FundsImpl wFundBean = null;
>>
>> String val = Utils.trim(wbasForm.getStrFundCode());
>> String val2 =
>> Utils.trim(wbasForm.getStrFundName().toUpperCase());
>> String searchParam = "";
>> String error = "";
>> boolean isCode = false;
>>
>> //int nRowNum = Integer.parseInt()
>> SearchFundColViewVO cView = new SearchFundColViewVO();
>>
>> if(Utils.isBlank(wbasForm.getStrFundCode()) &&
>> Utils.isBlank(wbasForm.getStrFundName()))
>> {
>> error += "At least one of the search parameters
>> should be
>> provided<br>";
>> }
>>
>> if (!Utils.isBlank(wbasForm.getStrFundCode()) &&
>> !Utils.isBlank(wbasForm.getStrFundName())
>> && val.length() != Constants.FUND_CODE_LENGTH)
>> {
>> //use fund name as a search criteria
>> searchParam = val2;
>> }
>>
>> if(!Utils.isBlank(wbasForm.getStrFundCode()) &&
>> Utils.isBlank(wbasForm.getStrFundName()))
>> {
>> //use fund code as a search criteria: ONLY Fund
>> Code is provided
>> if(val.length() == Constants.FUND_CODE_LENGTH)
>> {
>> searchParam = val;
>> isCode = true;
>> }
>> else
>> {
>> error += "Fund Code should be " +
>> Constants.FUND_CODE_LENGTH + "
>> characters long<br>";
>> }
>>
>> }
>>
>> if (!Utils.isBlank(wbasForm.getStrFundCode()) &&
>> !Utils.isBlank(wbasForm.getStrFundName())
>> && val.length() == Constants.FUND_CODE_LENGTH)
>> {
>> //use fund name as a search criteria: ONLY if
>> both provided
>> parameters
>> are valid
>> searchParam = val2;
>> isCode = false;
>> }
>>
>> if (Utils.isBlank(wbasForm.getStrFundCode()) &&
>> !Utils.isBlank(wbasForm.getStrFundName()))
>> {
>> if(val2.length() <=
>> Constants.FUND_NAME_LENGTH)
>> {
>> searchParam = val2;
>> isCode = false;
>> }
>> else
>> {
>> error += "Fund Name should not
>> be more then " +
>> Constants.FUND_NAME_LENGTH + "characters long<br>";
>> }
>>
>> }
>>
>> if(!Utils.isBlank(error))
>> {
>> request.setAttribute("error",error);
>> log.debug("Forwarding to error");
>> return mapping.findForward("");
>> }
>>
>> try{
>> FactoryBD bd = new FactoryBD();
>> cView =
>> bd.searchFunds(searchParam,isCode,maxRows);
>> cView.setDisplayRows(maxRows);
>> cView.setMiniSize(miniSize);
>> }
>> catch (RemoteException e)
>> {
>> throw new ServerException("Remote exception
>> calling
>> wSearchBean.searchFunds()",e);
>> }
>> catch (ServerException e){
>> throw new ServerException("Server exception
>> calling ",e);
>> }
>> session.setAttribute("view",cView);
>> request.setAttribute("wbasPropsForm",wbasForm);
>> }
>>
>> return mapping.findForward("SearchFunds");
>>
>> }
>> }
>>
>> ---------------------------------------------------------
>>
>>
>> The final action is called when clicking on "edit" button:
>> This is the action: WBasCodesAction:
>>
>> imports...
>>
>> ....
>>
>> /**
>> * @version 1.0
>> * @author
>> */
>> public class WBasCodesAction extends Action {
>>
>> //HashMap fundProps = new HashMap();
>> private static final Logger log =
>> Logger.getLogger(WBasCodesAction.class.getName());
>>
>>
>> public ActionForward execute(ActionMapping mapping,ActionForm form,
>> HttpServletRequest request, HttpServletResponse
>> response)
>> throws Exception
>> {
>>
>> int maxRows = 0;
>> int miniSize = 0;
>>
>> System.out.println("Welfare Benefits Codes Action");
>>
>> ServletContext servletContext =
>> getServlet().getServletContext();
>> HttpSession session = request.getSession();
>>
>> if(session==null)
>> return mapping.findForward("Login");
>> Menu menu = (Menu) session.getAttribute("menu");
>> if(menu==null)
>> return mapping.findForward("Login");
>>
>> WBasCodesPropsForm wbasForm = (WBasCodesPropsForm) form;
>> session.setAttribute("wbasPropsForm", wbasForm);
>> boolean editAllowed =
>> menu.findScreenAccessLevelByName("WelfareBenefitsCodesEdit") > 0;
>>
>> String oper = wbasForm.getOperation();
>> String effDate = wbasForm.getEffDate();
>>
>> System.out.println("Operation: " + oper);
>>
>> WBasPropertyVO fView = null;
>>
>> System.out.println("Action Eff data: " + wbasForm.getEffDate());
>> if(Utils.isBlank(wbasForm.getOperation()))
>> {
>> wbasForm.setMode("start");
>> menu.removeAllSubItems();
>> return mapping.getInputForward();
>> }
>>
>> if (Utils.isAffirmative(wbasForm.getNewSearch()))
>> wbasForm.newSearch();
>>
>> if (oper.equals("preAdd"))
>> {
>> wbasForm.setMode("add");
>> menu.removeAllSubItems();
>> MenuItem curMenuItem = menu.getSelectedMenuItem();
>> MenuItem subMenuItem =
>> menu.findMenuItemByName("WelfareBenefitsCodesEdit");
>> curMenuItem.setSubMenuItem(subMenuItem);
>> }
>> else if(editAllowed && wbasForm.getOperation().equals("zoom"))
>> {
>> wbasForm.setMode("edit");
>> FactoryBD bd = new FactoryBD();
>>
>> System.out.println("Form-Fund Code: " +
>> wbasForm.getZoomKey());
>> System.out.println("Form-County Code: " +
>> wbasForm.getCountyCode());
>> System.out.println("Form-Effective Date: " +
>> wbasForm.getEffDate());
>> WBasPropertyVO wbasVO =
>> bd.getWBasProperty(wbasForm.getZoomKey(),wbasForm.getCountyCode(),wbasForm.getEffDate());
>>
>> System.out.println("Fund Name: " +
>> wbasVO.getFundName());
>> System.out.println("County Code: " +
>> wbasVO.getCountyCode());
>> System.out.println("Agreement Number: " +
>> wbasVO.getAgreementNum());
>> System.out.println("Part-Time Rate: " +
>> wbasVO.getPtRate().toString());
>> System.out.println("Full-Time Rate: " +
>> wbasVO.getFtRate().toString());
>> System.out.println("Effective Date: " +
>> wbasVO.getEffDate());
>> System.out.println("Exparation Date: " +
>> wbasVO.getExpDate());
>> wbasForm.setStrFundCode(wbasForm.getZoomKey());
>> wbasForm.setStrFundName(wbasVO.getFundName());
>> wbasForm.setCountyCode(wbasVO.getCountyCode());
>> wbasForm.setStrAgrNum(wbasVO.getAgreementNum());
>> wbasForm.setPrtRate(wbasVO.getPtRate().toString());
>> wbasForm.setFltRate(wbasVO.getFtRate().toString());
>> wbasForm.setEffDate(wbasVO.getEffDate());
>> wbasForm.setStrExpDate(wbasVO.getExpDate());
>> request.setAttribute("wbasPropsForm",wbasForm);
>> request.setAttribute("sView", wbasVO);
>>
>> }
>> else if (editAllowed && oper.equals("update"))
>> {
>> menu.removeAllSubItems();
>> String error = updateWBasProperties(session,wbasForm);
>> if(!error.equals("OK"))
>> {
>> request.setAttribute("error",error);
>> wbasForm.setMode("edit");
>> }
>> else{
>> wbasForm.setMode("edited");
>> }
>> request.setAttribute("wbasPropsForm", wbasForm);
>> }
>>
>>
>>
>> return mapping.findForward("SearchFunds");
>> }
>>
>> private String updateWBasProperties(HttpSession session,
>> WBasCodesPropsForm
>> form) throws ServerException
>> {
>> if(form.getStrFundNameEdit().length() >
>> Constants.FUND_NAME_LENGTH)
>> {
>> return "Fund Name should not be more then " +
>> Constants.FUND_NAME_LENGTH
>> + "characters long<br>";
>> }
>> return "OK";
>> }
>> }
>>
>>
>> THANK YOU VERY MUCH!!!
>>
>> Eugene
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>> :working:
>
> --
>
> Alberto A. Flores
> http://www.linkedin.com/in/aflores
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
View this message in context:
http://www.nabble.com/Cannot-pass-the-correct-property-value-to-a-form-tp14276705p14278112.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]