So, if I understood your requirement correctly, you want to execute a
single file, I,e JSP for every request. Probably after processing a
request you might wish to set an attribute to identify the response
view.

I would suggest to use standard jsp include tag, with this your template
JSP would look like

<%-- put all your html/jsp code here (like the header, pictures
etc.)--%>

<jsp:include page=<%=request.getParameter("mainPage")%> />

<%-- put all your html/jsp code here (like the footer etc.)--%>

Keep in mind that this has a performance issue, as every request results
in runtime inclusion of output from the included JSP. 

Hope I was of some help.

Vinod


-----Original Message-----
From: Charles P. Killmer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 15, 2005 2:32 PM
To: Tomcat Users List
Subject: RE: {OT] Re: Jumping in and out of JSP


I am using a template.jsp file that calls a function defined in another
file.  Then every file, ie index.jsp, in the site defines that function
and includes the template which calls the function.  That way I only
have one file defining what the site looks like.  

Is there a better way to template a site.  I don't like the method of
including sections into each jsp file.  This makes adding new sections
to every page difficult.

Charles

-----Original Message-----
From: Ramu, Vinod [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 15, 2005 1:20 PM
To: Tomcat Users List
Subject: RE: {OT] Re: Jumping in and out of JSP

This sound very much similar to error handling. However,If you could
explain exactly about what you are trying to do then probably we could
suggest an alternative to get it done.

Vinod

-----Original Message-----
From: Charles P. Killmer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 15, 2005 2:09 PM
To: Tomcat Users List
Subject: RE: {OT] Re: Jumping in and out of JSP


Does anyone know of a creative solution to this?  Or some way to achieve
what I am after?

Thanks

Charles 

-----Original Message-----
From: Tim Funk [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 15, 2005 12:33 PM
To: Tomcat Users List
Subject: Re: {OT] Re: Jumping in and out of JSP

You can't do that. The jsp spec forbids it.

-Tim

Charles P. Killmer wrote:

> My goal in this is to have a function that returns a string.  But 
> instead of doing something like this:
> 
> <%!
> Public String test() {
>       return "<table border=\"0\" cellspacing=\"0\"
cellpadding=\"0\">";
> }
> %>
> 
> I want to be able to jump out of JSP and just have the function echo 
> it to the screen without needing to escape the "s to put it into a 
> String object.
> 
> Charles
> 
> -----Original Message-----
> From: Tim Funk [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 15, 2005 12:23 PM
> To: Tomcat Users List
> Subject: Re: {OT] Re: Jumping in and out of JSP
> 
> You can't mix:
> <%!
> stuff with open brace {
> %>
> JSP CODE
> <%!
>   } closeing brace here
> %>
> 
> Anything in <%!%> are class level declarations which live outside the
> jspService() method.  See the generated java to see what i mean.
> 
> -Tim
> 
> Charles P. Killmer wrote:
> 
> 
>>Maybe I wasn't clear.  The code that I pasted below is throwing all 
>>sorts of errors.  Assuming that something like this can be done.  Why 
>>does my code throw errors?
>>
>>Thanks
>>Charles
>>
>>-----Original Message-----
>>From: Jason Bainbridge [mailto:[EMAIL PROTECTED]
>>Sent: Tuesday, March 15, 2005 11:51 AM
>>To: Tomcat Users List
>>Subject: {OT] Re: Jumping in and out of JSP
>>
>>On Tue, 15 Mar 2005 10:27:21 -0600, Charles P. Killmer 
>><[EMAIL PROTECTED]> wrote:
>>
>>
>>>Is it possible to do something like the following?  I have as much 
>>>code as I want in Java classes.  This is just to make modifying the 
>>>UI
>>
>>
>>>easier.
>>>
>>><%!
>>>public String test() {
>>>%>
>>>test2
>>><%!
>>>}
>>>%>
>>><%=test()%>
>>
>>
>>Yes it is and one of the reaons using JSP's instead of just Servlets 
>>is attractive.
>>
>>Regards,
>>--
>>Jason Bainbridge
>>http://kde.org - [EMAIL PROTECTED]
>>Personal Site - http://jasonbainbridge.com
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to