[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] [Home]

Re: Cannot make functions in JSP?????


> What does that mean, "I want a method with HTML code." ?
> 
> Seems like writing a class with parameterized constructors solves this
> problem nicely. Unless there is some other restriction that is not
> specified?
> 
> I have written lots of nice little classes to perform common tasks within my
> JSP pages. The one problem I had was the loading issue (for debugging).
> Worst case is a daemon restart.
> 
> Even if there is something I am missing about the specifics of the problem
> you are trying to solve, it has helped me greatly to look at the resulting
> "parsed" servlet that gnujsp generates. You can always use this as at least
> a starting point to create a specific servlet that addresses your particular
> problem. I think that is a nice sort of hidden benefit of JSP.

 I find it very strange that noone undesrand me.. maybe I'm expressing it
badly...

 Let's suppose there's a new syntax `<# #>' which does exactly what I want.
It would be like this (jsp0.5 because it's the one I know best):

<script runat=server>
	sendRow(A a, B b, C c, D d)
	{
		// now: HTML code that will be `converted'
		// to Java by gnujsp.
		<#
		<tr>
			<td>.....
			<td>....
			<td>...  <%= a %>
		#>
	}
</script>
<body>
<% ..... some code %>
<table>
<%
...
	if(....) then sendRow(a,b,c,d);
...
%>
</table>


 I need this because where I work we need to have a method to generate both
static content and dynamic content, so we are currently managing the style
wuth M4 macros. These M4 macros should be the same in both cases, but what
do I do with a define(font,<font face="Helvetica,Arial">)? The quotes should
be `\"'...!

 I'm a bit more clear now?