You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ted Husted <ne...@husted.com> on 2001/01/17 19:26:57 UTC

Re: trade-off

The template tags in the Struts library seem a bit pokey, but there's a
lot going on there (reads one file, then merges from another). I don't
think alot of applications actually use these tags much. 

I believe that any JSP is suppose to compile down to a single servlet
class file. The custom tags are just alternate ways to call
subroutines. 

If you check your work directory, you'll see that a number of automatic
Java files might be generated for a given JSP, but they resolve to a
single class.

Struts is also fine with distributing precompiled JSPs, which can
eliminate the cycles it takes the container to check to see if the JSP
needs to be recompiled.

*********** REPLY SEPARATOR  ***********

On 1/17/2001 at 9:43 AM John Hunt wrote:

Hi
What do you think is the over-head in using struts
tags in terms of performance? ( all tags in general )
And let us say we use a template for a page which has
a header, a side bar, a footer, a content. Each of
this gets commpiled into a class and thus a single
page is converted into a set of classes ( r these a
set of servlets )? Doesnt it slowdown when compared to
a single servlet just outputting the stuff???
Thanks
Hunt

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/




Re: How to pass parameter to a JSP inside a template?

Posted by Michael Mok <mo...@iprimus.com.au>.
Hi

First thanks to Deadman for providing a tip to handle this challenge. I
eventually found a better solution.

The template tag will forward the request parameters through to the included
JSP pages. Hence there is no need to add any "passing of parameters" code in
the template page. I simply add the logic to look up the parameter in the
JSP page (SQLDisplayRowResult.jsp) rather than the (SQLResult.jsp which is
the template parent page).

It seems to work very well. I must congratulate Craig for providing an
excellent framework. I used the "offset" and "length" attribute of the
<logic:iterate> tag (to breakup and display large datasets in my TeaTimeJ
application) and it works like a charm.

We should vote for this framework in the Java Developers Journal Readers
Choice Awards!

Cheers

Michael Mok


RE: How to pass parameter to a JSP inside a template?

Posted by "Deadman, Hal" <ha...@tallan.com>.
You could do something like this in the SQLResult.jsp:
pageContext.setAttribute("offset",offset,PageContext.REQUEST);

Then you could do:
Object o = pageContext.getAttribute("offset",PageContext.REQUEST);
inside SQLDisplayRowResult.jsp.

I think that would work but it might be considered a hack. There might be a
better way...

Hal

-----Original Message-----
From: Michael Mok [mailto:moktc@hotmail.com]
Sent: Wednesday, January 17, 2001 6:22 PM
To: struts-user@jakarta.apache.org
Subject: How to pass parameter to a JSP inside a template?


Hi

Is it possible to pass parameter to a JSP inside a template? Or is there an
alternate way to do this.

I have a JSP page SQLDisplayRowResult.jsp, I created a link with will call
its template  SQLResult.jsp passing a parameter called "offset".
SQLResult.jsp will detect if a parameter is passed and "forward" the
parameter to SQLDisplayRowResult.jsp.

When I run the code, the SQLResult.jsp is created but
SQLDisplayRowResult.jsp is not. Can anyone give me some advice as to how I
can sort this out?

My example are provided below.

TIA

Michael Mok

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
SQLDisplayRowResult.jsp

 <logic:present parameter="offset">
<!-- do something -->
</logic:present parameter>
 <logic:notPresent parameter="offset">
   <%
    String nextURL = "/SQLResult.jsp?offset=5";
   %>
   <html:link page="<%=nextURL%>">Next Page</html:link>
 </logic:notPresent>

SQLResult.jsp

<template:insert template='/template/master_template.jsp'>
 <logic:present parameter="offset">
 <bean:parameter id="offset" name="offset"/>
 <%
  String displayrowresult = "/SQLDisplayRowResult.jsp?offset="+ offset;
 %>
   <template:put name='display' content='<%displayrowresult%>' />
 </logic:present>
 <logic:notPresent parameter="offset">
   <template:put name='display' content='/SQLDisplayRowResult.jsp' />
 </logic:notPresent>
  </logic:present>
  <template:put name='footer' content='/template/footer.html' />
</template:insert>

How to pass parameter to a JSP inside a template?

Posted by Michael Mok <mo...@hotmail.com>.
Hi

Is it possible to pass parameter to a JSP inside a template? Or is there an
alternate way to do this.

I have a JSP page SQLDisplayRowResult.jsp, I created a link with will call
its template  SQLResult.jsp passing a parameter called "offset".
SQLResult.jsp will detect if a parameter is passed and "forward" the
parameter to SQLDisplayRowResult.jsp.

When I run the code, the SQLResult.jsp is created but
SQLDisplayRowResult.jsp is not. Can anyone give me some advice as to how I
can sort this out?

My example are provided below.

TIA

Michael Mok

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
SQLDisplayRowResult.jsp

 <logic:present parameter="offset">
<!-- do something -->
</logic:present parameter>
 <logic:notPresent parameter="offset">
   <%
    String nextURL = "/SQLResult.jsp?offset=5";
   %>
   <html:link page="<%=nextURL%>">Next Page</html:link>
 </logic:notPresent>

SQLResult.jsp

<template:insert template='/template/master_template.jsp'>
 <logic:present parameter="offset">
 <bean:parameter id="offset" name="offset"/>
 <%
  String displayrowresult = "/SQLDisplayRowResult.jsp?offset="+ offset;
 %>
   <template:put name='display' content='<%displayrowresult%>' />
 </logic:present>
 <logic:notPresent parameter="offset">
   <template:put name='display' content='/SQLDisplayRowResult.jsp' />
 </logic:notPresent>
  </logic:present>
  <template:put name='footer' content='/template/footer.html' />
</template:insert>


RE: trade-off

Posted by Ted Husted <ne...@husted.com>.
They are used in the Template Example application, if you want to see a
set in action.

Another templating approach is Components Library for building JSP
views by Cedric Dumoulin at < http://gauss.ficsgrp.com/cdm/index.html
>.

*********** REPLY SEPARATOR  ***********

On 1/17/2001 at 3:06 PM Deadman, Hal wrote:

I know the pages that use template tags are slow the first time you hit
them
because there are normally several jsps that need to get compiled.
After
that I would think it would be the same performance-wise as a jsp that
does
lots of jsp:includes. Has anyone tried to use struts-templates in
production? I am starting to use them for a bench project in order to
guage
their value so I can't really speak to their performance.




RE: trade-off

Posted by "Deadman, Hal" <ha...@tallan.com>.
I know the pages that use template tags are slow the first time you hit them
because there are normally several jsps that need to get compiled. After
that I would think it would be the same performance-wise as a jsp that does
lots of jsp:includes. Has anyone tried to use struts-templates in
production? I am starting to use them for a bench project in order to guage
their value so I can't really speak to their performance.

Speaking of includes, the following sentence in the documentation is
misleading/wrong: