Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

Generate jsp in runtime

Thread view: 
weetat - 24 Apr 2007 14:17 GMT
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 - 24 Apr 2007 14:40 GMT
...
>  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.

Signature

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

Kai Schwebke - 24 Apr 2007 17:07 GMT
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 - 25 Apr 2007 00:10 GMT
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.

> 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.

Signature

Lew

Daniel Pitts - 25 Apr 2007 01:07 GMT
> Hi all,
>
[quoted text clipped - 8 lines]
>
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.