tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mufaddal Khumri <mufad...@wmotion.com>
Subject Re: is there a tag or some kind of mechanism that would do the following ...
Date Tue, 25 Feb 2003 09:18:59 GMT
I could use a giant String being returned from some static method .. 
but the problem is that i would have to do the following:

static String getString()
{
	String str = "<html>"
			+"<title>"
			+"ding dong bells"
			+"</title>"
			+"<body></body></html>";
	
	return str;
}

In the above code i will have to type in the quotes and + signs 
everywhere since if the string gets too long it will all be on one line 
and the html code from a developer stand point would not be 
maintainable.

Are there any other better ideas to do this ?

Mufaddal.
On Tuesday, February 25, 2003, at 01:57  PM, Mufaddal Khumri wrote:

> Hi,
>
> Many times we come across a lot of out.println( ... ) statements in 
> our servlets:
>
> public class MyServlet extends ....
> {
> 	....
> 	....
>
> 	doPost( ... )
> 	{
> 		.....
> 		.....
> 		out.println("<html>");
> 		out.println("<title>");
> 		out.println("ding dong bells");
> 		out.println("</title>");
> 		out.println("<body>");
> 		out.println("</body>");
> 		out.println("</html>");
> 		......
> 	}
> }
>
> I do know that if your code has more html .. its better to write a 
> .jsp file instead of a servlet.java file
> There are some cases where this is unavoidable and I was wondering if 
> there was a way to do something like below in a .java file:
>
> public class MyServlet extends ....
> {
> 	....
> 	....
>
> 	doPost( ... )
> 	{
> 		.....
> 		.....
>
> 		<Some kind of tag that signals to the compiler that whatever follows 
> is to be "out.println(... )" >
> 		
> 			<html>
> 			<title>
> 				ding dong bells
> 			</title>
> 			<body>
> 			</body>
> 			</html>
> 	
> 		</end of the signalling tag>
> 		......
> 	}
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message