ERROR!!! ~JSP CODES~

Any problem with the following jsp code?
<%@ page import="
java.io.*,
java.util.*"
%>
<%
boolean login_ok = false;
Boolean result_obj = new Boolean(login_ok);
result_obj = (Boolean)request.getAttribute("result");
login_ok = result_obj.booleanValue();
%>
<html>
<head>
<title>Login results page</title>
</head>
<body>
<%
if (login_ok){
%>
<p>Login Successful!</p>
<%
else{
%>
<p>Login Failure!</p>
<%
%>
</body>
</html>
It returns the following error:
Exception in jsp: null
java.lang.NullPointerException
     at _0005ctest_0002ejsptest_jsp_3._jspService(_0005ctest_0002ejsptest_jsp_3.java:71)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:868)
     at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
     at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:255)
     at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:360)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:868)
     at com.gefionsoftware.server.ServletContextImpl$ServletHandler.call(ServletContextImpl.java)
     at com.gefionsoftware.server.ServletContextImpl.executeServlet(ServletContextImpl.java)
     at com.gefionsoftware.server.ServletContextImpl.execute(ServletContextImpl.java)
     at com.gefionsoftware.server.GenericServer.execute(GenericServer.java)
     at com.gefionsoftware.server.lws.LiteWebServer$RequestHandler.run(LiteWebServer.java)
     at se.pureit.util.ThreadPool$WorkThread.startRunnable(ThreadPool.java)
     at se.pureit.util.ThreadPool$WorkThread.run(ThreadPool.java)

Hope you are getting a null-pointer exception here :
result_obj = (Boolean)request.getAttribute("result");
login_ok = result_obj.booleanValue();
Make sure that the request attribute value is not null.
Hope this helps
Santhosh

