For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > May 2004 > Passing JSP code back from Java Bean









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Passing JSP code back from Java Bean
Bob C

2004-05-12, 7:47 pm

I have a JSP page that calls a Java Bean method which returns a text
value (e.g., table).

My question is... can the text value that I pass back to the JSP page
be a JSP code snippet?

I assume not because the original JSP code is already precompiled and
wouldn't know what to do with the JSP code returned from the bean.

Any thoughts?
---------------------------------------------
Example:

JSP Include File:

header1 = "Column #1";
header2 = "Column #2";
....

JSP snippet:
<%= mybean.getTableData() %>

Java Bean function:

String getTableData() {
return ("<TABLE><TR><TH><%= header1 %></TH><TH><%= header2
%></TH></TR></TABLE>");
}


thanks!

BC
rpnman

2004-05-16, 6:31 pm

I suppose something could be worked out with serialized objects, but the
real question is :

Why?

What are you trying to do that can't be done better through a more tested
and supportable technology?



--
ROGER NEYMAN

"Bob C" <NewEnglandCamper@aol.com> wrote in message
news:dca18cc8.0405070526.208369cb@posting.google.com...
> I have a JSP page that calls a Java Bean method which returns a text
> value (e.g., table).
>
> My question is... can the text value that I pass back to the JSP page
> be a JSP code snippet?
>
> I assume not because the original JSP code is already precompiled and
> wouldn't know what to do with the JSP code returned from the bean.
>
> Any thoughts?
> ---------------------------------------------
> Example:
>
> JSP Include File:
>
> header1 = "Column #1";
> header2 = "Column #2";
> ...
>
> JSP snippet:
> <%= mybean.getTableData() %>
>
> Java Bean function:
>
> String getTableData() {
> return ("<TABLE><TR><TH><%= header1 %></TH><TH><%= header2
> %></TH></TR></TABLE>");
> }
>
>
> thanks!
>
> BC



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com