Hi Tom,
thanks you. I will definitely check the book. by the way, do you mean I should use FrontPage or other tools to create html file with layout I want and then modify the file with jsp tags? please bear me such stupid question. thanks & regards teng --- Tom Drake <[EMAIL PROTECTED]> wrote: > Teng: > > It sounds like your application consists of > 'boilerplate' > html (lots of static html with a few simple variable > replacements for name, address, etc...). > > If this is this case, then JSP will suit you very > nicely. > > No need to use println statements at all. > > You'll need to write a bean that provides getter > methods to retrieve the value(s) you want to > plug in to your html (e.g. getName(), getAddress() > ). > > > Then you can write a jsp file that looks > something like this: > > <%@ page language="java" import="com.mydomain.*" %> > <jsp:useBean id="customer" scope="request" > class="com.mydomain.Customer"/> > <jsp:setProperty name="customer" property="*"/> > <html> > <head><title>Customer <jsp:getProperty > name="customer" > property="name"/></title></head> > <body> > > Customer name: <jsp:getProperty name="customer" > property="name"/><br> > Address: <jsp:getProperty name="customer" > property="address"/><br> > > </body> > </html> > > The above jsp file will populate all properties of > the > Customer from request parameters (that came from a > POST or GET request via a user form). > > Note that '<jsp:getProperty name="customer" > property="address"/>' will be > replaced with > the value returned by the call to > "customer.getAddress()" where "customer" > is defined > as: > com.mydomain.Customer customer = new > com.mydomain.Customer(); > > There is alot more to JSP's than this. It's best to > pickup a good book > (I like Professional JSP from Wrox press) and delve > into the details. > > I hope this helps. > > Good Luck > > Tom > > > ----- Original Message ----- > From: "renyu teng" <[EMAIL PROTECTED]> > To: "Tomcat Users List" > <[EMAIL PROTECTED]>; "Tom Drake" > <[EMAIL PROTECTED]> > Sent: Monday, November 26, 2001 7:55 PM > Subject: Re: Create JSP file or a Servlet file for > web browser. > > > | > | > | Hi tom, > | > | thanks for your response. > | > | Actually my question is very simple: if I use > | FrontPage to create a html file, and I want to > dump > | this html file with a little bit change (e.g. > name, > | address,etc), then should I use println to do it? > If > | it is the only choice, then I have to accept it. > | > | All the books about jsp or servlet I have gone > through > | in the book store are always giving simple > examples > | using println, I can't image I could follow this > | approach to create html file as I could no way > control > | the layout. There should a tool like FrontPage so > I > | could create whatever pages I want with images, > text, > | different fonts, colors etc., then I could dump > this > | html file into web browser with my own > modification > | through jsp or servlet. Starting Hello World with > c, > | you have a new C world, but with jsp,you can't go > far > | as you can't use println to control layout which > is > | crucial for web browser. > | > | regards > | teng > | > | --- Tom Drake <[EMAIL PROTECTED]> wrote: > | > Please provide some more details. Your > description > | > is really > | > too vague to respond to. > | > > | > However, If you are attempting to generate a > | > 'complicated' > | > html document, a JSP or set of JSP (with JSP or > HTML > | > includes) provides ample means for generating > highly > | > complicated HTML. You may want to consider using > | > CSS as well. This may simplify your html > somewhat. > | > > | > You're right about using 'out.println("...");'. > This > | > technique is > | > extremely clumsy, and difficult to maintain. > JSP's > | > give you > | > the ability to write plain-vanilla HTML, which > you > | > can intersperse > | > with java code that can do the fancy stuff. When > you > | > add > | > taglibs to the mix, then you can do some very > | > powerful things > | > with some fairly simple HTML / XML. > | > > | > Regards, > | > > | > Tom Drake > | > > | > ----- Original Message ----- > | > From: "renyu teng" <[EMAIL PROTECTED]> > | > To: "Tomcat Users List" > | > <[EMAIL PROTECTED]> > | > Sent: Monday, November 26, 2001 6:09 PM > | > Subject: Create JSP file or a Servlet file for > web > | > browser. > | > > | > > | > | > | > | As a new guy to use tomcat, I have the > following > | > | question: > | > | > | > | if I want to dump the response to a web > browser, > | > then > | > | I need to format this into html or xml. > However, > | > it is > | > | really complicate html file, I should have > tools > | > to do > | > | it, right? I feel it is too clumsy to write > all > | > the > | > | html text through out.println. How the > complicated > | > web > | > | pages are created in the really project? could > | > anyone > | > | please shed some light to it? I have gone > throught > | > | some jsp & servlet books, and the projects > inside > | > the > | > | books are really too simple. > | > | > | > | how could a complicated web pages are created > | > through > | > | println statement? And if so, how could you > | > control > | > | the layout? I feel it is impossible, but I may > be > | > | wrong. > | > | > | > | thanks. > === message truncated === __________________________________________________ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>