Re: Resultset MovePrevious
Hy, Are you using a JDBC-ODBC Bridge? Because in this case the JDBC-ODBC Bridge that is included in the Java 2 Platform (jdk1.2.x) initial release does not support the new features in the JDBC 2.0 API (methods as previous(), first(), etc..). I had the some problem and currently the only way is to create a JDBC connection with the DB other wise you have to wait for the new version of the Bridge that support the new features. You can find some information about this at http://java.sun.com/products/jdbc/faq.html Ciao Elena Reeta Mittal wrote: Hello Everyone, I am trying to make a navigation bar. But in JDK1.1.5 only move next method is available. In jdk1.2.2 move previous, move last, move first methods are available but when I am trying to use them then I am getting that method is not available. Can anyone please tell me the reason of this problem ? Thanx and Regards, Reeta === 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 begin:vcard n:Palanca;Elena tel;work:Dipartimento di Informatica di Pisa x-mozilla-html:FALSE adr:;; version:2.1 email;internet:[EMAIL PROTECTED] fn:Dott. Elena Palanca end:vcard
Forward Problem
Hi all, Hope someone will be able to help me. I have a default html page with a login. When submitted, the following servlet doPost is in charge of 1) generating the Bean which will create the needed results for JSP 2) forward to the appropriate JSP Page. I am running on NT, Java 2 and JSWDK 1.01 The problem is : When doPost is called, the system crashed (Dr Watson) when it reaches rd.forward(req,res). All the code linked to the HelperBean has been tested separately and is ok. The target page ("home.jsp") is in examples/jsp/BugTrackerJSP/home.jsp and the url used for the request dispatcher is : /jsp/BugTrackerJSP/home.jsp Can someone help with this forward problem? Thanks for replying directly to my email address. Bertrand Here is some code from my servlet. public synchronized void doPost (HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { res.setContentType("text/html"); String command = req.getQueryString(); Hashtable parms = new Hashtable(20); String parmName; String parmValue; session = req.getSession(true); HelperBean hb; Hashtable results; // get the parameters for (Enumeration e = req.getParameterNames();e.hasMoreElements();) { parmName = (String) e.nextElement(); parmValue = req.getParameter(parmName); parms.put(parmName,parmValue); } //determine the command if (parms.get("Transaction")!=null) { command = (String)parms.get("Transaction"); } //get the Helping JavaBeans // return the class to instantiate String helperBeanName = utilities.ResourcesManager.getResource(command); try { Class c = Class.forName(helperBeanName); hb = (HelperBean)c.newInstance(); // send the parameter to HelperBean results = hb.execute(parms); // results should contain target(JSP) and Vector for target session.putValue("INResults",results); String url = (String)results.get("JSPTarget"); System.out.println("Target received : "+url); ServletContext sc = getServletContext(); System.out.println("Context get"); RequestDispatcher rd = sc.getRequestDispatcher(url); System.out.println("dispatcher received"); rd.forward(req,res); System.out.println("forward done"); } catch (ClassNotFoundException cne) { error(cne.getMessage()); } catch (InstantiationException ie) { error(ie.getMessage()); } catch (IllegalAccessException iae) { error(iae.getMessage()); } } === 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
tracking initialization and destruction of JSP objects
Hello , I am developing JSP system that works with some persistent data on the server. I don't wont to fix the persistence mechanism - persistence engine should be easily replaced with another one (DBManager, FileManager, XMLManager) - and my problem is that I don't know how to implement the initialization / destruction of the Persistent Manager object the ideal solution would be // pseudo JSP page code some code that will be invoked when new JSP object is initialized - will initialize the PersistenceEngine or increment a counter some code that will be invoked when this JSP object is destroyed will decrement the counter and destroy the PersistenceEngine if counter == 0 normal code that handles JSP page request // we know that the persistence engine is initialized ... (I have working prototype with Servlets, but generating complex dynamic web pages from servlet is ... simple nightmare :( there is probably some very simple (standard) solution, but I work with JSP only for three days ... Thank you :) and excuse my English. -- Best regards, heyhey mailto:[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
Re: tracking initialization and destruction of JSP objects
Hi, I don't know if it can help, but have a look at the code below. It provides you a way to have a single PersistenceManager on the server and to track the number of clients Bertrand public class PersistenceManager { static private PersistenceManager instance; static private int clients; private PersistenceManager() { init(); } static synchronized public PersistenceManager getInstance() { if (instance == null) { instance = new PersistenceManager(); } clients++; return instance; } ... public synchronized void release() { // Wait until called by the last client if (--clients != 0) { return; } ... -Original Message- From: heyhey [SMTP:[EMAIL PROTECTED]] Sent: Monday, December 06, 1999 11:43 AM To: [EMAIL PROTECTED] Subject: tracking initialization and destruction of JSP objects Hello , I am developing JSP system that works with some persistent data on the server. I don't wont to fix the persistence mechanism - persistence engine should be easily replaced with another one (DBManager, FileManager, XMLManager) - and my problem is that I don't know how to implement the initialization / destruction of the Persistent Manager object the ideal solution would be // pseudo JSP page code some code that will be invoked when new JSP object is initialized - will initialize the PersistenceEngine or increment a counter some code that will be invoked when this JSP object is destroyed will decrement the counter and destroy the PersistenceEngine if counter == 0 normal code that handles JSP page request // we know that the persistence engine is initialized ... (I have working prototype with Servlets, but generating complex dynamic web pages from servlet is ... simple nightmare :( there is probably some very simple (standard) solution, but I work with JSP only for three days ... Thank you :) and excuse my English. -- Best regards, heyhey mailto:[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 === 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
Re: tracking initialization and destruction of JSP objects
-Original Message- From: A mailing list about Java Server Pages specification and reference I am developing JSP system that works with some persistent data on the server. I don't wont to fix the persistence mechanism - persistence engine should be easily replaced with another one (DBManager, FileManager, XMLManager) - and my problem is that I don't know how to implement the initialization / destruction of the Persistent Manager object the ideal solution would be // pseudo JSP page code some code that will be invoked when new JSP object is initialized - will initialize the PersistenceEngine or increment a counter some code that will be invoked when this JSP object is destroyed will decrement the counter and destroy the PersistenceEngine if counter == 0 normal code that handles JSP page request // we know that the persistence engine is initialized ... Just think of JSPs as auto-generated servlets, which they are. So presumably, therefore, you can override the init() method to do any one time initialisation and destroy() to save/cleanup - just like you would in a servlet. You can store information, common to all requests, in objects outside of the service method (ie Page scope) using the %! % tags. You can store information for each current user, for all requests in the session object (session scope) - also available across pages/servlets. If you want to store information common across a number of pages you can use static objects within one of the pages/servlets (Application scope). The bean mechanism in JSP makes things a little easier (in some ways) by allowing you to create bean objects in which you can set the 'scope' - ie request, page, session, application - without having to get your hands too dirty. I always feel it helps to understand what's going on underneath the bonnet (hood), personally :-) You could make the constructor of your 'persistance', Page scope, bean read a db for example and write out to the db in it's finalize() method. Of course, beware of thread synchronisation issues whenever using objects which have Page or Application (and potentially Session) scope. (I have working prototype with Servlets, but generating complex dynamic web pages from servlet is ... simple nightmare :( I know what you mean :-) HTH, Steve === 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
signoff JSP-INTEREST@JAVA.SUN.COM
signoff [EMAIL PROTECTED]
Re: How to compress JSP pages using Content Encoding
You can do content encoding in jsp, I did it. Just make sure that the page does not access the implicit variable out at all (e.g do not have blanks outside scripts). But I think that jsp is not the right tool to do that. The JSP-Container should do that for you. The code is roughly: %@page .% response.setHeader("Content-Encoding", "gzip"); GZIPOutputStream gos = new GZIPOutputStream(response.getOutputStream()); byte[] b = "html bla bla .../html".getBytes(); gos.write(b); gos.close(); % volker turau FH Wiesbaden Fachbereich Informatik Tel.: +49-611-9495-205 FAX +49-611-9495-210 http://www.informatik.fh-wiesbaden.de/~turau === 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
Re: JSP develoment tool
JDeveloper 3 for WINNT is now available for download at:http://technet.oracle.com/software/index.htm -Original Message- From: Gerry Palmer [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 04, 1999 12:31 PM To: [EMAIL PROTECTED] Subject: FW: JSP develoment tool Yes, Oracle JDeveloper 3 which will be available from the technet.oracle.com site this month allows you to write, view, debug, and run JSPs all within the IDE. Runs under NT and Win98 only. Gerry -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Vladyslav Kosulin Sent: Friday, December 03, 1999 5:18 PM To: [EMAIL PROTECTED] Subject: Re: JSP develoment tool Maciejowski wrote: Does it exist any tool for developping and debuging jsp files ? == = 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 Try to look at IBM VisualAge for Java 3.0 Professional (Windows, OS/2, AIX). They have Linux version, too, but I'm not sure it does support JSP development. -- Sincerely yours, Vladyslav Kosulin, Kharkiv, Ukraine ([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 === 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 === 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
Frames problem with servlets
Hi, Please excuse me for a servlet Question, but I couldn't go anywhere for help. I am using frameset in my HTML to generate a HTML framed page. On click of a submit button of one frame a servlet needs to send results to the other frame. Servlet open's a new window as it looses the frame context. How can I send the frameset info to my servlet. Thanks Pankaj Grover === 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
signoff JSP-INTEREST@JAVA.SUN.COM
Jrun UTF-8
Hi, maybe somebody has had the same problem. If I use any german umlaut in my JSP, the JRun complains that it got javax.servlet.ServletException: Invalid UTF-8 code. (bytes: 0xfffc 0xa). By adding the page declaration %@ page contentType="text/html; charset=ISO-8859-1" % which I think should be the default, the error message is produced, but the special characters are showed as '?'. Is it a Jrun bug or do I miss something. (BTW, I'm using JRUN 2.33). Cheers Dapeng === 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
Re: Frames problem with servlets
-Original Message- From: A mailing list about Java Server Pages specification and reference Please excuse me for a servlet Question, but I couldn't go anywhere for help. I am using frameset in my HTML to generate a HTML framed page. On click of a submit button of one frame a servlet needs to send results to the other frame. Servlet open's a new window as it looses the frame context. How can I send the frameset info to my servlet. You can use the TARGET attribute of a FORM tag to specify where the results of the form submission should be displayed - ie you name each of your frames with the 'NAME' attribute. You can use JavaScript to submit forms eg form.submit(), so from one frame you can submit a form in another frame - use links/buttons instead of real submit buttons. or You can rebuild the frameset from scratch each time you submit the form by submitting to the frameset's parent window. To communicate between successive pages you have a variety of methods: -Add parameters to the end of the action url -Add hidden form elements -Use objects stored in session variables -Use cookies Hope that helps, Steve === 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
Re: What's the use of beans?
One fantastic feature of bean is it allows Visual IDE to provide visual design feature, I think this is the major advantage of javabean spec came out. Tool like IBM Websphere Studio will provide this feature I guess. It helps increase productivity, even a lot of 'good' html programmers don't agree, they would prefer coding by hand :) Regards, Ng Kien Kiong. Hi, I'm wondering what's the use of beans with JSP. In my (humble) opinion, beans are useless... everything I can do with beans can be done with "normal" java objects as well. In general, it's much easier to maintain a web application if you keep the code in the JSP pages to a minimum (see the archives for tons of discussions about this). Using beans, and custom actions, is a good way to achieve this goal. For example, jsp:useBean id="myBean" class="MyBean" scope="session" can easily be replaced by % MyBean myBean = new MyBean(); session.put("myBean", myBean); % No, jsp:useBean only creates an instance if the bean can't be found in the specified scope. Moreover, beans obviously have some disadvantages: - the syntax is very awkward. Instead of writing jsp:setProperty name="myBean" property="prop" value="val" I can write myBean.setProp("val"), which seems much smoother - Construction of beans seems to be limitied to using the (argument-less) standard constructor. Constructors with arguments are not supported. - Using jsp:setProperty, only String properties can be set. If I want to set any other properties, I have to access the bean directly anyway. No, jsp:setProperty can be used to set properties of any type (see the JSP specification for details). So, I'd really like to know what's the big deal about beans? I would rather write my JSP pages without using beans, but I'm wondering if I'm missing something? What's the reason that beans were introduced to JSP in the first place? Are there any situations in which the use of beans provides a real advantage over the "traditional" approach? The main reason to use beans is to minimize the amount of code in the JSP pages, see above. I look at beans primarily as carrier of information, for instance all information about a customer. The bean can be created by a servlet, e.g. getting the info from a database, and then passed to a JSP page where the properties are displayed using jsp:getProperty. -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com === 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 __ Get Your Private, Free Email at http://www.hotmail.com === 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
JSP .92 vs 1
Right now I am using the .92 with JRUN. Should I, can I upgrade to 1.0? Opinions, Suggestions. === 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
Re: tracking initialization and destruction of JSP objects
-Original Message- From: A mailing list about Java Server Pages specification and reference overriding init() and destroy is ok - I have only one question 'Is it standard (will it always work ?)' :) Good question - this should answer it, extract from JSP1.0 JavaDocs: |public abstract interface JspPage |extends javax.servlet.Servlet | |This is the interface that a JSP processor-generated class must satisfy. | |The interface defines a protocol with 3 methods; only two of them: jspInit() and jspDestroy() are part of this |interface as the signature of the third method: _jspService() depends on the specific protocol used and cannot |be expressed in a generic way in Java. | |A class implementing this interface is responsible for invoking the above methods at the apropriate time based |on the corresponding Servlet-based method invocations. | |The jspInit(0 and jspDestroy() methods can be defined by a JSP author, but the _jspService() method is |defined authomatically by the JSP processor based on the contents of the JSP page. So I would say a definite YES, but use the renamed versions defined in JspPage (jspInit/jspDestroy) interface rather than the normal servlet ones (init/destroy) to be safe. Btw I just learnt something new too :-) HTH, Steve === 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
Re: What's the use of [jsp:useBean tag]?
As I understood it, Heiko was asking why use JSP tag jsp:useBean... when you can do the same by creating an instance of the java "bean" object... (the original e-mail subject line may have sent the conversation in a different direction). It seems the jsp:useBean tag is redundant. According to the specs, a bean is just a java component, requiring "serialization support" and "get/set accessors." According to the-wally-project tutorials, "JSP is an html friendly servlet." Other than limits imposed by design preference, what ever you can do in a servlet you can do in JSP, including: % MyBean mybean = new MyBean() ; mybean.setSomeVar( "somevalue" ) ; % So, why use JSP tag jsp:useBean...? Phil -Original Message- From: Cory L Hubert [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Monday, December 06, 1999 7:25 AM Subject: Re: What's the use of beans? What you suggested would be fine if you want to bang out a whole project in a perl/hackish fashion. But if you want to be able to reuse code, in your project and in others the best way to do it is by encapsulating code in beans. -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Heiko Gottschling Sent: Sunday, December 05, 1999 7:10 PM To: [EMAIL PROTECTED] Subject: What's the use of beans? Hi, I'm wondering what's the use of beans with JSP. In my (humble) opinion, beans are useless... everything I can do with beans can be done with "normal" java objects as well. For example, jsp:useBean id="myBean" class="MyBean" scope="session" can easily be replaced by % MyBean myBean = new MyBean(); session.put("myBean", myBean); % Moreover, beans obviously have some disadvantages: - the syntax is very awkward. Instead of writing jsp:setProperty name="myBean" property="prop" value="val" I can write myBean.setProp("val"), which seems much smoother - Construction of beans seems to be limitied to using the (argument-less) standard constructor. Constructors with arguments are not supported. - Using jsp:setProperty, only String properties can be set. If I want to set any other properties, I have to access the bean directly anyway. So, I'd really like to know what's the big deal about beans? I would rather write my JSP pages without using beans, but I'm wondering if I'm missing something? What's the reason that beans were introduced to JSP in the first place? Are there any situations in which the use of beans provides a real advantage over the "traditional" approach? thx Heiko === 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 === 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 === 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
How do I make a JSP work in PWS
Hi, What are things required by me to run a jsp file through personal web server in NT4.0 workstation.. What do I have to install and from where can I get it?? Can please somebody help me out?? I need help desperately!! Thanks in advance.. Anupam K "Education is what survives when what has been learned has been forgotten." -B. F. Skinner Anupam K === 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
Re: Request for HTTP documentation, tutorials, and/or workshops
David Chisolm writes: I was having a very strange caching problem - different from the kind normally posted here, and I needed to really understand how caching directives are supposed to work. [ ... ] error. Of course, everything worked just fine in IE. (For the version conscious, I tested this with NS 4.08, 4.5, 4.6 4.7, and IE 4.0 5.0) Hm, are you sure? I've seen some really odd behavior with IE5 not obeying caching directives. Particularly annoying is that both NS and IE seem to always cache POST arguments no matter whether the pages before and/or after the POST are no-cached. Anyway, the only headers that I set now are: response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control","no-cache" ); response.setHeader("Cache-Control","no-store" ); This fixed the problem, and my pages do not go into the cache. Hm, I didn't have the no-store header, and from what you said, the expires header actually caused a problem? I'll have to try it this way. Steven J. Owens [EMAIL PROTECTED] [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
signoff JSP-INTEREST@JAVA.SUN.COM
=== 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
Re: JSP .92 vs 1
Cory L Hubert wrote: Right now I am using the .92 with JRUN. Should I, can I upgrade to 1.0? Yes. Migrate now while (presumably) your code base is small. At the very least, avoid the LOOP, INCLUDEIF, and EXCLUDEIF tags in your jsp 0.92 pages as they are very difficult to mechanically convert to jsp 1.x. The USEBEAN, SETFROMREQUEST, and SETONCREATE tags can be converted mechanically as well as some page/errorpage directives. Main reasons to switch: - closer to XML compliance (I don't know what XML validators do with the %...% directives and scriptlets) so you'll have better support from visual XML page editors and validators. - support for jsp 0.92 will probably be diminishing over the next year. - (eventual) support for custom taglets. - 1.0/1.1 will probably be the documented version in any upcoming books. - *much* closer to jsp 1.1 compliance. We're in the process of converting the http://lightningstorm.com site from JSP 0.92 to 1.0. The biggest pain has been with LOOP, INCLUDEIF, and EXCLUDEIF tags. === 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
Re: What's the use of beans?
While on the subject : If the property I am trying to extract from my bean is an array or a vector, on which I will eventually want to loop, then the jsp:getProperty tag is useless, since it returns one big string containing all elements of the array/vector. Unless I missed something. Any comments ? Martin Leboeuf [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
using ResultSet with JSP?
Hi all... I have to make a query on a DB, and I made this code: = html body pgui 1/p %@ page import = "java.io.*,java.util.*,java.net.*,java.sql.*,javax.servlet.*,javax.servlet.http.*"% %! String url = "jdbc:odbc:teste"; Connection con; Statement stmt; public void jspInit() { System.out.print("starting conection"); //super.init(servletConfig); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection(url,"",""); stmt = con.createStatement(); } catch(SQLException sql) { System.out.println("init error"); } catch(ClassNotFoundException fnf) { System.out.println("init error"); } System.out.println("ready!"); } public void jspDestroy() { System.out.print("closing conection"); try { stmt.close(); con.close(); } catch(SQLException sql) { System.out.println("init error"); } System.out.println("ready!"); } % pgui3/p % String pesquisa = "select * from pessoa where nome = 'gui2'"; stmt.executeQuery(pesquisa); % pfim/p /body /html == On Control Panel I set my database as "teste" (the bridge). I have some data on the table "pessoa" to make the query also.. Well the code is okay. But I don`t know how to print the result of this query on the screen in the JSP file... Can anybody help me??? Thank you, Guilherme === 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
What is the Default page that gets loaded for JavaWebServer2.0.
I am running using jswdk-1.0.1to learn JSP,beans,etc. We will be using JavaWebServer2.0 but no access to it yet. I looked in the webserver.xml and startserver.bat but could not fine. In IIS, it is default.html then, default.asp if HTML does not exist, or define our own. So, when a user comes in to a JavaWebServer2.0 site like, www.myDemo.com, what is the first page that fires? [EMAIL PROTECTED] TIA === 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
Re: What's the use of beans?
Hi Heiko, Are you saying that beans should not be used or that tags like jsp:useBean . and jsp:setProperty should not be apart of the JSP spec? Actually, These tags follow the same semantics as laid out by the 'tag extension' mechanism in JSP 1.1 . So really they are just a required standard set of custom tags for the benefit of web page designers. If this is not exactly true than, imho, it should be. Spencer Ridder Heiko Gottschling wrote: Hi, I'm wondering what's the use of beans with JSP. In my (humble) opinion, beans are useless... everything I can do with beans can be done with "normal" java objects as well. For example, jsp:useBean id="myBean" class="MyBean" scope="session" can easily be replaced by % MyBean myBean = new MyBean(); session.put("myBean", myBean); % Moreover, beans obviously have some disadvantages: - the syntax is very awkward. Instead of writing jsp:setProperty name="myBean" property="prop" value="val" I can write myBean.setProp("val"), which seems much smoother - Construction of beans seems to be limitied to using the (argument-less) standard constructor. Constructors with arguments are not supported. - Using jsp:setProperty, only String properties can be set. If I want to set any other properties, I have to access the bean directly anyway. So, I'd really like to know what's the big deal about beans? I would rather write my JSP pages without using beans, but I'm wondering if I'm missing something? What's the reason that beans were introduced to JSP in the first place? Are there any situations in which the use of beans provides a real advantage over the "traditional" approach? thx Heiko === 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 === 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
Re: JSP .92 vs 1
Migrate now while (presumably) your code base is small. We configured our server to parse .jsp files through the .9x parser and .jsp1 files through the 1.0 parser. This may ease pressure of migrate-headaches. Phil === 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
Re: What's the use of [jsp:useBean tag]?
-Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Phil As I understood it, Heiko was asking why use JSP tag jsp:useBean... when you can do the same by creating an instance of the java "bean" object... (the original e-mail subject line may have sent the conversation in a different direction). It seems the jsp:useBean tag is redundant. According to the specs, a bean is just a java component, requiring "serialization support" and "get/set accessors." According to the-wally-project tutorials, "JSP is an html friendly servlet." Other than limits imposed by design preference, what ever you can do in a servlet you can do in JSP, including: % MyBean mybean = new MyBean() ; mybean.setSomeVar( "somevalue" ) ; % So, why use JSP tag jsp:useBean...? I was wondering the same myself, coming from a background of servlet development. I don't currently use the bean tags at all and was wondering what I was missing... I do however make extensive use of beans in my JSPs, I just create/use them conventionally as per your example. One reason might be that the jsp:... bean tags are language neutral, so that a user of a bean can work with minimal knowledge of Java. This might become more important when using JSP with XML and tag libraries as these could prove to be a powerful combination even for those who don't know Java at all - they merely need to know what the various tags and beans can do and what the attributes/interfaces/properties are. As someone else said here, JSP builder tools will soon be available (eg Visual Cafe 4 Enterprise Edition) which will provide integrated WYSIWYG JSP/HTML building and debugging - I expect beans will be important for this. When using beans with application, page or session scope I suppose it does simplify things a little too - particularly application scope. Btw seems like servlet beans don't even seem to have to strictly be beans at all - ie don't even have to be marked as serializable - any class will do - implementation specific I would guess though. Steve === 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
Re: What's the use of [jsp:useBean tag]?
Yes, I've always wondered this myself. Surely we're all missing something very obvious... Bill Phil [EMAIL PROTECTED] on 12/06/99 09:58:42 AM Please respond to Phil [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: (bcc: Bill Kayser/Worldstreet) Subject: Re: What's the use of [jsp:useBean tag]? As I understood it, Heiko was asking why use JSP tag jsp:useBean... when you can do the same by creating an instance of the java "bean" object... (the original e-mail subject line may have sent the conversation in a different direction). It seems the jsp:useBean tag is redundant. According to the specs, a bean is just a java component, requiring "serialization support" and "get/set accessors." According to the-wally-project tutorials, "JSP is an html friendly servlet." Other than limits imposed by design preference, what ever you can do in a servlet you can do in JSP, including: % MyBean mybean = new MyBean() ; mybean.setSomeVar( "somevalue" ) ; % So, why use JSP tag jsp:useBean...? Phil -Original Message- From: Cory L Hubert [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Monday, December 06, 1999 7:25 AM Subject: Re: What's the use of beans? What you suggested would be fine if you want to bang out a whole project in a perl/hackish fashion. But if you want to be able to reuse code, in your project and in others the best way to do it is by encapsulating code in beans. -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Heiko Gottschling Sent: Sunday, December 05, 1999 7:10 PM To: [EMAIL PROTECTED] Subject: What's the use of beans? Hi, I'm wondering what's the use of beans with JSP. In my (humble) opinion, beans are useless... everything I can do with beans can be done with "normal" java objects as well. For example, jsp:useBean id="myBean" class="MyBean" scope="session" can easily be replaced by % MyBean myBean = new MyBean(); session.put("myBean", myBean); % Moreover, beans obviously have some disadvantages: - the syntax is very awkward. Instead of writing jsp:setProperty name="myBean" property="prop" value="val" I can write myBean.setProp("val"), which seems much smoother - Construction of beans seems to be limitied to using the (argument-less) standard constructor. Constructors with arguments are not supported. - Using jsp:setProperty, only String properties can be set. If I want to set any other properties, I have to access the bean directly anyway. So, I'd really like to know what's the big deal about beans? I would rather write my JSP pages without using beans, but I'm wondering if I'm missing something? What's the reason that beans were introduced to JSP in the first place? Are there any situations in which the use of beans provides a real advantage over the "traditional" approach? thx Heiko === 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 === 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 === 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 === 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
Re: using ResultSet with JSP?
-Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Guilherme - PerConsult Sent: 06 December 1999 17:32 To: [EMAIL PROTECTED] Subject: using ResultSet with JSP? Hi all... I have to make a query on a DB, and I made this code: = html body pgui 1/p %@ page import = "java.io.*,java.util.*,java.net.*,java.sql.*,javax.servlet.*,j avax.servlet.http.*"% %! String url = "jdbc:odbc:teste"; Connection con; Statement stmt; public void jspInit() { System.out.print("starting conection"); //super.init(servletConfig); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection(url,"",""); stmt = con.createStatement(); } catch(SQLException sql) { System.out.println("init error"); } catch(ClassNotFoundException fnf) { System.out.println("init error"); } System.out.println("ready!"); } public void jspDestroy() { System.out.print("closing conection"); try { stmt.close(); con.close(); } catch(SQLException sql) { System.out.println("init error"); } System.out.println("ready!"); } % pgui3/p % String pesquisa = "select * from pessoa where nome = 'gui2'"; stmt.executeQuery(pesquisa); % pfim/p /body /html == On Control Panel I set my database as "teste" (the bridge). I have some data on the table "pessoa" to make the query also.. Well the code is okay. But I don`t know how to print the result of this query on the screen in the JSP file... Can anybody help me??? executeQuery() returns a ResultSet object which allows you to iterate through each row of the results of the query. You access the values of the columns using getXXX() methods - eg getString( "BOB" ) gets the BOB column as string. eg in your example: % String pesquisa = "select * from pessoa where nome = 'gui2'"; ResultSet result = stmt.executeQuery(pesquisa); while( result.next() ) { out.println( "BOB=" + result.getString( "BOB" ) + "BR" ); } % This will display all the values (if any) of the BOB column, found in your query. (replace "BOB" with a column name in your table). See the API docs for java.sql for more information. Hope that helps, Steve === 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
Re: Structuring model-2 applications
hi, what is a RequestDispatcher ? RequestDispatcher rd=getServletContext().getRequestDispatcher("/myapp/showinfo.jsp"); I can't find the ServletContext.getRequestDispatcher(...) from the API. Govind Seshadri wrote: My article "Understanding JSP Model 2 architecture" in this month's issue of Javaworld may be helpful. Please see: http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html Govind Greg Hodges wrote: Hi all, I need help understanding and implementing the Model-2 Architecture advocated by folks like Craig. What I would really like someone to describe is the how, and more importantly the where of implementing the Model-2 Architecture. I'll attempt to describe a "HelloWorld-ish" application I created to use Model-2 techniques as I understand them. Let's say I have a jsp page called userinfo.jsp. userinfo.jsp exist in a folder called myapp on the root of my webserver. So it would be accessed like http://servername/myapp/userinfo.jsp. Now, I have two Java classes: StoreUser, which is the "controller" servlet and UserBean which is a Bean which holds info entered in the form on userinfo.jsp. Finally, I have another jsp page called showinfo.jsp whose purpose in life is to display info. stored in the UserBean. Now, userinfo.jsp "calls" the StoreUser servlet(FORM action="/myapp/StoreUser"). StoreUser creates a session, a UserBean, and attempts to store the UserBean in the session. Then StoreUser forwards the request to showinfo.jsp-- RequestDispatcher rd=getServletContext().getRequestDispatcher("/myapp/showinfo.jsp"); Next, in showinfo.jsp I have the following at the top of showinfo.jsp: %@ page session="true" import="learn.UserBean" % jsp:useBean id="idBean" scope="session" class="learn.UserBean" / Finally in showinfo.jsp I have a line like: %= idBean.getUserID() % I mapped /myapp/StoreUser to the StoreUser servlet, which exist in directory structure of my servlet container, JRun. I'm sure I've done a number of things incorrectly, but my biggest source of confusion is how do I get the jsp files that exists under the directory structure of my webserver to know about the session created by the StoreUser servlet which exist under the directory structure of JRun. I simply don't know where to place all the directories and files so that they "share" the same context, session, etc. I would appreciate as much info./example code/example dir. structures as anyone is willing to provide. Thanks, Greg === 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 -- Govind Seshadri [EMAIL PROTECTED] jGuru.com - Your Gateway to the Java Universe http://www.jguru.com === 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 === 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
jspInit, jspDestroy
I'm new to JSPs and this list so excuse the newbie question ... I just read a message that had code in the JSP page for init and destroy, pretty much like a servlet. Now, I know that JSPs map to servlets, but is it common convention to implement these methods (init/destroy) ? It would seem to that adding this type of code to a JSP page is a bit much. Wouldn't it be better to do DB connections in a bean and/or some type of singleton object outside of the page ? Augusto -- Message To Spammers -- Game Over! Get spam-free email at http://www.MsgTo.com === 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
Re: What is the Default page that gets loaded for JavaWebServer2. 0.
It should be server_root/public_html/index.html where server_root is the directory in which you installed JWS, which is JavaWebServer2.0 by default (for the 2.0 version). Martin Leboeuf [EMAIL PROTECTED] -Original Message- From: Rick L Sample To: [EMAIL PROTECTED] Sent: 12/6/99 1:47 PM Subject: What is the Default page that gets loaded for JavaWebServer2.0. I am running using jswdk-1.0.1to learn JSP,beans,etc. We will be using JavaWebServer2.0 but no access to it yet. I looked in the webserver.xml and startserver.bat but could not fine. In IIS, it is default.html then, default.asp if HTML does not exist, or define our own. So, when a user comes in to a JavaWebServer2.0 site like, www.myDemo.com, what is the first page that fires? [EMAIL PROTECTED] TIA === 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 === 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
Re: What's the use of beans?
I can't use setProperty() with any other type then String. I am weblogic4.5, and I believe its jsp engine implement the 1.0 spec. So is this mean 1.1+ allow you use setProperty with other datatype? Hans Bergsten wrote: Heiko Gottschling wrote: Hi, I'm wondering what's the use of beans with JSP. In my (humble) opinion, beans are useless... everything I can do with beans can be done with "normal" java objects as well. In general, it's much easier to maintain a web application if you keep the code in the JSP pages to a minimum (see the archives for tons of discussions about this). Using beans, and custom actions, is a good way to achieve this goal. For example, jsp:useBean id="myBean" class="MyBean" scope="session" can easily be replaced by % MyBean myBean = new MyBean(); session.put("myBean", myBean); % No, jsp:useBean only creates an instance if the bean can't be found in the specified scope. Moreover, beans obviously have some disadvantages: - the syntax is very awkward. Instead of writing jsp:setProperty name="myBean" property="prop" value="val" I can write myBean.setProp("val"), which seems much smoother - Construction of beans seems to be limitied to using the (argument-less) standard constructor. Constructors with arguments are not supported. - Using jsp:setProperty, only String properties can be set. If I want to set any other properties, I have to access the bean directly anyway. No, jsp:setProperty can be used to set properties of any type (see the JSP specification for details). So, I'd really like to know what's the big deal about beans? I would rather write my JSP pages without using beans, but I'm wondering if I'm missing something? What's the reason that beans were introduced to JSP in the first place? Are there any situations in which the use of beans provides a real advantage over the "traditional" approach? The main reason to use beans is to minimize the amount of code in the JSP pages, see above. I look at beans primarily as carrier of information, for instance all information about a customer. The bean can be created by a servlet, e.g. getting the info from a database, and then passed to a JSP page where the properties are displayed using jsp:getProperty. -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com === 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 === 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
Re: What is the Default page that gets loaded forJavaWebServer2. 0.
Is that the default page most use for starting their apps? Or, can we make a webserver config change? Thanks! "Martin Leboeuf" [EMAIL PROTECTED] 12/06/99 01:58PM It should be server_root/public_html/index.html where server_root is the directory in which you installed JWS, which is JavaWebServer2.0 by default (for the 2.0 version). Martin Leboeuf [EMAIL PROTECTED] -Original Message- From: Rick L Sample To: [EMAIL PROTECTED] Sent: 12/6/99 1:47 PM Subject: What is the Default page that gets loaded for JavaWebServer2.0. I am running using jswdk-1.0.1to learn JSP,beans,etc. We will be using JavaWebServer2.0 but no access to it yet. I looked in the webserver.xml and startserver.bat but could not fine. In IIS, it is default.html then, default.asp if HTML does not exist, or define our own. So, when a user comes in to a JavaWebServer2.0 site like, www.myDemo.com, what is the first page that fires? [EMAIL PROTECTED] TIA === 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 === 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 === 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
Re: What's the use of [jsp:useBean tag]?
Maybe one of the things we are all missing is that most of us on this forum (I assume) are programmers and are used to seeing java code embedded in things. Consider for a second that one major reason JSP was developed was to separate presentation from business logic. One advantage of the usebean tag provides a HTMLish tag that non-programmers can more easily use in their HTML. Granted it may be fairly simple for Java programmers to simply use % MyBean mybean = new MyBean() ; mybean.setSomeVar( "somevalue" ) ; % instead of jsp:useBean...? but the useBean tag is much easier to use for non-programmers. I guess another possibly more important reason to use the useBean tag is that it hides the specific implementation of 'bean' scoping from the programmer. What happens if suddenly, behind the scenes, the way that application scope beans are stored/retrieved is changed in a future JSP release or implementation? If you have hardcoded java code in your JSP pages (eg getServletContext().setAttribute( key, value ) ) then chances are you have a very large search/replace task on your hands. If you instead used the 'usebean' tag then you dont have anything to worry about. -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Kayser William Sent: Tuesday, December 07, 1999 6:03 AM To: [EMAIL PROTECTED] Subject: Re: What's the use of [jsp:useBean tag]? Yes, I've always wondered this myself. Surely we're all missing something very obvious... Bill Phil [EMAIL PROTECTED] on 12/06/99 09:58:42 AM Please respond to Phil [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: (bcc: Bill Kayser/Worldstreet) Subject: Re: What's the use of [jsp:useBean tag]? As I understood it, Heiko was asking why use JSP tag jsp:useBean... when you can do the same by creating an instance of the java "bean" object... (the original e-mail subject line may have sent the conversation in a different direction). It seems the jsp:useBean tag is redundant. According to the specs, a bean is just a java component, requiring "serialization support" and "get/set accessors." According to the-wally-project tutorials, "JSP is an html friendly servlet." Other than limits imposed by design preference, what ever you can do in a servlet you can do in JSP, including: % MyBean mybean = new MyBean() ; mybean.setSomeVar( "somevalue" ) ; % So, why use JSP tag jsp:useBean...? Phil -Original Message- From: Cory L Hubert [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Monday, December 06, 1999 7:25 AM Subject: Re: What's the use of beans? What you suggested would be fine if you want to bang out a whole project in a perl/hackish fashion. But if you want to be able to reuse code, in your project and in others the best way to do it is by encapsulating code in beans. -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Heiko Gottschling Sent: Sunday, December 05, 1999 7:10 PM To: [EMAIL PROTECTED] Subject: What's the use of beans? Hi, I'm wondering what's the use of beans with JSP. In my (humble) opinion, beans are useless... everything I can do with beans can be done with "normal" java objects as well. For example, jsp:useBean id="myBean" class="MyBean" scope="session" can easily be replaced by % MyBean myBean = new MyBean(); session.put("myBean", myBean); % Moreover, beans obviously have some disadvantages: - the syntax is very awkward. Instead of writing jsp:setProperty name="myBean" property="prop" value="val" I can write myBean.setProp("val"), which seems much smoother - Construction of beans seems to be limitied to using the (argument-less) standard constructor. Constructors with arguments are not supported. - Using jsp:setProperty, only String properties can be set. If I want to set any other properties, I have to access the bean directly anyway. So, I'd really like to know what's the big deal about beans? I would rather write my JSP pages without using beans, but I'm wondering if I'm missing something? What's the reason that beans were introduced to JSP in the first place? Are there any situations in which the use of beans provides a real advantage over the "traditional" approach? thx Heiko === 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 === 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
No Errors. No Data?!*
I just switch from jsp .92 to 1. I did a little test to see how it reacts to beans. I get no error. And I get no data back from the bean. What could be wrong? --JSP--- html head titleBean Testin/title /head body jsp:useBean id="BeanTest" scope="session" class="harman.BeanTest" / jsp:getproperty name="BeanTest" property="name" / jsp:getproperty name="BeanTest" property="title" / jsp:getproperty name="BeanTest" property="company" / /body /html --BEAN - package harman; public class BeanTest extends Object { private String name = "Cory L Hubert"; private String title = "Site Developer"; private String company = "Plumb Design"; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTitle() { return title; } public void setTitle(String Title) { this.title = title; } public String getCompany() { return company; } public void setCompany(String company) { this.company = company; } } === 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
Re: Request for HTTP documentation, tutorials, and/or workshops
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, December 06, 1999 10:00 AM Subject: Re: Request for HTTP documentation, tutorials, and/or workshops David Chisolm writes: I was having a very strange caching problem - different from the kind normally posted here, and I needed to really understand how caching directives are supposed to work. [ ... ] error. Of course, everything worked just fine in IE. (For the version conscious, I tested this with NS 4.08, 4.5, 4.6 4.7, and IE 4.0 5.0) Hm, are you sure? I've seen some really odd behavior with IE5 not obeying caching directives. Particularly annoying is that both NS and IE seem to always cache POST arguments no matter whether the pages before and/or after the POST are no-cached. Anyway, the only headers that I set now are: response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control","no-cache" ); response.setHeader("Cache-Control","no-store" ); This fixed the problem, and my pages do not go into the cache. Hm, I didn't have the no-store header, and from what you said, the expires header actually caused a problem? Well, at least given the way that I was specifying the date value, it was causing a problem. I was told later that Netscape is very picky about date values and would only work with the standard date format (though the spec says clients should respect zero ('0')). Here's the message that I got about Netscape and Dates: You say everything works OK in Netscape if you leave out the setDateHeader() call. This reminds me of a similar problem I had with Netscape. It's pretty picky with the date format (it actually expects it to follow the relevant standard), so toString() of the Date class (which I suspect your code indirectly uses) won't do. Try to set up a SimpleDateFormat - it's quite easy. This piece of code works for me: DateFormat df = new SimpleDateFormat("EEE, dd MMM yy HH:mm:ss z"); df.setTimeZone(TimeZone.getTimeZone("GMT")); Date now = new Date(); String nowPlus= df.format(now); // Unfortunately SimpleDateFormat throws in a TimeZone // of "GMT+00:00", and we only need "GMT". We therefore // must get rid of "+00:00" like this: String nowOK = new StringTokenizer(nowPlus, "+").nextToken(); You may of course format all Dates this way. Morten Norby Larsen [EMAIL PROTECTED] Magister Ludi Multimedia Lab Phone: +39 02 26 11 72 80 Via Battaglia 8, I-20127 Milano, Italy Fax: +39 02 26 11 67 33 http://www.magisterludi.com I'll have to try it this way. Steven J. Owens [EMAIL PROTECTED] [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
Q:File Upload How To
Hi, folks! I'm thinking about how could be made in JSP(or servet) technology a (secure)HTTP file upload mechanism. I mean the server side part, the bean(s). On the other hand, secure HTTP is supported by JSP(Sun implementation)? Could this be really done in JSP working with Sun's jsp engine? Any ideas, suggestion, hints, links are welcome. Thanx in advance, Victor --- FREE! The World's Best Email Address @email.com Reserve your name now at http://www.email.com === 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
Jason Hunter's File upload servlet
Has anybody seen this recent problem (I've only seen it with IE5 so far) that appears with Jason Hunter's file upload servlet (actually com.oreilly.servlet.MultipartRequest): The servlet throws: Corrupt form data: no leading boundary So, I put in a trace, and I sometimes have no problem with the upload and the first line matches the boundary. But in the exception condition, they are not quite the same... DEBUG: boundary: -7cf2bca2f8DEBUG: length: 6552Read first line: -7cf280a2f8 Is this a new bug with IE5 under some unknown circumstances? After all, I can repost the form and it will work just fine. There's something odd since I had not seen it before for several months of using the Hunter class. David
Re: What is the Default page that gets loaded forJavaWebServer2. 0.
in the jswdk 1.0 and later look at the welcomefiles setting in the webapp.properties file that should be in the WEB-INF directory of your web app. mine is: welcomefiles=index.jsp,index.html,index.htm but i can be whatever you want cheers, chris chris wilson {phone} tel + 616.471.9142 fax + 616.471.6900 {email} [EMAIL PROTECTED] {web} http://www.wondergeek.com -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Rick L Sample Sent: Monday, December 06, 1999 4:35 PM To: [EMAIL PROTECTED] Subject: Re: What is the Default page that gets loaded forJavaWebServer2. 0. Is that the default page most use for starting their apps? Or, can we make a webserver config change? Thanks! "Martin Leboeuf" [EMAIL PROTECTED] 12/06/99 01:58PM It should be server_root/public_html/index.html where server_root is the directory in which you installed JWS, which is JavaWebServer2.0 by default (for the 2.0 version). Martin Leboeuf [EMAIL PROTECTED] -Original Message- From: Rick L Sample To: [EMAIL PROTECTED] Sent: 12/6/99 1:47 PM Subject: What is the Default page that gets loaded for JavaWebServer2.0. I am running using jswdk-1.0.1to learn JSP,beans,etc. We will be using JavaWebServer2.0 but no access to it yet. I looked in the webserver.xml and startserver.bat but could not fine. In IIS, it is default.html then, default.asp if HTML does not exist, or define our own. So, when a user comes in to a JavaWebServer2.0 site like, www.myDemo.com, what is the first page that fires? [EMAIL PROTECTED] TIA === 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 == = 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 == = 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 === 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
Re: Q:File Upload How To
Take the oreilly classes (www.servlets.com) for files uploading. -- Steve Nguyen KBMail Java Servlet Hosting Provider http://www.ebpcs.net - Original Message - From: Victor Vasilica [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 07, 1999 7:12 AM Subject: Q:File Upload How To Hi, folks! I'm thinking about how could be made in JSP(or servet) technology a (secure)HTTP file upload mechanism. I mean the server side part, the bean(s). On the other hand, secure HTTP is supported by JSP(Sun implementation)? Could this be really done in JSP working with Sun's jsp engine? Any ideas, suggestion, hints, links are welcome. Thanx in advance, Victor --- FREE! The World's Best Email Address @email.com Reserve your name now at http://www.email.com === 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 === 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
Re: Jason Hunter's File upload servlet
Jason, Sure, lucky to be able to keep IE5 out while the rest of us must suffer ;-) Well, the file upload worked just fine on your site. That's not really surprising, since the errors we were seeing did not even include a file to be uploaded (the uploaded file is optional on our form), but about 7 form fields and one bigger TEXTAREA input form. The total uploaded data was only about 6k. I was able to work around the problem just by not throwing that exception. Instead, I just output an error and then continue on, and things seem to work okay even when the error message is produced. It's definitely hit or miss, since I can use the form several times under IE5 without any problem, and then it occurs. I have a hunch it's somehow related to new sessions/cookies, but only because it seems to occur more when a fresh session is created than not, yet it doesn't always seem to be for that reason. (I'm using an older JRun running the 0.92 JSP spec until I can get enough breathing room to move forward). The code change I made was as follows in readRequest() // Verify that the line is the boundary if (!line.startsWith(boundary)) { // throw new IOException("Corrupt form data: no leading boundary"); System.err.println("Corrupt form data: unexpected leading boundary -- trying to continue??"); System.err.println("Corrupt form data: boundary = " + boundary); System.err.println("Corrupt form data: first line = " + line); } I had no idea what would happen, but it seemed to work. However, I don't know if it will really work even if there is a file to be uploaded too. The boundary and line have different numbers to define their parts. David - Original Message - From: "Jason Hunter" [EMAIL PROTECTED] To: "David Wall" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, December 06, 1999 5:55 PM Subject: Re: Jason Hunter's File upload servlet David Wall wrote: Has anybody seen this recent problem (I've only seen it with IE5 so far) that appears with Jason Hunter's file upload servlet (actually com.oreilly.servlet.MultipartRequest): The servlet throws: Corrupt form data: no leading boundary So, I put in a trace, and I sometimes have no problem with the upload and the first line matches the boundary. But in the exception condition, they are not quite the same... DEBUG: boundary: -7cf2bca2f8 DEBUG: length: 6552 Read first line: -7cf280a2f8 Is this a new bug with IE5 under some unknown circumstances? After all, I can repost the form and it will work just fine. There's something odd since I had not seen it before for several months of using the Hunter class. Yes, I've started to get reports on this now and then, only from people using IE5. So if you're using IE5, please do a test upload to http://www.servlets.com/book/examples/ch04/upload.html (50K max) and email me privately with your "yea" or "nay" success results. Explanations and solutions you come up with by looking at the MultipartRequest code are welcome too. :-) (I don't have IE5 installed anywhere, and would like to keep it that way.) -jh- -- Jason Hunter [EMAIL PROTECTED] Book:http://www.servlets.com/book 2.0 to 2.1: http://www.javaworld.com/jw-12-1998/jw-12-servletapi.html 2.1 to 2.2: http://www.javaworld.com/jw-10-1999/jw-10-servletapi.html === 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
New to JSP
Hello, I have been using servlets for quite some time.We also use Javascrit for client side validation of the fields etc. I am curious to know whether JSP is only a server side solution . Does the scipting gets executed on the client side to offer an alternative to client side Javascript. If not then is javascript a good combination with JSP for client side execution. Regards Pankaj === 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
generically passing info to included JSP files
Below is an example to describe a design problem I am having Lets say I have a customer.jsp that displays surname, first name etc. customer.jsp includes address.jsp. Another Jsp, phone.jsp is included 3 times within customer.jsp, allowing the user to enter up to 3 phone numbers for a customer. The customer details are stored in a bean -- CustomerBean CustomerBean has a few methods for getting the details. The details are returned as XML String getCustomer() String getAddress() String getPhones() Now I need to somehow let each phone.jsp know what phone number to display. My main problem is that phone.jsp can call customerBean.getPhones() but doesnt know what phone numbers have already been displayed by other 'instances' of phone.jsp included on the same page. I would rather have one phone.jsp included on a page multiple times rather than have phone1.jsp, phone2.jsp etc. Anyone have a solution to this problem? Thanks. === 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
getRequestDispatcher
Hi guys, I've been trying to getRequestDispatcher working in my servlet with JSDK 2.0 and it doesn't seem to work. Is it because I must use JSDK 2.1 or is there anything else I am missing? I have Apache, JServ and GNUJSP 1.0 configured. If someone could help me out. Thanks! Fran === 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
Re: New to JSP
Oops. Forgot to mention that JSP is purely server side. -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of pankajg Sent: Tuesday, December 07, 1999 4:03 PM To: [EMAIL PROTECTED] Subject: New to JSP Hello, I have been using servlets for quite some time.We also use Javascrit for client side validation of the fields etc. I am curious to know whether JSP is only a server side solution . Does the scipting gets executed on the client side to offer an alternative to client side Javascript. If not then is javascript a good combination with JSP for client side execution. Regards Pankaj === 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 === 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
Re: New to JSP
JSP scripts are executed in the server. JavaScript could be used for JSP scripting (if the JSP engine supports it), but this is not what you seem to want (client side scripting). pankajg [EMAIL PROTECTED] wrote: Hello, I have been using servlets for quite some time.We also use Javascrit for client side validation of the fields etc. I am curious to know whether JSP is only a server side solution . Does the scipting gets executed on the client side to offer an alternative to client side Javascript. If not then is javascript a good combination with JSP for client side execution. Regards Pankaj === 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 -- Message To Spammers -- Game Over! Get spam-free email at http://www.MsgTo.com === 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