Jsp versus JSP/SERVLET

Hello folks! :)
First of all, I would like to apologize for posting such a question. I suppose with hardly any doubt that it has been raised a lot of times and I feel a little bit ashamed to put it another time... but fact is that I browsed the forum and did not found any real complete and technical answer.
So, here is my question:
I have to convince my technical superior (with concrete fact, numbers if possible!)that using SERVLET/JSP is a better way than using only JSP (which is the way they do thing at the time I post this message - everything is done in JSP).
I did not found any "rocking" argument that demonstrate the benefits of using jsp for application.
Boss said me "Jsp is just hidden SERVLET, so why not using them" and "we do not have complicated FORMS submission to treat, so JSP are good enough." and "graphical department doesn't work a lot on HTML. So no prob with scriplets".
I suppose it's ok for now and for "small" projects; but I sense that in the coming future, that will probably become a problem with bigger project.
So I would like to convince them to start working with servlets now, to avoid future waste of time!
Thanks or your wise upcoming answers!

well, there is a fact that servlets and jsp can be used for exactly the same purpose. A JSP page is through a JSP engine transformed to a servlet. You just put servlet code inside the <% and %>. However, the benefit of using servlets is that it is more like pure java-code, and clean from annoying tags. Using JSP also requires you to learn about the functionality behind tags. Also, in using JSP there are more difficult to control errors. In my experience it is really difficult to know where the fault lies in the JSP compared to the servlet.
I think that it seems like you are quite convinced that servlets are the right choice, and this is what matters if you are the developer.
Good luck,
M

Similar Messages

  • Retrieve values from a table of a JSP page in Servlet.

    Hello all,
    I am new in JSP servlet world, I want to create a grid on JSP page using Servlet.
    Suppose i have some records in a JSP page and This JSP page will display these records in a tabular form. And, on a button click that table data should be
    accessible in servlet,
    Now, How can i traverse among all the rows of that table of JSP page in servlet. or How can i retrieve a specific cell record of that table of JSP page in servlet.
    Can anyone please answer this.
    Thank you and regards.

    Hi,
    Create in your HTML form inputs with the same name i.e.:
    <input name="a[]" value="2" >
    <input name="a[]" value="9" >
    In your jsp page use :
    String Values[] = request.getParameterValues("a[]") ;
    This will give you a string array of two elements.
    for (int x = 0; x < Values.length; x++)
        System.out.println(Values[x]) ;
    }Will print :
    2
    9
    Hope this helps.
    Bill Moo

  • Urgent....How can i redirect to my jsp page from servlet in init() method..

    How can i redirect to my jsp page from servlet in init() method..Becoz that servlet is calling while server startsup..so im writing some piece of code in init() method..after that i want to redirect to some jsp page ...is it possible?
    using RequestDispatcher..its not possible..becoz
    RequestDispatcher rd = sc.getRequestDispatcher("goto.jsp");
    rd.foward(req,res);
    Here the request and response are null objects..
    So mi question can frame as how can i get request/response in servlet's init method()..

    Hi guys
    did any one get a solution for this issue. calling a jsp in the startup of the servlet, i mean in the startup servlet. I do have a same req like i need to call a JSP which does some data reterival and calculations and i am putting the results in the cache. so in the jsp there in no output of HTML. when i use the URLConnection i am getting a error as below.
    java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:707)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:705)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
    nection.java:519)
    at com.toysrus.fns.alphablox.Startup.callJSP(Unknown Source)
    at com.toysrus.fns.alphablox.Startup.init(Unknown Source)
    at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
    so plz do let me know how to call a jsp in the start up of a servlet.
    Thanks
    Vidya

  • Problem with JSP and Java Servlet Web Application....

    Hi every body....
    I av developed a web based application with java (jsp and Java Servlets)....
    that was working fine on Lane and Local Host....
    But when i upload on internet with unix package my servlets and Java Beans are not working .....
    also not access database which i developed on My Sql....
    M using cpanel support on web server
    Plz gave me solution...
    Thanx looking forward Adnan

    You need to elaborate "not working" in developer's perspective instead of in user's perspective.

  • UTF-8: JSP to JSP: okay, JSP to servlet to JSP: fail

    Hello,
    Yes, another guy having problems with UTF-8. I have searched this forum a lot for day, but cannot find a solution that works for me... here it is:
    Requests from JSP to JSP work with UTF-8, but only after adding an old-style <% request.setCharacterEncoding("UTF-8"); %> scripting element. Of course, the page has content type text/html with UTF-8 set.
    Thus, the result JSP correctly shows UTF-8, e.g. umlauts work then etc.
    However, as soon as a servlet is involved, i get data garbage that has nothing to do with wrong fonts etc., per character i get two bytes for special chars.
    I tried to set System.setProperty("file.encoding", "UTF-8"), but that does not work also.
    The strange thing is that this works on my home Debian GNU/Linux system but not at work on WinNT.
    Any ideas?
    Here the setup:
    J2SE SDK 1.4.1_02
    Tomcat 4.1.24
    Windows NT 4.0 German
    IE 5.0 + Mozilla Firebird 0.7
    FYI: the servlet is an inherited Struts class.
    Thank you, Timo

    Hello MamtzGroove!
    You are my hero! I tried all that getBytes() stuff and formatting the sources to UTF-8 etc. and nothing worked. Only when insterting your two statements as is into my servlet, the in works.
    The funny thing is that i had used both statements before, but one in the JSP and one in the servlet and vice versa.
    THANKS! THANKS! THANKS! Can i give you duke dollars without having created this question with this option?!?!
    Greetings + Thanks, Timo
    P.S. but why did this work in GNU/Linux? Does it have to do with other System settings????? An idea?

  • JSP cannot invoke servlet

              Hi,
              I am trying to invoke an applet using the jsp:plugin tag. However, it always comes
              back with the message in jsp:fallback (cannot run java applet). Here is the code
              for my jsp:plugin
              <jsp:plugin type="applet" code="com.eboomerang.rulesadmin.main.AppletMain.class"
              codebase="/functions" archive="srulesadmin.jar,xerces.jar" width=550 height=500
              jreversion="1.3" nspluginurl="http://java.sun.com/products/plugin/1.3/plugin-install.html"
              iepluginurl="http://java.sun.com/products/plugin/1.3/jinstall-131-win32.cab" >
              I am following the exact steps mentioned in the weblogic JSP guide.
              Thanks,
              --Krish.
              

    Shaun,
    Nice to know that you find a way that works. However, what Zsolt suggests should work; otherwise, it is a bug. That is, put the servlet definition and servlet mapping in your web.xml and then you should be able to access http://host:port/myWebContext/servlet/CreateSPSS?myParmName=myParm without seeing a response like "No resource found". Please make sure that your servlet definition come before the corresponding servlet mapping.

  • Accessing String assigned in a JSP from a Servlet?

    Hello all, I was wondering if there is a way to access a String object that was assigned by an HttpSession object in a JSP from a Servlet. What happens is, in my application a user logs in, an HttpSession object is instantiated and all of the user credentials are assigned within a JSP like:
    HttpSession httpSession = request.getSession( false );
    String userName = httpSession.getAttribute("userName);
    ...{code}
    Next, I have a Servlet (which is really just a Proxy to a different server), that I need to log some information with, namely the userName String. Is there a way I can access that String without instantiating another HttpSession object? Because when the timeout occurs (or when the user clears his cache I have found), the HttpSession becomes invalidated (even if I use  +HttpSession#getSession( true )+) and the +HttpSession#getAttribute+ call fails (userName is just null). So is this possible to do?
    Thanks in advance!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    dnbphysicist wrote:
    I understand you cannot recover attributes from a dead session, this is why I wanted to be able to access a variable that is pulled from the Session immediately after login so I can still get to it even once the session is dead.
    Normally a session doesn't go dead after login.
    I imagine that by using application scope the app would confuse the userName with other users that are logged in?Certainly. It was just an example. But your data clearly belongs in the session, so just keep it in the session. If the session get invalidated while it should not get invalidated, then your problem truly lies somewhere else.
    I am definitely not arguing you latter point either :) A lot of this code I inherited unfortunately from previous developers and we are in desperate need of a redesign.I wish you much luck with that.

  • How to pass a object of JSP to a servlet called from JSP

    Hi,
    I am trying to display an image in the JSP through html image tag. I am using Struts Action class to get the image data from the database through a Session EJB. I am getting a byte array for the image retrieved from the database.
    To display the image I need to call a servlet from the JSP from the image tag like this.
    <html:img src="imageservlet" border="0"/>
    But I need to send the image byte [] array data which is available with the JSP to the servlet to build image. I have a bean object with the JSP which holds the image byte []. The servlet should receive the bean object and will use the byte [] and build the image to be displayed.
    My query here is how to send this bean object to the servlet which is getting called from the JSP as shown above.
    Thanks in advance.

    Hi,
    Thanks for your response. I knew it is possible with session objects. But I want to perform this operation with out using session objects. Is there a way to accomplish this with out using Session objects.
    Please help.
    Thanks

  • Generating the JSP from the Servlet source file

    Hi,
    Does anyone out there know if there is any utility/class/program which will generate a JSP from the Servlet Source file (.java file) or indeed from the compiled Servlet file (.class file)
    If its possible to decompile a .class file into a .java file, surely it must be possible to convert the .java souce file into the .jsp file that created it.
    any comments would be appreciated
    Richard

    I am the author of the original JSP!
    But I want to run a script on the generated Servlet source file,
    changing its contents, and then generate the JSP that would have created the new Servlet source file.
    but I need to know if theres anything that will reverse engineer a Servlet source into the generating JSP.
    its a kind of of Jeopardy type thing!

  • JSP refresh from servlet.

    Hi everyone
    I'm creating a web application that is a combination of jsp pages and servlets.
    On one of the jsp pages I add contact details of a person in a form, then when submitted it goes to the servlet which adds the new contact into the database,
    after the servlet entered the data it redirects to the ContactList.jsp page, but it doesn't show the newly created user, I need to refresh the page manually to see the users.
    How can I from the servlet when I redirect to the ContactList.jsp page, refresh the ContactList.jsp page to show the newly created contacts well?
    Here is the servlet which gets called when I submit the jsp form.
    package contacts;
    import javax.servlet.*;*
    *import javax.servlet.http.*;
    import java.io.*;*
    *import contacts.*;
    public class NewContactServlet extends HttpServlet
         public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
              res.setHeader("Expires", "Tues, 01 Jan 1980 00:00:00 GMT"); //no cache allowed
              Contacts contacts = new Contacts();
              ContactsData contactsData = new ContactsData();
              contacts.setContactName(req.getParameter("contactName"));
              contacts.setCompany(req.getParameter("companyName"));
              contacts.setWorkNumber(req.getParameter("workNum"));
              contacts.setCellNumber(req.getParameter("cellNum"));
              contacts.setFaxNumber(req.getParameter("faxNum"));
              contacts.setEmail(req.getParameter("email"));
              contacts.setCountry(req.getParameter("country"));
              contactsData.addContact(contacts);
              res.sendRedirect("ContactList.jsp");
    }

    Hi manuel.leiria
    Here is my code for refreshing the jsp, it is working.
    Just tell me what you think, if it's the right way.
    The servlet that sets the attribute
              session.setAttribute("contactsSession","add");
              res.sendRedirect("ContactList.jsp");The jsp page that gets the page.
              <%
              String refreshSession = (String)session.getAttribute("contactsSession");
              if(refreshSession != null && refreshSession.equals("add"))
                   %>
                   <body onload="window.location.reload(true);">
                   <%
                   session.removeAttribute("contactsSession");
              else
                   %>
                   <body>
                   <%
              %>

  • JSP, Bean, or Servlet?

    I've found that alot of the time, the systems I'm trying to design can use all of these to accomplish the same task. What's a good indicator of whether or not I should be using one technology over another?
    For example, most recently, I designed an html form that is used to create registration html forms for clients. I can send the data in my form to another jsp page, a servlet, or a bean. ALL THREE can accept the date and use BufferedWriter to create and write to the registration form. Why would I want to use one over the other?
    Any help here would be greatly appreciated. I am seriously lacking in proper system design knowledge.

    If you want to use the data all through the user session, posting data to a JSP or a Servlet may require either URL rewriting or using hidden elements to preserve the state.
    Its a better idea to store the data in a ValueObject (a simple java bean with get and set for all the properties).
    You may want to refer to J2EE Patterns to find out more about the patterns you can use to design good server side application.

  • Why we should use JSP instead of Servlet ?

    I want to know what are the advantages to use JSP over Servlet.

    hi
    Servlets are server exctension ( like CGI ) separate executable
    modules to serve any request efficiently.
    Servlets are pure java classes, u can use them the write an html code to browser.
    u have to compile the servlet before u use it.
    JSP page, is a text-base document , u can type html inside it , and u can use java as scripting language, so it is more easy to use jsp rather than servlet as each jsp page is translated into a servlet by JSP engine.
    Hope this will help
    Good luck
    Mohammed

  • Java script problem in JSP called thru servlet

    when jsp page is displayed thru a servlet in following way the java scripts built in that JSP page are not working.
    ServletContext sc = getServletContext();
         RequestDispatcher rd = sc.getRequestDispatcher(url);
         rd.include(req, res);
    how can i enable these java scripts?

    Most probably you have something like this:
    <script language="JavaScript1.2" src="menu.js"></script>
    The bit that is probably causing the problem is the src attribute.
    Its a common issue when using the request dispatcher
    You request "/servlets/myServlet"
    it forwards to "/jsp/myJSP"
    You try and access a resource using a relative URL.
    however, the browser knows nothing about the forward being done - it thinks that the URL is /servlets/myServlet, when you want it to be /jsp/myJSP.jsp
    So if you access menu.js it will look in /servlets/menu.js instead of /jsp/menu.js (example only)
    to fix
    1 - Don't use relative links. Ie use /scripts/menu.js to import the script
    2 - use a <base> tag <base href="http://www.mywebsite.com/jsp/> This tells a web page where to resolve relative references from.
    Hope this helps,
    evnafets

  • R separate personalization classes reqd 4  jsps managed by servlet portlet?

    My portlet is a servlet which manages multiple jsps. This servlet manages the session data as well as navigation between the pages. At the moment, I have separate personalization classes for each of the jsps. Each personalization class extends NameValuePersonalizationObject. The content on each of the jsps has to be managed within the portal.
    Do I need to have separate personalization classses or is it better to have one personalization class for all the jsps within my portlet ?
    Any help would be great, Thanks,
    Tara

    Hi,
    After going through your application scenario, i think you should use just one Personalization Class. A single class would suffice all the four JSPs.
    But, as you might be aware, a Preference Store can only store basic data types like String, boolean etc. Complex Data Types like Properties etc. cannot be stored directly using NameValuePersonalizationObject. If you are storing complex types, then you will have to extend this class & define methods to store & fetch data from this complex object into the Personalization Store.
    You might want to go through the following article which talks about Information Storage using Web Providers.
    http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/articles/overview.information.storage.html
    If there are any further issues, please get back.
    Regards,
    Abhinav

  • Why is a JSP page or servlet (SingleThreadModel) unreachable on iPlanet 6.0 webserver after client abort?

    After client abort (user pushes STOP on the browser, etc.) JSP page or servlet (SingleThreadModel) is unreachable on iPlanet 6.0 webserver. Only a server restart helps. Can anybody help me?

    adsfadsfaf

