Thanks Jay, Erki and Louis

regarding switch VS if, I found that using switch messed up any methods in
my included file:

eg:
##########################################################
bertindex1.jsp: 

<%@ taglib uri="jruntags" prefix="jrun" %>
<% String fuseaction = "home"; %>

<%
 if ("home".equals(fuseaction)){
%>
    <%@ include file="berthome.jsp"%> 
<%
}
%>

##########################################################
bertindex2.jsp:

<%@ taglib uri="jruntags" prefix="jrun" %>
<% String fuseaction = "home"; %>

<jrun:switch>
    <jrun:case expr='<%= "home".equals(fuseaction) %>'>
        <%@ include file="berthome.jsp"%>
    </jrun:case>        
</jrun:switch>


##########################################################
berthome.jsp:

<%!
String test()
{
    String s = new String("hoohoo");
    return s;
}
%>

<%= test() %>
##########################################################

Index1.jsp works fine, but index2.jsp complains:
Error: No method named "test" was found in type "jrun__bertindex22ejspf". 
Is this due to the different way that switch and if are handled or have i
missed something?

Also, it seems that the included files are included when the jsp is compiled
(or whatever it is that creates the .Int, .class, .java and .xml files in
the WEB-INF\jsp directory).
If this is the case then won't a fusebox app end up as one massive class
file? And might this be a problem?

Cheers
Bert

ps Louis, forget your assignment and get that discussion paper finished
:)


> -----Original Message-----
> From: Jay Jennings [mailto:[EMAIL PROTECTED]]
> Sent: 02 April 2001 19:45
> To: Fusebox
> Subject: RE: JSP fusebox (was RE: Decrypting tags)
> 
> 
> > 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