Similar Messages

  • Error While running the JSP Code

    This is the error message:
    A java exception has occurred during the processing of this request.
    Error occurred in JSP element starting at line number 20
    javax.servlet.jsp.JspTagException: I/O Error: java.net.SocketException: Connection reset
         at desisoft.jsp.tagext.SendMail.doAfterBody(SendMail.java:213)
         at desisoft_jsp_SendMail_jsp1139292195218._jspService(desisoft_jsp_SendMail_jsp1139292195218.java:111)
         at desisoft.server.JspBaseClass.service(JspBaseClass.java:48)
    The JSP code:
    <%@ taglib prefix="blx" uri="/blx.tld" %>
    <HTML>
    <BODY>
    <%
    // Get username.
    String email = request.getParameter( "email" );
    %>
    <% if ( email == null || email.equals( "" )) { %>
    Please enter an email address.
    <% } else { %>
    <blx:email host="mail.xxx.com" from="[email protected]">
    <blx:emailTo><%= email %></blx:emailTo>
    Thank you for registering with us. You registered the
    following name: <%= request.getParameter( "username" ) %>
    Your registration was received at <%= new java.util.Date() %>
    Attached, please find a contents file.
    </blx:email>
    <!-- Also write out some HTML -->
    Thank you. A confirmation email has been sent to <%= email %>
    <% } %>
    </BODY>
    </HTML>

    This is the error message:
    A java exception has occurred during the processing of this request.
    Error occurred in JSP element starting at line number 20
    javax.servlet.jsp.JspTagException: I/O Error: java.net.SocketException: Connection reset
         at desisoft.jsp.tagext.SendMail.doAfterBody(SendMail.java:213)
         at desisoft_jsp_SendMail_jsp1139292195218._jspService(desisoft_jsp_SendMail_jsp1139292195218.java:111)
         at desisoft.server.JspBaseClass.service(JspBaseClass.java:48)
    The JSP code:
    <%@ taglib prefix="blx" uri="/blx.tld" %>
    <HTML>
    <BODY>
    <%
    // Get username.
    String email = request.getParameter( "email" );
    %>
    <% if ( email == null || email.equals( "" )) { %>
    Please enter an email address.
    <% } else { %>
    <blx:email host="mail.xxx.com" from="[email protected]">
    <blx:emailTo><%= email %></blx:emailTo>
    Thank you for registering with us. You registered the
    following name: <%= request.getParameter( "username" ) %>
    Your registration was received at <%= new java.util.Date() %>
    Attached, please find a contents file.
    </blx:email>
    <!-- Also write out some HTML -->
    Thank you. A confirmation email has been sent to <%= email %>
    <% } %>
    </BODY>
    </HTML>

  • 500 error with no JSP code

    I'm using Orion as my server. I've got an app with a couple of JSP's. One JSP is welcome.jsp and runs JSP code fine. The other is navigation.jsp and it doesn't have ANY JSP code at all, but it still produces an internal 500 error when I browse to it....
    Any suggestions?

    A 500 error code usually indicates that there was some problem with the server itself. For example, Tomcat will report 500 if it is unable to find the Java compiler it needs.
    I'm not at all familiar with Orion, and never heard of it before today, but you may want to see if they included some sample JSP code, and if so, test to see if that code works. You might also double check that you've followed all of the instructions they set forth. In particular, pay attention to where to find error messages (usually in a log file).
    One potential gotcha that seems to plague lots of developers is spaces in file names. If you installed Orion in something other than the default directory, and your preferred directory has a space somewhere in the path name, it's possible that the Orion developers didn't take that into account and as a result, some of their stuff works correctly and some doesn't.

  • Is there a way of embedding JSP code in VBScript?

    I am launching MS Excel using VBScript in the JSP Page. I want to populate the spread sheet with the values coming from a Java Bean. I am not sure how I can embed JSP code in VBScript.
    Thanks

    I tried doing that with Javascript but it gives me error..
    here is the code I was testing..
    <script language="JavaScript">
    function test(){
    var name = <%=(bean.getName())%>;
    alert(name);
    </script>
    <input type="button" name="Button" value="test" onClick=javascript:test()>
    Error : Object Expected
    If I do a similar thing with VBScript, it doesnt work either.
    here is the test code for VBScript
    <SCRIPT LANGUAGE="VBScript">
    sub button1_onclick()
         dim name = <%=(bean.getName())%>
    ' Launch Excel
    dim app
    set app = createobject("Excel.Application")
    ' Make it visible
    app.Visible = true
    set rng2 = wb.Activesheet.Range("A1").Resize(2,2)
    rng2.value = name
    ' Give the user control of Excel
    app.UserControl = true
    end sub
    </SCRIPT>

  • How to use protected method in jsp code

    Could anyone tell me how to use protected method in jsp code ...
    I declare a Calendar class , and I want to use the isTimeSet method ,
    But if I write the code as follows ..
    ========================================================
    <%
    Calendar create_date = Calendar.getInstance();
    if (create_date.isTimeSet) System.out.println("true");
    %>
    ============================================================
    when I run this jsp , it appears the error wirtten "isTimeSet has protected access in java.util.Calendar"

    The only way to access a protected variable is to subclass.
    MyCalendar extends Calendar
    but I doubt you need to do this. If you only want to tell if a Calendar object has a time associated with it, try using
    cal.isSet( Calendar.HOUR );

  • Jsp code not being executed in browser

    Even though my applications deploy and redeploy, I can see .html files but not .jsp files. The server presents the path, i.e. http://localhost:7001/ITDC/index.jsp, but the jsp code is either not being compiled and exceuted in a client browser or the .jsp is being compiled but not executed in the client broswer.
              

              Akilah <[email protected]> wrote:
              >Even though my applications deploy and redeploy, I can see .html files
              >but not .jsp files. The server presents the path, i.e. http://localhost:7001/ITDC/index.jsp,
              >but the jsp code is either not being compiled and exceuted in a client
              >browser or the .jsp is being compiled but not executed in the client
              >broswer.
              How about you tell us exactly what happens, and what you expected to happen. I
              can't tell if you're getting error messages, or whether you just don't see what
              you expect on the screen.
              Note that JSP code is not ever executed in the browser. It's only ever executed
              in the appserver, and the generated output is viewed in the browser.
              

  • How declara a method in my jsp code?

    I have the following method.
    Somebody knows as there is to declare it in my jsp code?
    Thanks.
    public String reemplaza(String i,String ci,cf)
    String o=i;
    while(o.indexOf(ci)!=-1)
    { o=o.substring(0,indexOf(ci))+cf+o.substring(indexOf(ci)+ci.length(),o.length()); }
    return o;
    }

    Compare the codes and you see the errors.
    //Before(with errors)
    public String reemplaza(String i,String ci,cf)
    String o=i;
    while(o.indexOf(ci)!=-1)
    { o=o.substring(0,indexOf(ci))+cf+o.substring(indexOf(ci)+ci.length(),o.length()); }
    return o;
    //After(with no errors):
    public String reemplaza(String i,String ci,String cf)
    String o=i;
    while(o.indexOf(ci)!=-1)
    { o=o.substring(0,o.indexOf(ci))+cf+o.substring(o.indexOf(ci)+ci.length(),o.length()); }
    return o;

  • Redirect to error.jsp

    Hi,
    I am getting Http 500 Internal server error from tomcat. I have follwing Jsp fragment, that is throwing this error.
    <c:if test="${ empty userId}">
         <c:forEach var='thisCookie' items='${cookie}'>
         <c:if test='${thisCookie.key == "NWPUSERNAME"}'>
    <c:set target='${SharedCookieBean}' property='val' value='${thisCookie.value.value}' />
              <c:if test='${SharedCookieBean.valid == "true"}'>
         <c:set target='${UserBean}' property='userId' value='${SharedCookieBean.username}' />                
                   <c:if test='${SharedCookieBean.fflag == "true"} || ${UserBean.userFlag == "true"}'>
                   <c:redirect url="error.jsp?error=2" />               
                   </c:if>
         <c:set target='${UpdateUserAuthenticatedBean}' property='userId' value='${SharedCookieBean.username}' />
    <c:set target='${SetSessionParamsBasedOnUserIdBean}' property='req' value='${pageContext.request}' />
    <c:set target='${SetSessionParamsBasedOnUserIdBean}' property='userId' value='${SharedCookieBean.username}' />
    </c:if>
    </c:if>
    </c:forEach>
    </c:if>
    This happend when I give a bogus userid say xdf which is NOT present in the database during the authentication. server sends error 500, which i like to suppress and rather redirect to error.jsp(My redirect attempt in above code is NOT working). It does not redirect to error.jsp. It shows errro 500 Internal server error in the browser.
    any help in redirecting it correctly to error.jsp??
    pp

    My guess would be there is an exception happening in the database lookup code. If you set a generic errorPage for your jsp page, you should be able to redirect properly.
    Where does this occur - when you set the SharedCookieBean value?
    You might also try the <c:catch> tag. Put it around the bit of code creating the error.
    eg...
    <c:catch var="except">
        // the bit of code that creates the exception
       <c:set target='${SharedCookieBean}' property='val' value='${thisCookie.value.value}' />
    </c:catch>
    <c:if ${not empty except}">
      An exception occured - <c:out value="${except.message}"/>
    </c:if>Cheers,
    evnafets

  • Upload file jsp code doesn't work? How can I debug

    Hi Everyone,
    I have the following jsp code that simply adds a new product to the backend database when 'Continue' button is pressed.
    if( "Continue".equals(fp.getParameter("Submit")) ) {
         fp.setParameters(prodForm);
         prodForm.setCreateBy(currentUser.getUserID());
         prodForm.save();
         String filename = fp.getFilename("file");
              if( filename != null ) {
              // a file was uploaded
              // set the path to save it
              fp.setFilePath(PHYSICAL_PATH + "uploads\\");
              // we will change the filename to make sure it is unique
              // need to keep the file type
              String fileType = "";
              try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
              catch( Exception e ) { fileType = ""; }
              fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
              prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
              prodForm.save();
         db.close();
         response.sendRedirect("index.jsp");
         return;
    }The code works fine but the upload doesn't work. This is the upload part of the above code:
    String filename = fp.getFilename("file");
              if( filename != null ) {
              // a file was uploaded
              // set the path to save it
              fp.setFilePath(PHYSICAL_PATH + "uploads\\");
              // we will change the filename to make sure it is unique
              // need to keep the file type
              String fileType = "";
              try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
              catch( Exception e ) { fileType = ""; }
              fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
              prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
              prodForm.save();
         db.close();
         response.sendRedirect("index.jsp");So if the file browser, <input type="file" name="file">, has a file, then it saves the file in the upload folder and saves the filename in the database. But it doesn't work, it doesn't save the file in the upload folder nor it saves the filename in the database. I am new to java and jsp so could you tell me what error checking or deguging I can do in jsp to spot the problem.
    Thanks,
    Zub

    where u write the code to upload the file
    to server end?

  • Why can see the jsp code in browser?

    Q1:
    I just setup completely the oracle application server downloading from OTN website.
    I have created a new OC4J instance 'appweb' in enterprise manager wizard form.
    I can look at the jsp code on the browse when I request the demo application instance.
    I try to deploy a WAR into the 'appweb' container that is been builded by the JBuilder 7 IDE,
    then I can't request all jsp page ,as the browser is normal getting the error 404 message ,but
    the jsp page is sure of.
    Q2:
    I want to change the http server Port ,but the application server can't been taken any request
    servies if change the Port number '7777' in the http.conf file. why for this ??? Be sure , I
    didn't change other configuration parameter.
    Please help me!
    thinks.

    Allaire JRun '%00' or '%2570' could allow an attacker to view the source code of JSP files
    Description:
    Allaire JRun is a program development suite used to create Web applications with Java Server Pages (JSP files) and Java Servlets. JRun versions 3.0 and 3.1 could allow a remote attacker to view the source code of known JSP files on the Web server. A remote attacker could send to the JRun Web Server (JWS) a URL request appended with '%00' or '%2570' for a known JSP file to cause the source code of the file to be returned.
    Platforms Affected:
    JRun 3.0
    JRun 3.1
    Remedy:
    Apply the appropriate patch for your system, as listed in Macromedia Product Security Bulletin MPSB01-15. See References.
    Consequences:
    Obtain Information
    References:
    Macromedia Product Security Bulletin MPSB01-15, "Patch Available for Revealing Source Code when Accessing a JSP as myjsp%00 or myjs%2570 via the JWS or IIS." at
    http://www.macromedia.com/v1/handlers/index.cfm?ID=22288&Method=Full
    or go to, http://www.iss.net/security_center/static/7676.php
    Sudha

  • Displaying JSP code

    Hey All!!!
    I am creating a JSP page which contains JSP code. However, inside this page, I also want to display the JSP code. How can I do this, without my engine running the code?
    I have thought of using the page directive (text/plain), but this goes for the entire page, and I only want a portion to be eliminated. Any ideas?
    Thanks!!!!
    Aaron

    That definately makes sense. HOwever, using an absolute path just generated more errors.
    In thinking that it may have a hard time reading itself (I wasn't sure if the servlet would lock the file as it's displaying it on the page). So, I created a new file (source.jsp), and inserted the previous code. Inside the filereader argument, I placed (test1.jsp), so that it may read the other file, and display the source.
    However, when accessing source.jsp.... I'm getting a 404 file not found (source.jsp). Even though I have test1.jsp in the argument. It seems I may be missing something. Here is what I have:
    <html>
    <title>Source for test.jsp</title>
    <head>
    <%@ page import = "java.io.*"%>
    </head>
    <body>
    <p><p>Generated with the Source code:
    <hr>
    <%BufferedReader in = new BufferedReader(new FileReader("examples\test1.jsp"));
    String line = "";%>
    <pre>
    <%while((line = in.readLine()) != null){%><%= line %><%}%>
    </pre>
    </body>
    </html>

  • How to close a window of IE7 using jsp code

    Hi,
    Can any one suggest how to use window.close method for closing a window of IE7 , presently i am using below code for logging off a page but i am recieving an error saying object expected and some text undefined , can any one let me know what extra code is required to be added in below jsp code  for logging of a window in  IE7
    function logoff()
            if (EPCM.getUAType() == EPCM.MSIE)
                window.returnValue = 'logoff';
            else
                window.opener.logoff();
            closeWindow();
        function closeWindow()
            window.close();
    Thanks
    Abhai

    Hi Abhai,
    In your javascript, you can add a try catch block to check which object is null.
    Also check this:
    Portal user often can't log off because of the Log off window was blocked
    Greetings,
    Praveen Gudapati
    p.s. Points are always welcome for helpful answers

  • How JSP codes residing in js function works

    Hi,
    I would like to check with you how JSP codes residing in js function works.
    How can I get the 2nd select stmt executed based on the values retrieve from 1st select statement and the conditions pass in to this js function
    How can I get the select statement to execute only when a condition is met.
    The following is the codes. It is not executing the 2nd select statement. when I didnt put in the 2nd select stmt, i execute those codes in that portion
    script
    ====
    function test(obj, obj2) {
    <%
    sql_query = "SELECT a1, a2 , a3, a4, a5 "+
    " FROM table_a ";
    try {
    rset = db.execSQL(sql_query);
    catch(SQLException e){
    System.err.println ("Error in query " +e);
    %>
    var po_ln_fnd = false
    <% while (rset.next()) {
    j_a1 = rset.getString("a1");
    j_a2 = rset.getString("a2");
    j_a3 = rset.getString("a3");
    %>
    if ((eval(obj2.value)== '<%=j_a1%>')) {
    if ((obj.value == '<%=j_a2%>') ) {
    <% j_a4 = rset.getString("a4");
    j_a5 = rset.getString("a5");
    sql_query = "SELECT b2, b3, b4 "+
    " FROM table_b "+
    " WHERE b1 = '"+j_a3+"' ";
    try {
    rset = db.execSQL(sql_query);
    catch (SQLException e) {
    System.err.println("Error in query " +e);
    while (rset.next()) {
    String j_b2 = rset.getString("j_b2");
    String j_b3 = rset.getString("j_b3");
    String j_b4 = rset.getString("j_b4");
    %>
    <%}>
    }

    what is the other alternative to produce the same results: (retrieve the data based on the value entered on screen, upon onChange, it will chk whether the condition met, if met, will retrieve data from another table and display on the screen - all this is done without the submit button being pressed)

  • Help on jsp code to display data in same page using using ajax ?

    Is there any jsp code to display in same page using using ajax ?

    Re: need help on how to display data in same jsp page. Locking.

  • Error in code generation for deleting table BUT000_TD

    Hi,
    Did anyone encounter this error while working on EEWB ?
    I created the project extension via EEWB and completed the wizard setting with the package (dev. class) value as $temp as I wanted to test it locally.
    One of the errors, that I got is:
    Error in code generation for deleting table BUT000_TD
        Message no. DA464
    Diagnosis
        This error message indicates that internal inconsistencies exist.
    Procedure
        Please consult SAP.

    Hi,
    As I mentioned in my previous post kindly check the consistency of the structure BUT000_TD.
    Regards,
    Sudheer.

Maybe you are looking for