Maybe you are looking for

  • FLVs created with ADOBE MEDIA ENCODER CS6 do not display thumbnails in ADOBE BRIDGE CS6

    Could you please attempt to shed some light on why FLVs created with ADOBE MEDIA ENCODER CS6 do not display thumbnails in ADOBE BRIDGE CS6, yet apple finder is able to display thumbnails for these same FLVs without issue? I'm running CS6 Production P

  • Supporting full-motion swf files

    Hello, Is there a way to create only one swf file even though the project contains partial full motion recordings? Thank you in adavance for your time and response. Özlem

  • How to call a method written in user control (ascx file) from javascript

    Hi to All, I have one scenario where I need to call a method written in user control (.ascx.cs file) from javascript (ascx file). I tried below code but it is not working,  I found later it works only for aspx or asmx file , is it true ??  Code:  $.a

  • JDBC read stuck if RAC node goes down

    We did several tests with Java applications against our RAC DB and face a hanging application if we power off the RAC node that executes the current (long) running query. We can see that the application receives HA-events via UCP: 2015-01-22 13:02:11

  • Orion i/o test on Ramsan

    hi all, hope this is the right forum for this. I've installed orion on rhel 6 and would like to test it on ramsan drive. there is fresh rhel install without dbms. first I tested it on ssd: cat orion1.lun /dev/sda ./orion_linux_x86-64 -run advanced -t