Html Editors and JSP
Hi all, what experience do you have of editing jsp pages using Html Editors like Dreamweaver? Any recommendations? The only answers in the faqs I can find say no tools support jsp directly yet (linked from java.sun.com) Thanks Jari Worsley === 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
Custom Tags
> (Was Re: client-side validations with JSP) You mention custom tags. I presume we're talking about using the taglib stuff in 1.1 here.. I'm starting to do this myself, with the aim of getting rid of all "code" from JSP pages, to try and ease graphic designer/programmer relations... ;). The idea being to write custom tags for loops, array access, indexed property access (not supported by jsp:getProperty) and the like E.g. Some table stuff in here - perhaps using jsp:getProperty on a bean instance If the "repeat" tag sets the bean to point to the correct instance in the collection, then a table can be build directly. Even better still, there is NO code in the page at all. I'm hoping that this will work wonders for integration with tools like Dreamweaver and the like. How much work have others done with custom tags? How stable is the spec ? I am using SJSP as the JSP implementation, with Apache 1.3.9 and JServ in support (plus jdk 1.1.6). Seems ok at the start, I'm wondering if anyone has found any "gotchas" later on? Does anyone know if it's possible/ desirable to extend the JSP tld and implementation directly? (or is this something that is SJSP implementation dependent?). thanks Jari Worsley > > In a JSP 1.1 environment, I'd be more likely to write a custom tag to emit this > code, but the basic idea is the same -- the code you create depends on the state > of your bean properties. > > > > > David > > > > Craig McClanahan > > === > 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: Html Editors and JSP
Ross, Thanks, perhaps let everyone know how it goes when you try it? (230mb ouch ;) That is ok for development, but what I need is something that a completely non-technical graphic designer can use to create jsp pages. Basically we (programmers ;) will create pages that work functionally, but with my design skills will be about as attractive as a bulldog chewing a wasp.. They then get massaged by the design team (and cycle round this loop) to look sexy, and actually use things like colours, and more than one font size etc.. So what I need is a designers tool that leaves jsp syntax alone, but can work with the html content of the page. Jari Ross Dyson wrote: > Saw a message the other day about the Oracle Java IDE (JDeveloper) > supporting develop and DEBUG of JSP pages. Just now finished downloading > the 230 MB of it, haven't tried it yet. === 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
Model 2.0, JSDK2.0 possible?
Aaaagh, having great fun with all the different versions of things flying around at the moment :) Question is: Is it possible to do "model 2" style of programming with servlet api2.0? i.e. if I send a request to a servlet (controller), I then want to forward the request to a jsp page (view) after doing some processing in the servlet, and adding beans etc to the request/session/application. How can this be done? >From servlet api 2.1 on there is a RequestDispatcher interface with forward(request, response) and include (request, response) methods, so you can forward on to another resource.Can this be done somehow in 2.0? I am using Apache1.3.9, with Jserv1.0 something and SJSP (because it has support for some of the JSP 1.1 features). A problem is that JServ only supports the 2.0 servlet api... I think I can work around it by doing an include from the jsp page.. blah blah and then using... rest of page But I would rather be able to call the servlet first, to decide where to redirect to (seems cleaner and more configurable somehow) Thanks Jari === 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: Model 2.0, JSDK2.0 possible?
Thanks, I'm wondering whether another approach is viable. SJSP works with Apache and JServ, so it is working with the servlet 2.0 api. This means the guys (or guy? :) who wrote it has sorted out the include/forward problem to be able to implement the jsp:include and jsp:forward tags. Perhaps using the SJSP servlet base class could work - i.e. for my "controller" servlet subclass off the sjsp servlet class, making sure doGet, doPost etc call the _jspservice method, and then use the PageContext.forward and .include methods from within the control servlet. Fairly disgusting I know, but it just might work :) Not sure of the architecture of SJSP and if this will work though :( ... I can but try. Jari BTW. There have been some posts about Tomcat - any opinion on how stable this is? How close to a proper beta are the team? The apache.org site only lists nightly builds as available, but it seems some people have been having success... "Craig R. McClanahan" wrote: > > > Out of the box, the only support in the 2.0 API for this would be to use > sendRedirect(), which has performance impacts. You can pass beans in the user's > session (2.0 did not have request attributes, but they would not work across a > sendRedirect anyway so it is not a big deal). > > Some JSP implementations based on 2.0 have implemented custom variations of the > old callPage() method from JSP 0.91 to get around this restriction. Check the > docs on your JSP implementation to be sure what is supported. > > Craig McClanahan === 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: Custom Tags
Mark, thanks SJSP has an xml file jsp.tld which is a tag library definition for the jsp tags themselves, i.e. jsp:useBean, jsp:include etc. I wonder whether you can add your own tags to this library, e.g. to support indexed properties like so: The same effect could be achieved by using a custom library . and similarly ... I guess I'm just being obtuse by wanting to alter the base jsp library ;) Jari > > >Does anyone know if it's possible/ desirable to extend the JSP tld and > >implementation > >directly? (or is this something that is SJSP implementation dependent?). > > I'm not sure I understand the question here, perhaps because I'm not > familiary with SJSP. Could you elaborate on how you want to extend > the TLD and/or the implementation? > > - Mark A. Kolb Staff Engineer >[EMAIL PROTECTED] Tivoli Systems Inc. >http://www.cross-site.com (512) 436-1955 > > === > 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
Servlet 2.0API ,JServ and Apache(was Re: Redirect w/ JSP)
see below Cor Ruiten wrote: > > getServletContext().getRequestDispatcher("/somepage.html").forward(request, Isn't this only for people running on Servlet Api 2.1? The 2.0API doesn't have the Request Dispatcher class. You may say why not upgrade, well, if you're using JServ and Apache together, then JServ only supports the 2.0 api. Any other suggestions for servlet engines to run with Apache? Thanks Jari === 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
Virus Alert...
Just thought you'd better know... you've been infected with a vb script virus, and this caused your mail client to send a mail to the jsp-interest mail group hosted by Sun. The alert and description from our Systems Manager are listed below: Sun - can you deal with this please? Need to remove the email from the list archive at least, and if possible block any more with the subject "Check this" coming through the listerv address? Hope this stops people getting done by this virus... Jari Worsley Hyperlink === All, Yet another virus has been received by the company. Please read the description of the virus below. Should your PC become infected with this or any other virus please call systems immediately. Name: VBS/FreeLinks Aliases: VBS/Freelink, VBS.Freelinks, VBS.Freelink, Freelink/VBS Type: Visual Basic Script worm Resident: No Comments: This virus is an encrypted VB Script virus that spreads itself by e-mail, network drive sharing and IRC client scripting abilities. The virus spreads as an e-mail message with subject "Check this". The message text is "Have fun with this cool links", and the message attachment is the actual virus. If the attached VBS script (LINKS.VBS) is run, it displays a message "This will add a shortcut to free XXX links on your desktop. Do you want to continue ?". If the answer is yes the virus creates a .URL file that contains a link to an adult website. The virus makes changes to the Windows registry so C:\WINDOWS\SYSTEM\RUNDLL.VBS is run every time the infected computer is rebooted. The RUNDLL.VBS file checks if there are mIRC or PIRCH IRC clients installed and if any of these are, the virus creates a SCRIPT.INI or EVENTS.INI file which sends the virus to other users on the same IRC channel on a JOIN channel event. If there is a shared network disk drive, the virus will copy itself to the drive and therefore spread through a network. The virus attempts to create and send the above e-mail message to all entries in the user's Outlook address book. Regards Nick. Nick Folkes E: [EMAIL PROTECTED] Systems Manager T: +44 20 7240 8121 Hyperlink Plc F: +44 20 7240 8098 M: 07747 604730 === 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: Casting strings returned by input elements...
Your problem is a JSP corker - nothing to do with JSP as an implementation, but the fact that if you're writing scriplets, then you're outside of a Java IDE with no compiler/parser support. s1.getBytes is trying to get the method getBytes as a variable, rather than: s1.getBytes() - to call the method. As I said, an easy mistake when you've got no tool support to write the script :) If you wrap any functionality you need in a bean (either stateful or a stateless "controller" bean), then you can develop these in an IDE and get all the tool support you need. Jari Jeff Brown wrote: > I'm working with some COM objects that only accept bytes. However, the data > I'm trying to send is in string form (sent by form input elements). In ASP > this was not a problem since VBScript auto-casts everything. Java's a bit > pickier and my knowledge of Java is shaky at best. I've tried: > > <% string s1, s2; > s1=request.getParameter("someString"); >s2 = s1.getBytes; > %> > > This returns the error: "Attempt to reference method getBytes in class > java.lang.string as an instance variable." > > There's gotta be an easier way to do this :) > > > Jeffrey W. Brown > Test Engineer > Citr!x Systems, Inc. > PHONE: (954) 267-2846 > EMAIL: jeff.brown @ citrix.com > > The information contained in this message is confidential and may be > legally privileged. It is intended solely for the addressee. Access to > this message by anyone else is unauthorized. If you are not the intended > recipient, any disclosure, copying or distribution of this message, or > any action or omission taken by you in reliance on it, is prohibited and > may be unlawful. Please immediately contact the sender if you have > received this message in error. > > === > 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: web app programming specifications query
I've been doing something similar. If you right a stateless bean to act as a "controller" bean, and then call this at the top of the page, then you can write business and control logic in this bean - it acts like a dispatcher for the request coming in, almost like calling a servlet first ala Model 2. It also means that if there are any beans you want to use in the processing of the request, then you can "cheat" and use the jsp engine to set their properties like: < cheat by using JSP :o) <% vcontrol.processRequest(request, pageContext); // do control logic %> // grab results out of processed request There are problems of course, but it's kind of like a Model 1.5 ;) - as much code is out of the page as possible. Also, it works with the 2.0 servlet api, which lacks the Requestdispatcher class, and so the ability to forward requests to other servlets in the engine. If you're really fussy, I suppose you could put the processRequest call into a separate jsp that you include in the page - like: (in pseudo jsp :) usebean - setup initial beans I take the Model 1 approach as well because of its relative simplicity and > amount of work that is done for you behind the scenes. I also ensure that > as little code as possible is placed into the .jsp pages themselves and is > instead put into Java Beans. So far, this approach has worked very well for > us (and is currently running a commercial ASP application on the Web). > > Scott === 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: beans & multi-threading
Session scope beans are available to a user and their browser session (I'm 99% sure that one session corresponds to connection from one browser program). So if a user has two browser windows open accessing pages on your site, then they can potentially create simultaneous requests that access the same bean in session scope. So session beans need to be thread safe. > I don't understand why beans with session scope should be thread safe. > Could you explain this more in depth ? (With an example if possible ?) > > Thanks in advance, > > Peter Collette > > === > 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: OFF TOPIC (but good java trivia)
you could try JProbe - I used the evaluation to profile a graphical app in Java. Quite useful but you do have to pay if you want it for longer than the month. Also I haven't tried it with servlets, so not sure how well it integrates. Jari Bosch Ricardo wrote: > Anyone have an example of how to do a profile > > ie > java -prof myclass > > thanks > -rick > > === > 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: Any JSP sites I can use as a reference?
Walmart.com seems to make use of jsp quite extensively. Not sure what the back end is (I don't work for walmart). Seems a fairly major site to use jsp... (i.e. it's big). Anyone at Walmart read this group and feel like commenting?? Jari Duffey Kevin wrote: > Hi, > > I was wondering if anyone has JSP pages I can show my boss as a reference === 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: Urgent
Please, please, please read the faq referenced at the bottom of every list message before posting. It really does provide answers, and that's what it's there for "Frequently Asked Questions"... It gives you lots of answers on what jsp is, and how to sue, with references to other good sites. Sorry to all for ranting, but this list is getting very busy - with off-topic postings, "unsubscribe" messages ;) and simple questions answered in the faq (not quite so heinous a crime), and I must have got out of the wrong side of bed this morning (the grumpy side). Jari Rao Dadi wrote: > Hi All, > > I am New to JSP. I want to Know how to use Anchor, Including a file, > Including an img file,Running an Ordinary JavaBean from JSP. Any help is > Highly Appriciated. > Satya > > === > 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
Open Source tag library?
Ok, here goes... Tomcat's out. Great stuff and working well so far. Tomcat now allows us to use jsp 1.1, with the corresponding support for tag libraries. Are there any plans to develop an open source set of tag libraries? I can think of things that would be useful to have to further the separation between the jsp page designer and the servlet/bean developer, like tags for dealing with loops, building tables, dealing with boolean conditions in code (an "if" tag?). So how about it? How about an open source tag library? (Partly addressed to Craig C. and others from the tomcat team that are so active on this list). And how about a name for it? What about "caxton" in respect of the printer sounds ok to me - any other cheesy names ;)... Jari Worsley === 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: extra "returns" in generated page
That does seem a pain - 1200 bytes, ouch (just about fill up an early ZX spectrum ;). I've seen others do this - sjsp for example and Tomcat does too. It may be the way you're writing the templates ? Have you checked whether the code generation is just putting in CR/LF to match those in your template? i.e. If you have the code: <% (output some stuff) %> <% (output some different stuff) %> Then you might expect output of: (output some stuff) (output some different stuff) Rather than <% (output some stuff) %><% (output some different stuff) %> (output some stuff)(output some different stuff) So have you checked whether it's just putting in the CR/LF to match those in the human readable template? If so - you then face the pain of having one line templates ! yuk If not then I'm a bit stumped. If not, then is it just trying to "make pretty" the generated html? Jari George Pearson wrote: > > I've noticed that an extra "return" character is added to *every* line in my > jsp-generated pages. The uncompiled pages contain a carriage return > and linefeed on every line of HTML; the generated page contains TWO > carriage returns and a linefeed on every line. > > Why does this matter? The pages I'm generating are in WML, Wireless > Markup Language, and there's a limit of roughly 1200 bytes that can be > sent in one page. Thus every byte is worth its weight in gold. I can > easily remove the extraneous returns from my source files, but I also > need to eliminate those introduced by the generation process. > > Anyone know how to do it? > > I'm seeing this using jsp pages under Java Web Server 2.0 running on > Windows NT. (The same happens with jhtml pages with the latest JWS 1.1 > and with JWS 2.0 on NT.) > > === > 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 Architectural Question
I too followed the thread, some good ideas here - keep them "open" in this forum and we can all use them :) As we're back onto this, I've got a few questions below about responsibilities and behaviour. It'd be good to get opinions of those "at the coal face" who have written large jsp projects. > The general organization of request processing in my apps goes like this: > > * Input form is created by a JSP page (normally using beans > found in the user session to remember previous input values). > > * When the user presses submit, the form is posted to a servlet > with a URL that lets the servlet figure out what processing is > required (see below for more on this). > > * Servlet receives the request, figures out which action class to use, > and calls that action class. The action class is usually very short -- > its main purpose is to serve as an adapter between the HTTP request > view of the input parameters and the bean properties (and method > calls) that implement the business logic. > > * The action procedure stores the results of its processing as either > request beans or session beans (depending on how long the results > need to be alive). It sounds indeed like the "Adapter" pattern out of the Gang of 4 Design patterns book. So "Actions" are presumably very light weight classes, and stateless? However: Clarification here for the architecture. Do you - implement business processing inside the action classes, or do you - use the action merely to turn an html request into a sensible, sanity checked and validated Java method call, and then handle the business logic using a different pattern, like the "command" pattern. The latter approach could be more flexible if there is a need to have many different interfaces onto the same business process logic. I.e. you have stateful business objects, like "Customer", "Order" etc (and why do we _always_ use Customer and Order as the examples... ;), then you have either behaviour on the object, or series of "Processes" that can happen to these objects, like "PrintOrders" (sort of single Use Case granularity). Then the core business object code, _and_ the process control logic can be accessed via JSP (and an "Action" adapter class), or by a windows or unix standalone application, by a batch script etc. The "Action" adapter classes then contain no business control logic at all. How much can this separation happen. And if this approach were followed, what of validation, or authentication? In which layer would you put the authentication logic? On the Action? or on the "Command" classes? or anywehere and everywhere ;) ? > > * The controller servlet then forwards (RequestDispatcher.forward()) > to the appropriate JSP page to display the results. .. and presumably you get the appropriate page from the Action class itself? I wonder if it's possible to do it slightly differently, and allow the Action class to do the forward itself. It is after all in the best position to "know" whether it needs to throw to an error page, or a login page, or display results etc. Also, if the Action is allowed to do the forward itself, then you could potentially chain actions together (Chain of Responsibility pattern). So an "Authenticate" Action can be written. The first time someone hits the authenticate action, it can immediately forward to a login page, then back to the protected action. Subsequent times, the Authenticate action happens transparently, and allows the protect action to run. This "chain" could be extended to include things like site logging, or user tracking etc. What I can't decide is if this behaviour belongs in the "Actions" or whether at a more business focused level (or everywhere). So should actions be chainable? More thoughts on chaining? and action granularity? > > What I normally do is use a single servlet per web application, and then map it to > a filename extension (I like ".go" because it implies motion). like it :) === 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 Architectural Question
Taken a while to get back to this... but more comments below: "Craig R. McClanahan" wrote: > > See below for inserted comments. > > > That is a good description of the way I use actions. They primarily adapt from the > HTTP-centric view of the data (requests with parameters) to the JavaBeans-centric >view > of the data used by the rest of my application logic. Which would allow the replacement of http-centric requests with those for WAP, or interactive tv, or SMS ? or some sort of weird email dispatcher. I've no idea what protocol some of those take, but the point is made :) (Especially if I can play with a Dreamcast or Playstation 11 - purely in the sake of R & D at work of course...) > > have stateful business objects, like "Customer", "Order" etc (and why do > > we _always_ use Customer and Order as the examples... ;), > > That is the curse of e-commerce systems ... everyone knows what they are :-) > > For validation, it works the way I described in my previous response -- the > CustomerBean includes a validate method that returns either an error message string, >or > a null (if everything works right). I have a problem with the validation the way its described. It seams to be more complicated than just having a "validate" method on a CustomerBean. (a "punter" bean maybe ? ;) As was pointed out in another message in this thread, the Customer is potentially a "heavyweight" object. Also, by putting validation logic into the customer, then potentially the customer bean needs to "know" about the UI, which is a _bad_ thing. For example - if you wanted to use 3 drop down boxes to make up a "date control" on a form (for ease of use and a sanity check on the returned values - i.e. no "aldadxfla" :), then you need some way of joining up the 3 values to make one date. This seems like generic code that has no place in a "customer" business object, but is more analagous to the sort of visual controls that Delphi or Swing give you. I can see merit in writing encapsulations like the date example, and others for numbers, currency etc, to come up with a set of "controls" to aid in building and validating a UI. Of course they can only perform a "sanity check" on the value, so that you know when you get a date from a control it will be valid, or when you get a currency or number object it is at least in the range you expected. So I can see two ways of doing this 1. Have a set of server generated "UI controls" (any idea for a better name?), that can perform sanity checking of values, and combine multiple fields on a form to generate one value. Use these to do a "pre-validate" of form values, and aggregation of results from multiple fields to build things like Date objects. Then pass these values to the "Customer" (can't we use "punter") object for the business level validation. 2. Write business object specific view validation classes, like "CustomerView Bean", to deal with the issues brought up above, like dealing with multiple input fields to a single value, and potentially range checking. Any thoughts on this? > Now that servlet 2.2 is out and becoming available, I will happily start using > container-managed security and never have to worry about this stuff ever again. At >the > moment, the integration between the servlet container and your authentication >database > is specific to each container vendor, but it's not too tough to centralize these > dependencies into a single class. Hmmm, back to the specs documents for me again I think... (to check on the container capabilities). > > Great minds think alike! :-) Or fools seldom differ nah, lets go with "great minds"... ;) > > allows the protect action to run. This "chain" could be extended to > > include things like site logging, or user tracking etc. What I can't > > decide is if this behaviour belongs in the "Actions" or whether at a > > more business focused level (or everywhere). > > > > So should actions be chainable? > > More thoughts on chaining? and action granularity? > > > > I've written a lot of applications over the years, and have never really found much > value in "chaining" as you describe at the application level. I prefer to keep my > application layer functionality as simple as possible (although you could say that my > use of the controller servlet to implement authentication checking is sort of >chaining > in the sense you describe). Although you could make a case for things like authentication, logging and other tasks being at an "architecture" level rather than application. I've got no strong opinions here really - write it and see how it goes for some of these things (as long as the main bits a good bean, then you're onto a good start :) > > However, at the server level (I'm currently authoring a proposal for the insides of >the > Tomcat servlet engine in the Jakarta project -- http://jjakarta.apache.org), the > ability to add layers of request processing functionality is very valuable. For Not quite off
Re: check this again...
Seconded on the "no attachments" enforcement. Help to get rid of those bloody "v card" attachments too - "V card", Why? :) Jari > Let's put an end to the discussion. > > Enforce the No-Attachments policy by filtering all attachments. > > > 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: My boss needs convincing.
Well that's a toughy (and a friend and I have just faced the same thing where we work)., Danny Coward from Sun (i think) posted an up to date list of sites using JSP technology. If you look in the archives you can find the whole list, some highlights from it were: rewards.lycos.com www.listen.com www.starwars.com - yes really, the starwars site :) www.enhydra.org www.micron.net (reg.micron.net, smart.micron.net) www.circuitcity.com BV So some fairly major sites using the technology. Starwars.com using it is particularly impressive. and see comments below: > "Todd L. Poole" wrote: > > My boss seems to have the "software engineer" background and is > continuously critical about web technology that I work with. I develop > web application using ASP and a database alone. I am not using any of > my own components. > > Since I am learning java, I am finding it easier to understand and > more logical than Microsoft's programming languages. Absolutely true. - and easier to produce good designs as well. > I would like to > expand into using JSP, Servlets, and Beans, but my boss still thinks > Java is slow and not as efficient as CGI programs written in C. bwuahahaha CGI and C, ha ha. > I > think he is full of it and I would like to go back to him with proven > results from other people using this technology in a situation where > load balancing is an issue. Ok. He thinks he understands code. Right lets see the big gains shall we? CGI and C - process hit each time it runs - database connection hit for each CGI Java/Servlets - NO process hit (so no context switch), no reloading of libraries, no thrashing of memory on the machine, in fact the servlet engine may well be reusing threads, so you don't even have the overhead of thread creation. This can be a _big_ plus for reducing machine load - use connection pooling - getting a db connection is _painfully_ slow. If you want figures, try using a simple query like "select sysdate from dual" against a db (in my case Oracle). On a five second test, repeating the query each time: - get a connection for each query, result 10 invocations. - prepeare a statement and use a connection pool, result 900 invocations. - Yup, TWO orders of magnitude increase by using connection pooling. Other obvious statements are the fact that if you're using a database, your speed will be entirely constrained by your database - after all, when it hits the disk you're then working 1000 times slower than in memory. i.e. the speed increases of compiled C are irrelevant next to the slowness of a hard disk. I can't say who it is, but I'm working on a project now where we're building to scale to millions of users over time. That's not something I would like to even consider doing in CGI and raw C. > > Until I am writing machine code - I will never please this guy, but I > would like to prove him wrong just once with this. > > If you have any input, please share! > > Bored editing HTML pages So find a new boss ;) Jari === 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: C:\CoolProgs\Pretty Park.exe
Since this is the first time I've seen _this_ one on the list, I thought I'd better warn. This is of course a virus (Tracey S. better get your machine checked out...). Usual "don't open it unless a/ you have a death wish b/ you run something like an amiga or acorn ;)" rules apply. Yawn. Suppose its time to kick off the whole "Sun please strip all attachments" thread again. Please Sun, please? Jari Tracey Scott wrote: > > Test: Pretty Park.exe :) > >Tracey Scott > > > Name: Pretty Park.exe >Pretty Park.exeType: unspecified type (application/octet-stream) > Encoding: base64 === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Concepts and vendors
Mohan Radhakrishnan wrote: > >I have faced the same problem with NetDynamics and PowerJ. When the > early release of PowerJ was bug ridden my manager starting blaming Java. > Even now we don't have good remote debuggers for servlets. We don't know Well, if you use Tomcat, then it is possible to launch Tomcat from within your favourite debugger (or alternatively in the debugger you _have_ to use at work). This allows you to set breakpoints etc and debug a servlet through something like JBuilder or Visual Cafe -- Jari Worsley === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Model 2 - Instantiate Action & Call doGet()?
Curses he's right. Quick someone add another layer. (There are no new ideas, only the same patterns repeated over and over...) Kevin Duffey wrote: > > How about Model 3? > or Model 2++ ? or is that a case of "been there, done that..." -- Jari Worsley Senior Programmer Hyperlink plc === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Model 2 - Instantiate Action & Call doGet()?
See embedded comments: "Hines, Bill" wrote: > > Craig, > > I understand. One thing, however - I still was going to have the main > "controller" servlet that was going to do the routine things - check for > login, check for session, etc. Then *that* controller servlet was going to > instantiate the Action servlet and call its doGet(). But as you say, that > would be overkill since the Action servlet would carry a lot of unnecessary > baggage. > > I was thinking of the amount of baggage that the JVM has to create and then garbage collect. And thinking of servlet lifetimes etc. Not sure what you guys think of the following points but: 1. for _really_ high volume actions, if the action is totally thread safe, then you only need to instantiate one object - just ensure the doIt (or whatever it's called) is safe. (and I'm sure we're all doing that anyway). 2. It would be possible to define an action with a "fuller" lifecycle if need be. For example define an Action interface that also has init(ServletContext c) and destroy() methods on it - but I suppose then you might as well right a servlet instead. I can see that doing Model 2 implementations and a framework it is really quite easy to get carried away. Without thought you could end up re-implementing features provided by your servlet engine/ JSP engine. Still, defining a full lifecycle interface for an action would give you the choice of putting all your controller code in the same point (either easy to remember where it is, or a bottleneck - you choose ;). It also makes you independent of the servlet engine for configuration and other issues. That could be an advantage if you need different ways of dealing with failover, or configuration, or restarting parts of a server without having to restart the lot. Examples: - on a heavily used live site, use a "management" interface into your dispatcher to prompt it to reload and recheck its configuration - allowing you to add/change action mappings at runtime without bringing down the server. (although I guess this may not be an issue if you can shut down and restart using load balanced servers to maintain service). I suppose the problem is that you may end up duplicating functionality available from the servlet engine itself, or writing code that should really be part of the next release of the engine (e.g. for Tomcat). Comments? Anyone actually found a need to do this? -- Jari Worsley Senior Programmer Hyperlink plc === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Lists in a JSP
See comments: Jim Preston wrote: > > A question for experienced JSP/bean developers: > > It seems to me that a common task in a JSP is to output a list of some sort > where the contents and length of the list are variable and obtained from a > bean (for example, when creating a pull-down menu of dynamic options). Yup. Over and over again. > And > from what I've read, there's no automatic way to do that (by automatic > I mean something akin to "jsp:getProperty"). So it has to be programmed, > having the bean return an array or an Enumeration (etc.), and then using > a scriplet to loop through the elements. > > But for the same reasons that "jsp:getProperty" is preferred over using > an expression tag to access the bean's "get" method directly, I would > think that there'd be something similar for looping through dynamic lists. > It depends on what JSP spec you are able to use, but we have got round some of the problems by using JSP 1.1, which allows you to write custom tag libraries. this allows you to write tags to deal with things like an Enumeration, or a Java 2 Collection and Iterator. If you get the objects sequentially out of a collection, you can then place them into Page scope, and allow the tag to be used normally within the custom tag. Basically you then get a repeating section of JSP script, repeated for each object in a collection. Don't see how else you do it unless you want to start writing specific html aware tags like "mytag:doTable " or "mytag:doSelect" etc. (and damn I wish I'd blagged a visit to Java One... :( ) -- Jari Worsley Senior Programmer Hyperlink plc === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Custom Tag Scripting Variables
David Castro wrote: > > As I understand it, you'll have to use the object equivalents to these types > (Boolean, Integer, and so on), and then convert them to their base types on an > as-needed basis. I had to do this to set and react to session variables: > > <% if ((Boolean)session.getAttribute("userloggedin")).booleanValue() > { doSomething(); } > %> > > -David Castro > [EMAIL PROTECTED] > I found a nicer way to do this if you're interested. So, if you have something to do on a boolean, do : ~Example: I use this to exclude or include a submit button on a form. It's a bit of an about face in the logic, but it means you can keep to using only jsp tags rather than any script (kinder to graphic designers...). It works owing to the way the useBean tag is implemented, in the example, if "exclude_addbands" is not found in request scope, then everything up to the closing tag is "run". So for your example you could use the presence/absence of a "not_logged_in" object in session scope. Jari -- Jari Worsley Senior Programmer Hyperlink plc === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Model 2 & servlet API version
See comments Tom Gordon wrote: > > I just wanted to warn people of a possible gotcha in moving to the model > 2 pattern. Perhaps people can correct me if I'm wrong, also. It seems > to me that the model 2 pattern doesn't really work with the servlet 2.0 > API. > > I recently tried to implement a model 2 pattern, but had to back off. I > was using Apache + JServ, which has servlet 2.0 API support, and GNU > JSP. > > First of all, there is no RequestDispatcher in 2.0. Yuck. Yes. This is a problem. We started using Apache and JServ, and faced the same problem. We tried an early version of Tomcat (first release of 3.0 AFAIK), but found problems with that too. We have settled on a combination of Apache and Resin now, and that seems to work fine. Using this we are able to use latest servlet API , JSP 1.1 and Java 2. So no problems getting Model 2 to work. All later comments are based on our setup, NOT on using JServ and the earlier servlet API... > > Second, I didn't see any way, from the servlet, to store beans or any > other object in the request object, only in the session object. request.setAttribute("something", new SomeObject()); > > Third, I could not access jsp or html pages in the same directory as the > servlet. For example, I created a servlet zone /myservlet. I could > access /myservlet/MyServletClass, but when MyServletClass redirected to > /myservlet/results.jsp, the jsp page would show up, but no links would > show up (such as images). I could not access /myservlet/somepage.html > directly from the browser. Not sure here, but check configuration of the webserver and servlet engine before chucking out JSP/servlets as an option. > > Fourth, every time I hit the servlet and got the session, it was a > completely new session. I have no idea why this would be the case. > This was why I had to give up using a servlet completely. This shouldn't be a problem. Check whether you are allowing cookies in the browser you use - this is used for the session id. > > To get around this, but in the spirit of separation of java from html, I > am using controller jsp pages. I don't know why these work instead of a > servlet. Maybe I didn't set up apache correctly, or maybe it's the > combination of apache/JServ/gnujsp. Essentially, the action attribute > of a form points to a jsp page, which in turn does validation, talks to > the server proxy, and redirects to the appropriate response page. > > Anyway, I like the controller jsp pages, even if it's a cheap way of > doing a controller servlet. You still get most java code in one page > and most html display code in a separate page. I just stuck a server > proxy object in the session so that all pages could reuse it. A controller jsp page IS essentially a servlet. Turn on "keep generated pages", or whatever the equivalent option is in your servlet engine, and check out what it generates. All it is doing is writing a servlet for you :) > > Yes, I should use a platform that supports the latest API, but for some > people, it takes a while to upgrade for various reasons. > It may well be easier for you to convince "the powers that be" or whoever/whatever is standing in the way of an upgrade. -- Jari Worsley Senior Programmer Hyperlink plc === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Method not found error
See below: Alan Goodenough wrote: > > hi, > > we are in the process of developing an E-Commerce store using JSP, and = > are having difficulty getting our getXXX() methods to work. We can = > retrieve our getPrice() method, but we cannot retrieve the others in the = > same class. Both methods are identical in that they are floats.=20 > > this is the JSP calling the methods (prod_code is passed from the = > previous page) > <% > SWRTstore_product prod =3D new SWRTstore_product(prod_code); > > float price =3D prod.getPrice(); // works fine > float weight =3D prod.getWeight(); // this doesn't work=20 > %> > Looks ok syntaxwise. Have you checked that the class is being reloaded properly by the jsp engine you're using? check for caches, or the .class file in two places on the classpath, etc. There can be some nice gotchas with some of the servlet engines to do with class reloading (or not as the case may be). To be sure you've really got to shut down and restart the servlet engine (which can be a real pain in a production environment). And not wanting to be critical, but speaking from personal (bitter) experience, it is a _really_ bad idea to use floats for prices. Check out using BigDecimal instead - that is if you ever want to consider trading in Turkey, or Italy, etc...! Using BigDecimal also maps nicely to using get/setBigDecimal under JDBC, and to Oracle's number(38,2) type for currency use (among other things). -- Jari Worsley Senior Programmer Hyperlink plc === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Database Record Locking
John Dixon wrote: > The App: > I have a JSP page that collects data from a database and displays it in > textfields. The user can change the data. click OK and the database is > updated. > > The question: How do I lock the record in the database so that another user > cannot change the data whilst this user is in the midst of changing the > data. Using MSSQLServer. _really_ bad plan. Use optimistic locking and when the user commits check to see if the record has changed in between loading and trying to save. Why? Otherwise: 1. User locks record by starting to view. 2a. User goes to lunch and leaves record locked for one hour. 2b. User goes home and leaves locked overnight. 2c. User dies/machine turned off/ whatever and record never unlocked. Basically, given the limitations of http and browsers, doing any form of locking is IMHO a bad idea. You just have no way of knowing when the next request is ever going to come in to unlock/commit changes to a record. Jari -- Jari Worsley Senior Programmer Hyperlink plc === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: Limit on Session variables and Performance
Oh come on guys reads the specs, RTFM, and read through this lists archive. Pathetic question and pathetic bunch of replies. Please do a little research before replying. The session is "SERVER SIDE" only. Cookies or Url rewriting are used to allow the servlet engine to identify a client session. Any objects you put in the session are stored server side only. When a request comes in from a client who holds a session, either the rewritten URL, or the cookie will identify the client's current session in the servlet engine, and hence give you access to the server side session variables. Jari (sorry, just getting a little pissed at the level of questions on this list at the moment. ) Saurabh Banerjee wrote: > > I believe that session information will be stored as cookies at the client > machine and won't cause too much load on the server. > > I think it will be more effecient than doing database calls. > > Saurabh > > >From: Vaishali Joshi <[EMAIL PROTECTED]> > >Reply-To: A mailing list about Java Server Pages specification and > > reference <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Limit on Session variables and Performance > >Date: Fri, 16 Jun 2000 09:14:44 EDT > > > >Hi All Java gurus > > > >Does anyone has any idea about performance of a site if lots of information > >is stored in a session. There may not be too many sessions at one time, but > >in one session lots of information (around 100 variables) will be stored. > >Some of the information will be too long too as description. > >We are having a tabbed web application, and the issue is whether to store > >the information in a database as we move from one tab to another or should > >we store it in session. Putting it in database will be like lots of calls > >to -- Jari Worsley Senior Programmer Hyperlink plc === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: JavaOne presentations from the Java Platform Group...
see below Eduardo Pelegri--Llopart wrote: > > Well, we are back from JavaOne. Congratulations to everybody on a > very well done job. Servlets and JSP were everywhere. It was very > nice to be around the floor and see these technologies in real > products; not just in products whose goal was to support the Well, for my 2 cents worth, and to add to the body of JSP based sites out there, have a look at www.ecrowd.net which went live recently. (using Model 2, Linux and Resin). And no this isn't intended as marketing related spam, just from one Java bigot to a host of others ;) I almost feel that I should include a link in the credits to some of the very helpful contributors to this list. You know who you are, Craig, Danny, Hans and a host of others. Thanks for the insight and sharing. Shame i couldn't get to JavaOne :(. thanks Jari -- Jari Worsley Senior Programmer Hyperlink plc === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets