Jsp is stupid

I used to program java/jsp a long time ago. I found php and never looked back. Now I have a job where I will be using jsp again. I started reading about what new and I am amazed(in the wrong way)
Before: very simple output
<%= request.getRemoteHost() %>
after: jsp:getproperties, and c:out
tags? Basically someone in sun hell decided that learning servlets, java and jsp was not enough now lets learn new tags. I can create a class with functions to do the same thing.
I did many jsp applications where all the db code was separated into manager classes and the jsp code contains the display code. I never had to use any special tag.
Why the java community keep complicating the languaje instead of making it simpler? PHP does it, why can't JAVA???
I really would like someone to tell me what are you gaining by complicating the language??
Thank you

JSP is not technically a language. It's a way to code web sites with Java. Java, in turn, is a lot more powerful and advanced than PHP. It's only natural, since Java has been in development for much longer than PHP has.
JSP and Java are meant for larger applications. While Java is an agile language, it's not as agile as PHP for small applications. With PHP, wou can code small things very fast.
PHP is suiteable for small scale applications, because it's so incredibly cheap, in both time and money, to get started with. Add to that that the learning curve is very small, and you instantly have the #1 language for one-man websites.
However, once you start growing into a mature and more advanced web application, PHPs agility instead becomes it's own worst enemy, and you have to do a lot of extra coding to get the infrastructure needed that JSP and Java already has in place from the beginning. PHP is also very problematic in the sense that it completely lacks a standard approach to development, which causes loss of time when you are dealing with many developers.

