Hi everyone, Here is a question (or series of them) I hope someone has done, or has an idea of a good way to do this. Currently, on our site we are using IIS and JRUN, with .shtml files, calling servlets inline in our .shtml files via the <SERVLET> tag. Besides calling specific servlets to return a multi-page set of forms (that is..a form is returned, the user enters some data and hits SUBMIT and the same servlet is called, but returns another form. Each form returns a "hidden" field with a command_code set to a new value each time its returned. This field is read and based on its value, it calls a different method in the servlet for each call to it), we often use one servlet that replaces "tokens" on various pages with dynamic content. To give you an example, a client once logged in creates a session. When the client logs in, we create a special class called ExecutionContext. This is done in a DefaultServlet which almost ALL of our servlets are derived from..so they ALL do this when they are accessed. The DefaultServlet gets the session, or creates a new one if one isnt available (via a cookie). It also creates various objects, the most obvious one being the "profile" object that contains all the clients info (name, address, etc). The first time they log in, their info is stored in our database, and the session is created. Anytime after that, their name is looked up based on their login name/password, and if found, the Profile object is populated and put in the session created. Most of you doing this type of stuff probably know how all this works. I am trying to convince our main engineer that using JSP pages would be more beneficial to our site. Not only are they "faster" supposedly, but they also offer the ability to do scripting if we need it (which we will on our next big update to the site). He seems to think its a waste of time and not necessary (and thus is not going to be done). The one area I really think JSP would be beneficial is in the use of this "main" servlet, we call TemplateServlet. EVERY page on the inside (once the client is logged in) uses this TemplateServlet. Its job is to load in a .template file, which contains html and special tokens we set up, and replace the tokens with dynamic content based on the clients session (profile info, and other bits of data from various objects). As our site grows we are adding more and more tokens, and every single page must hit our server each time, to make sure it has the latest info. The HEADER and FOOTER of our site uses this template exclusively. The header figures out the "section" of our site they are in (product) and based on that returns info that I use in JavaScript to load the appropriate colored images. If they are in product 1, the images are Orange. If they are in product 2, the images are in green. This is much like how e-trade, amazon.com and other sites work..in at least the way that each top tab changes colors on the tab below it to easily and visually indicate WHERE the client is at on the site, and the options available to them at that time. So...my question is, I think its time consuming to constantly be using these tokens. For example, a single page might be like this: index.shtml: ------------ <SERVLET code="servlets.TemplateServlet"> <PARAM name="template_file" value="c:\\www\\templates\\index.template"> </SERVLET> index.template: --------------- <br><br> Hello, %%TOKEN_CLIENT_NAME%%<br><br> %%TOKEN_CLIENT_COMPANY_INFO%%<br> %%TOKEN_CLIENT_LOGO_IMAGE%%<br> So..in the above small excerpt, when somebody came to the index.shtml, it would call the TemplateServlet, passing to it the parameter template_file which points to a .template file to load and parse. The TemplateServlet uses "token" names out of a TOKENS.JAVA file we use to store static final String values. These values are used in the ExecutionContext (dont have a clue why the main guy put all this stuff in 3 or more classes like this), which is used to replace the tokens with the dynamic content they represent in the clients profile, and other session objects. I was thinking, as I switched to JSP, instead of using this TemplateServlet, to somehow pass back a JavaBean that contains all this info for me. That is to say, if currently we parse and replace the following: client name, client company info, client logo image, client product choice (where they are in our site), client etc, I could set up a JavaBean that gets passed the ExecutionContext (somehow..not sure how yet..part of my question here), that is passed back to the various JSP pages. They can then use ANY and ALL of the methods in the JavaBean using the get and set calls. Generally speaking, they would never use set..() anyways..just the get..() calls to display the bits of info they need. My problem here is..CAN this be done? Can I replace using "tokens" and being parsed as they are now with returning a JavaBean that has properties with the info I need dynamically. One last thing..I am experiencing a problem that isnt a totally big deal, but something I would like to see work. Currently, when a user logs in, the LoginServlet that verifies their login/password, redirects to either the main inside page, or to a badlogin.shtml page. In the web URL, after the redirect, it shows the page they went to. So far, using the JSP method, when the LoginServlet redirects, it for some reason is STILL showing the previous page, which in this case, is the login.jsp page, along with their login name, password, etc. Dont ask as to why this info is displayed...I am in the process of changing it (it currently uses JavaScript to call the login.jsp with the parameters being passed as GET method). But, I would like the end result to show the new page in the Web URL line. Is there some reason this might be happening? Thank you for any help anyone can give. Kevin Duffey Software Engineer [EMAIL PROTECTED] =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". FAQs on JSP can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html
