Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Generate jsp in runtime (http://www.velocityreviews.com/forums/t499929-generate-jsp-in-runtime.html)

weetat 04-24-2007 01:17 PM

Generate jsp in runtime
 
Hi all,

I need some advice regarding generate jsp file in runtime.
I have a jsp web page which allowed the user the enter value for
the fields , and , when he or she click submit , it will generate the
jsp file according to the value entered.



Anyone have any ideas or suggestion how to do that ?

Thanks

Wee Tat


Andrew Thompson 04-24-2007 01:41 PM

Re: Generate jsp in runtime
 
weetat wrote:
...
> Anyone have any ideas or suggestion how to do that ?


1) Hire a consultant.
2) Do a turorial.
(e.g. <http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro.html>)
..or..
3) Put a bit of effort into it, and ask a more specific question.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.asp...neral/200704/1


Kai Schwebke 04-24-2007 04:07 PM

Re: Generate jsp in runtime
 
weetat schrieb:
> I need some advice regarding generate jsp file in runtime.

....
>
> Anyone have any ideas or suggestion how to do that ?


Simply don't touch the out-of-the-box settings of tomcat
(e.g. don't turn dynamic jsp compilation off).
The Jasper engine will check and recompile your JSPs,
so you just have to write the file.



Kai

Lew 04-24-2007 11:10 PM

Re: Generate jsp in runtime
 
weetat schrieb:
> I need some advice regarding generate jsp file in runtime.
> I have a jsp web page which allowed the user the enter value for
> the fields , and , when he or she click submit , it will generate the
> jsp file according to the value entered.


Kai Schwebke wrote:
> Simply don't touch the out-of-the-box settings of tomcat
> (e.g. don't turn dynamic jsp compilation off).
> The Jasper engine will check and recompile your JSPs,
> so you just have to write the file.


I interpreted the original question as how to display dynamic data in a JSP
field, not how to rewrite the JSP itself. To the OP: Is that correct?

If so, then you don't change the JSP. JSPs by their very nature create HTML
dynamically, so you don't have to change the JSP in order to show data
dynamically.

Changing a JSP is equivalent to rewriting (part of) the application. A
well-designed application does not need to be rewritten to deal with known
runtime situations.

You only have to change the JSP if the layout logic changes, and not always
even then. JSPs are inherently dynamic and do not need to be recompiled to
show different things depending on runtime phenomena.

The Sun JEE tutorial covers how to do this.

--
Lew

Daniel Pitts 04-25-2007 12:07 AM

Re: Generate jsp in runtime
 
On Apr 24, 6:17 am, weetat <weetat....@gmail.com> wrote:
> Hi all,
>
> I need some advice regarding generate jsp file in runtime.
> I have a jsp web page which allowed the user the enter value for
> the fields , and , when he or she click submit , it will generate the
> jsp file according to the value entered.
>
> Anyone have any ideas or suggestion how to do that ?
>
> Thanks
>
> Wee Tat


I have a suggestion.
Don't.

JSP's are actually compiled into Java, and then into byte code. If
you want to have templates based on what a user enters, I would
suggest trying a different templating technology. Google for Velocity
or FreeMarker. Also, you might consider writing your own templating
mechanism. JSP is not intended to be created automatically.




All times are GMT. The time now is 08:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.