Similar Messages

  • In the same page: One SyncBO, two tables, and navigation in both, can i?

    Hi, i have a doubt, i´m doing an app, in one screen i want put the data in two different tables depend an attribute... Up here all correct,but the problem is navigation.
    How can do an independent navigation of the two tables?
    Thanks,

    Ok, because I still not see the issue here - you can develop whatever you like, so why should I implement something that does effect a table when I do not want to effect that table..... Anyway, what would you like to do exactly with that button? Perhaps then I understand your problem.
    Still:
    You have one table. There you display the items with field value X. Ok, and when you press a button you want them to be -
    removed from the client?
    Well, to be honest. JSP is stupid. It does not know when you press the button, what values are displayed there. Only when it is a button of a form and the form was informed about the GUID of these items - then you can work with these GUIDs. I think in your case the easiest way it to say: If I press the first button, then please do this and that on all elements that contain an X in the field, and if I press the second button, do something else on all items without an X in the field. So the easiest way is to do the select statement again in the coding.
    Hope this helps to solve the issue.
    Regards,
    Oliver

  • Stupid Error in Compiling JSP on Tomcat 4.1

    Hi,
    I know I am missing something stupid, but I am not able to compile/view a simple JSP.
    The code of the JSP is
    <%@ page language="java" import="builder.*" errorPage="" %>
    <html>
    <%builder.MenuBuilder menuBuilder = new builder.MenuBuilder("http://amitabh.pic.com.kw/navmenu.xml", out, "\t\t\t");%>
    <head><body>
    <%menuBuilder.generateHTML();%>
    ..And I am getting the following error
    [javac] Since fork is true, ignoring compiler setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler setting.
    [javac] E:\ApacheGroup\Tomcat4.1 \work\Standalone\localhost\aktest\NavTable_jsp.java:7: package builder does not exist
    [javac] import builder.*;
    [javac] ^
    [javac] E:\ApacheGroup\Tomcat4.1\work\Standalone\localhost\aktest\NavTable_jsp.java:54: package builder does not exist
    [javac]     builder.MenuBuilder menuBuilder = new builder.MenuBuilder("http://amitabh.pic.com.kw/navmenu.xml", out, "\t\t\t");
    [javac] ^
    [javac] E:\ApacheGroup\Tomcat4.1\work\Standalone\localhost\aktest\NavTable_jsp.java:54: package builder does not exist
    [javac]     builder.MenuBuilder menuBuilder = new builder.MenuBuilder("http://amitabh.pic.com.kw/navmenu.xml", out, "\t\t\t"); [javac] ^
    [javac] 3 errors
    The above mention code are the only JSP script on the page.
    I have package builder defined under WEB-INF\classes and the class MenuBuilder and all related classes are in the pacakge and are compiled.
    I am using Tomcat 4.1.24 running on JDK 1.4.1 (build 1.4.1_02-b06).
    Other JSP pages in the same context which does not reffer any class under WEB-INF\classes are being displayed so are pages under examples context.
    Can anybody help me out on what i am missing.
    Thanks in advance
    Amitabh

    Hi,
    AFAIK, builer package shoud be under WEB-INF\classes directory or the context. It is under that direcory.
    As far as adding the package to system classpath or Tomcat classpath, I dont want to do that as it would contaminate the classpath of other applications/contexts.
    The applications server is supposed to automatically add WEB-INF\classes into the classpath of the context. And its working for other context.
    There has to be other solution.
    Regards
    Amitabh

  • In limbo between Leopard and Snow Leopard - stupidly didn't back up

    I've got an old-school black MacBook, about four years old now. I never cared enough to upgrade it to Snow Leopard, but now I want Lion. So, I borrowed my parents' five-license Snow Leopard install disc and started off on the journey to upgrade to Snow Leopard, download the App Store update, then download and install Lion. I didn't get far.
    First, let me say that I didn't back up my hard drive. Like an idiot. Yes, I know it was stupid, so there's no need to say anything. My previous installs (a few clean re-installs) have gone without a hitch, so I figured I'd trust Apple and just run the installation without backing up. Dumb.
    The Snow Leopard installation started fine, but was interrupted when the installer said the install failed. Restart, try again. Booting from the install DVD, things seemed to be going fine a second time around -- picked my language, got to the install set-up screen, picked Macintosh HD as my installation drive. And then things stopped working. The installer said my HD could not be written to and that it needed repair. So I went to Disk Utility to try that. Repair Disk wasn't available, so I clicked Verify Disk. That got interrupted when it said the disk needed to be repaired, after which the Repair Disk button was clickable. Tried to repair, but apparently my HD is screwed beyond the capabilities of Disk Utility.
    I tried to reboot the MacBook from the HD, which Disk Utility said still had Leopard running on it. The computer wouldn't boot up. Safe Boot didn't work. So, without any other real options, I thought I'd try my luck by just trying the install again. Booted up from the install DVD, and ran into the same issues. Didn't magically fix itself, of course. So my MacBook is stuck in limbo between Leopard and Snow Leopard, won't boot from the HD and won't let me repair the disk when booted from the DVD. What do I do?
    I plan to try a couple third-party disk-utility programs tomorrow (8/25/11) to recover the files on my HD. There's not much I care about on there (just some iPhone photos and my resume, really), so doing a clean wipe of the HD and installing Snow Leopard is an option. But I'd of course rather be able to recover my personal files. Is this possible at this point?
    Another question I have regarding a clean wipe: If I end up having to clean off the HD and lose all my data, I'll lose the iTunes configuration for my iPhone. Will iTunes be able to import my apps and settings from my phone if I plug it in?
    Thank you very much.

    For a hard drive try Newegg.com http://www.newegg.com/Store/SubCategory.aspx?SubCategory=380&name=Laptop-Hard-Dr ives&Order=PRICE
    Or OWC  http://eshop.macsales.com/shop/hard-drives/2.5-Notebook/
    Here's instructions on replacing the hard drive http://creativemac.digitalmedianet.com/articles/viewarticle.jsp?id=45088
    Here's a cheap SATA external hard drive case on eBay http://cgi.ebay.com/USB-2-5-SATA-HDD-HARD-DRIVE-EXTERNAL-ENCLOSURE-CASE-BOX-/120 636286623?pt=PCC_Drives_Storage_Internal&hash=item1c167ba69f

  • How to disable Format Warning when displaying JSP in Excel under MS-Office

    We have an application running in WebSphere 6.0 container, the application displays jsp data in Excel, it had no problem before MS-Office 2007 was install. However, after MS-Office 2007 is used, following format warning dialog box is always displayed:
    The file you are trying to open, ’Requests[1].xls’, is in a different format than specified by the file extension.
    Verify that the file is not corrupted and is from a trusted source before opening the file.
    The user has to click the "Yes" button before the Excel report can be successfully displayed. This is not acceptable by our production users, and I need your helps to get rid of this dialog box.
    The application uses struts. The Action class retrieves data from database and the data is forward to the result jsp
    in an data object set in an attribute of the session's Request object. The Action class also set the display info, such as the contentType,etc., in session's Response object (please see below for details).
    The result jsp retrieves data from the data object and display in Excel according to the display info provided in the
    session response object.
    To eliminate any possible problem that may be caused by the data, I have simplified the result jsp by removing original
    codes (such as data object forwarded from Action, and Tag Library, etc.), and just hardcoded few data for displaying in Excel, however, the same format warning box still always shows up.
    My Action class set display info as below:
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Expires", "0");
    response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");
    response.setHeader("Pragma", "public");
    response.setHeader("content-disposition","attachment; filename=Requests.xls");
    My simplified result jsp is listed below:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <!-- <%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt'%> -->
    <TITLE></TITLE>
    </HEAD>
    <BODY>
    <TABLE border="1">
         <TBODY>
         <TR>
         <td><p align='left'>myData1</p></td>
         <td><p align='left'>myData2</p></td>
         <td><p align='left'>myData3</p></td>
         <td><p align='left'>myData4</p></td>
         </TR>
         </TBODY>
    </TABLE>
    </BODY>
    </HTML>
    So, I reduced the result jsp to contain only few hardcoded data, but the format warning always shows up. Is it caused by inconsistency between the MS-Office 2007 browser and the JSP engine in WebSphere 6.0 Web container? Need your help to resolve this problem.
    Thanks in advance.

    That's the caveat of fooling your webbrowser and Excel with a plain HTML page along an Excel content-type and Excel extension.
    Don't do that. That's plain stupid. Provide a real binary Excel file. You can create one using Apache POI HSSF or Andy Khan's JExcelAPI. Alternatively -and more recommended in case of large reports-, just use the CSV format. It's easy to create a CSV file in 20 lines of code and Excel perfectly understands CSV formats. Don't forget to change content-type to CSV.

  • How to address form controls in jsp page

    Hello,
    I have a very stupid question. How do i empty the textfield value in my jsp page. I know that i can make a function that does that. but i dont know how to adress the control. Its got to be something like txtfield.setValue("myvalue") but i just dont know
    i cant find anything either on the internet. can somebody help me plz?
    thx very much,
    Kim

    Hi Kim,
    You can use the following JavaScript command:
    document.nameField.value = theValue;
    You can use this on submit of the form or in a click event at the field.
    I hope it be useful

  • JSP works in IE 7 and Opera 9.1 but not Firefox 2.0

    Hi everyone,
    I have a JSP with a form and a list box. When the user selects a value in the list box the form is submitted:
    <form id="ampForm" method="POST" action="AMPSearch">
        <fieldset>
            <p>
                <label for="amp">
                    Actual Medicinal Product Search Result:
                </label>
                //Here is where I think the problem lies the "onchange" method does not appear to be recognised by Firefox.
                <select size="10" name="amp" onchange="ampForm.submit()" class="listbox">
                    <c:out escapeXml="false" value="${requestScope.ampList}" />
                </select>
                <input type="hidden" name="ampList" value="<c:out escapeXml="true" value="${requestScope.ampList}" />" />
                   </p>
            <p>
                <label for="ampp">
                    Actual Medicianl Product Pack Sizes:
                </label>
                <select size="10" name="ampp" class="listbox">
                    <c:out escapeXml="false" value="${requestScope.amppList}" />
                </select>
            </p>
            <c:if test="${!empty requestScope.amppList}">
                <p>
                    <label for="quantity">
                        Quantity:
                    </label>
                    <input type="text" name="quantity" value="" />
                    <input type="submit" value="Add Order" name="addOrder" />
                </p>
            </c:if>
        </fieldset>
    </form>This all works fine in IE7 and Opera 9.1 and Netscape 8.1 when it is set to display like IE, but not in Firefox 2.0 or when Netscape is set to display like Firefox.
    Does Firefox not recognise the "onchange" method? What should I use instead? Any help would be much appreciated.
    Tom

    Not to worry people, I have done it again.
    For some reason when I post on here a few minutes later I figure the problem out even though I have been struggling with it for ages.
    The form should have had name="ampForm" not id="ampForm". Stupid thing.

  • Writing java code in JSP

    Hi All
    I dont know which one of the following is more effective in JSP
    writing java code like <% out.println("Hellooo "); %>
    OR
    writing like <%="hello" %>
    I shall be very much thankful to all those who spare their valuable time to clarify my doubt. I hope my question is not a stupid one.
    Thanks
    Elisha

    when both gives the same out put, why there are two for the same out put?Because it is easier to do this:
    Hello <%= userName %>
    than this:
    Hello <% out.println("userName"); %>
    Also there is a BIG difference in readability and maintainability of the JSP page. JSP pages are all about having html, and a few "fill in the blank" spots. The less <% scriptlet code %> you put on your JSP page, the better. If you want to run java code, do it in a servlet/bean.
    With the advent of JSTL, scriptlet code in JSPs should be a thing of the past.

  • Writing an XML file from JSP

    Hi
    for some this question will seem to be a stupid, but i am really confused how can i write an XML file from with in JSP code. should i have to use same FileOutPutStream.
    Actually i am trying to make reports using Jasper api. It demands for an XML file which will then b converted into PDF file. Can any one help me in it.

    Jasper converts a JSP into a servlet - and cannot be used to generate PDFs.
    Assuming this is for a web application I would
    1. Generate the XML
    2. Generate the PDF from the XML
    3. Send the PDF to the client from a servlet (i.e. forget the JSP).
    Step 2 is actually quite complicated - you could do this manually with the IText API (http://www.lowagie.com/iText/) or use an XSL approach with Apache FOP (http://xmlgraphics.apache.org/fop/)

  • Two managed beans in same jsp page

    Hello
    First this could be a stupid question, but i just can't find a solutions on this problem.
    I wondering that could it be a two managed beans in same jsp page, here is a example:
    index.jsp
    <t:commandLink disabled="#{listBean.currentPage == 1}" id="previous2" type="button" immediate="true" style="font-size:small" action="#{listBean.previousPage}">
    <h:outputText value="Edellinen" id="prev"/>
    </t:commandLink>
    <t:commandLink disabled="#{listBean.currentPage == listBean.totalPages}" id="next2" type="button" immediate="true" style="font-size:small;" action="#{listBean.nextPage}">
    <h:outputText value="Seuraava" id="next"/>
    </t:commandLink>
    then i have a dataTable like this:
    <t:dataTable value="#{customerListBean.customerBeans}"
    binding="#{customerListBean.dataTable}" preserveDataModel="true" style="text-align:left">
    My problem is that when i push a commandLink it doesn't refresh a dataTable. Does anyone know a solution here or is this just a impossible way to do it?
    Thanks for help.

    when i push nextPage (commandLink) it's call action
    and count a new range of dataset and after that it's
    calls a method which is declared on subClass and that
    method get a new data of database on given params.
    and put it on DataTable.
    So listBean is upper class and customerListBean
    extends on ListBeanNo, it doesn't work that way as you expected. You have created two independent instances. They doesn't communicate automatically with each other or so. Just use one CustomerListBean instance and call the inherited methods of ListBean on the #{customerListBean} managed bean instance.

  • Same variable on every JSP page

    Hi All,
    I'm just a beginner with JSP so excuse me if this is a 'stupid' question.
    I'm building an Application that uses MySQL database everything works ok, but
    I would like to know if there is a way to have a variable that I can use on every page.
    The reason is, is because I have lots of pages (and growing) where I have the
    database connect string with username password, but due to security reason
    the user/pass for the database will change every now and then.
    I'm familiar with Coldfusion and in Coldfusion you can setup an Application.cfm file. This file is called before every other .cfm file. Is there something like that
    in JSP?
    The solution I thought of is, putting the connect string into a session variable.
    Is this a could idea?
    If not, are there any other better ways of achiving this?
    Thanks for any help!
    Steven.

    Are you using Tomcat?
    Because Tomcat supports things like Application.cfm did with CF. They go in web.xml, I believe (I don't use tomcat myself).
    Your database connect (and interaction) should not be handled by individual pages. It should be in a bean, connection pooling (tomcat), JSTL, or other more scalable method (or combination of techniques that works for you). If you put it all in scriptlets, you really limit yourself later.
    I am assuming from your post that the username/pass is the same for all users. If it isn't, use a session-scoped bean to hold that info.

  • jsp:setProperty .. method throws null pointer exception...

    my simple jsp page :
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
        <h1>JSP Page</h1>
        <jsp:useBean id="user1" class="com.netman.beans.UserBean">
            <jsp:setProperty name="title" property="title" />
            <jsp:setProperty name="name" property="name" />
        </jsp:useBean>
        Name : <%= user1.getName() %><br>
        Title : <%= user1.getTitle() %>
        </body>
    </html>
    // -- my bean class -- //
    package com.netman.beans;
    public class UserBean
        private String name;
        private String title;
        /** Creates a new instance of UserBean */
        public UserBean()
        public void setName(String name)
            this.name = name;
        public String getName()
            return name;
        public void setTitle(String title)
            this.title = title;
        public String getTitle()
            return title;
    }when I try to view the jsp page, i am getting the following exception :
    org.apache.jasper.JasperException: Exception in JSP: /test.jsp:25
    22: <h1>JSP Page</h1>
    23:
    24: <jsp:useBean id="user1" class="com.netman.beans.UserBean">
    25: <jsp:setProperty name="title" property="title" />
    26: <jsp:setProperty name="name" property="name" />
    27: </jsp:useBean>
    28: Name : <%= user1.getName() %><br>
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.apache.jasper.JasperException
         org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:359)
         org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
         org.apache.jsp.test_jsp._jspService(test_jsp.java:68)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NullPointerException
         org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:320)
         org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
         org.apache.jsp.test_jsp._jspService(test_jsp.java:68)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    and my request URL is http://localhost:8080/TestApp/test.jsp?title=Super&name=Great
    what could be the problem?

    how stupid i'm..
    instead of using the bean name in setProperty I have used the property name...
    !!!

  • How to use jsp:plugin action with type = bean

    Hi everybody,
    I'm new to JSP so it could be a stupid question but I'm wondering how can I use a jsp:plugin action with a type equal to "bean".
    Everyone is talking about type equal to applet so the browser can display this applet but if the type will be a bean so then
    does it mean I can send a javaBean class to the client?
    If yes, then can the javaBean object be executed on a client machine?
    Or maybe I'm wrong. I don't know how it works.
    Please give me a resolution.
    Thanks,
    Rafal.

    its not working.. it shows exception class not found exception.
    i have placed the jsp and applet class in the same folder. but its not working.
    jsp file path : OracleSpatial\mypackage\webmap.jsp
    applet class : OracleSpatial\mypackage\demoApplet.class
    demoApplet class inside package "mypackage".
    code inside JSP is :
    <jsp:plugin type="applet"
    code="mypackage.demoApplet.class" width = "100%" height = "100%" >
    </jsp:plugin>

  • Import a servlet from JSP without the use of a .JAR

    Migrating web app from NT / iPlanet 4.1 to Solaris / iPlanet 4.1.
    I've created a Web app in which JSPs utilize Servlets stored in a JAR file. I am now moving the app to a server that I do not control. I wish to configure the app in such a way that I will be able to modify the servlets and not have to restart the Web server to see the changes. I assume the only way to do this is to remove them from the JAR file.
    I'm familiar with how to package servlets in JAR files and use them in JSPs, but can't figure out how to import (my own) servlets from outside the JAR file. Is there any way to do this without specifying the servlet in the CLASSPATH?
    ...sorry if it's a stupid question, I'm not a Java programmer. Thanks in advance. Please let me know if I have not given enough detail.

    I've created a Web app in which JSPs utilize Servlets
    stored in a JAR file. I am now moving the app to a
    server that I do not control. I wish to configure the
    app in such a way that I will be able to modify the
    servlets and not have to restart the Web server to see
    the changes. I assume the only way to do this is to
    remove them from the JAR file.Bad assumption! This will have no impact on reloading the servlets!
    What you are asking for is called 'hot deployment'. Not all servers do that.
    Tomcat 4 does for instance, but you have to configure it for your specific webapp to be able to use it.
    Hot deployment just reloads all the classes in its classpath, it doesn't matter if they're in jars or just .class

  • Garbage characters in excel file opened by jsp

              I am storing an excel file as blob in database. While retrieving
              from database when I open in the jsp page , it shows a lot of garbage characters
              and all formatting is lost. I am using content type "application/vnd.ms-excel".
              I am also setting correct mime type in web.xml as application/excel. It is weblogic
              6.1 sp2 with oracle 8.1.6. the pdf and word docs are working well. Please help
              soon.
              Thanks
              

    Download the Open G Toolkit from www.openg.org. There is a VI called Quit Application.vi that works great. I have used it with the very stupid Brooks 0154 SmartDDE Controller program to reset the application.
    Be sure to save the document and close the DDE communication first.
    Michael
    www.abcdefirm.com
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector

Maybe you are looking for