> so what did your index.jsp look like?

Here's a little chunk:

<!-- dpi.cfm for DentalPlanInfo.com -->
<%@ page language= "java"%>
<%@ page import="java.util.*"%>
<%! String fa;  %>
<%! String pagename;  %>

<%
        fa = request.getParameter("fa");
        if (fa == null)
                fa = "plan";

        if (fa.equals("plan"))
                {
                %>
                <jsp:include page="dsp_plan.jsp" flush="true"/>
                <%
                }
        else if (fa.equals("mailmemberinfo"))
                {
                %>
                <jsp:include page="act_sendmembermail.jsp" flush="true"/>
                <jsp:include page="dsp_memberthanks.jsp" flush="true"/>
                <%
                }
        else
                {
                %>
                Define this fuseaction: [<%= fa %>]<br>
                <%
                }
%>
<jsp:include page="dpilogonav.jsp" flush="true"/>


Notice that I used if/else instead of switch/case. That's because in java
(as in C and other languages) switch/case only takes integers as values. So
I could have made all my fuseactions numeric and just remembered that 4 was
"mailmemberinfo" but I don't like to have to remember that much stuff. :)

Another way to handle that would be to create a 2-element array holding the
fuseaction words and matching numbers at the top of the file, and then
lookup the number you need to use in the switch/case block. An if/else block
creates more of a hit than switch/case, but adding a lookup would increase
the code necessary to get the job done, too, so I just decided to go the
route shown above.

Also, this was the first jsp app that I wrote, so anything you see could
probably be written better. =:)

 ..jj..

 - - - - -
Get your free email account: [EMAIL PROTECTED]
Sign up at http://www.alakazam.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to