Re: AW: Why doesn't this work:

2001-06-01 Thread Terje Kristensen

Any idea on how to get rid of this error? 

Terje K.
-- Original Message --
From: Ralph Einfeldt [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
Date: Thu, 31 May 2001 15:46:56 +0200

It looks like request.getParameterValues(paramName)
returns a null value on at least one param.





AW: AW: Why doesn't this work:

2001-06-01 Thread Ralph Einfeldt

String[] paramValues = request.getParameterValues(paramName);

if (paramValues == null) {
  // Do what you want
} else if (paramValues.length == 1) {
  // Do what you want
} else { 
  // Do what you want
}

 -Ursprüngliche Nachricht-
 Von: Terje Kristensen [mailto:[EMAIL PROTECTED]]
 Gesendet: Freitag, 1. Juni 2001 14:12
 An: [EMAIL PROTECTED]
 Betreff: Re: AW: Why doesn't this work:
 
 
 Any idea on how to get rid of this error? 
 
 Terje K.
 -- Original Message --
 From: Ralph Einfeldt [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 Date: Thu, 31 May 2001 15:46:56 +0200
 
 It looks like request.getParameterValues(paramName)
 returns a null value on at least one param.
 
 
 



Re: AW: AW: Why doesn't this work:

2001-05-31 Thread Terje Kristensen

You have understood it perfectly. 

To work around it, I put the url with all the parameters in a variable, then ran 
include on the variable. It worked somewhat, but I got the following output:

 Title Piping and valve material specification  Doc.no. 
L-SP-200  Operator Sec.no. 6
 Material data sheet: VC21  Project.no. Rev.no. D  Rev.date 
17.03.99  Status:  Page: 1 Of: 1 

 Title Piping and valve material specification  Doc.no. 
L-SP-200  Operator Sec.no. 6
 Material data sheet: VC22  Project.no. Rev.no. B  Rev.date 
01.06.94  Status:  Page: 1 Of: 1 

Error: 500
Location: /xsql/tek/advanced_section_result.jsp
Internal Servlet Error:

javax.servlet.ServletException
at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
at 
tek._0002ftek_0002fadvanced_0005fsection_0005fresult_0002ejspadvanced_0005fsection_0005fresult_jsp_38._jspService(_0002ftek_0002fadvanced_0005fsection_0005fresult_0002ejspadvanced_0005fsection_0005fresult_jsp_38.java:129)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)

Root cause: 
java.lang.NullPointerException
at 
tek._0002ftek_0002fadvanced_0005fsection_0005fresult_0002ejspadvanced_0005fsection_0005fresult_jsp_38._jspService(_0002ftek_0002fadvanced_0005fsection_0005fresult_0002ejspadvanced_0005fsection_0005fresult_jsp_38.java:68)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)

Any ideas?

Terje K.




AW: AW: AW: Why doesn't this work:

2001-05-31 Thread Ralph Einfeldt

Have a look at line 68 of
_0002ftek_0002fadvanced_0005fsection_0005fresult_0002ejspadvanced_0005fsecti
on_0005fresult_jsp_38.java
to find the offendind code the jsp.

 -Ursprüngliche Nachricht-
 Von: Terje Kristensen [mailto:[EMAIL PROTECTED]]
 Gesendet: Donnerstag, 31. Mai 2001 13:38
 An: [EMAIL PROTECTED]
 Betreff: Re: AW: AW: Why doesn't this work:
snip/
 Root cause: 
 java.lang.NullPointerException
   at 
 tek._0002ftek_0002fadvanced_0005fsection_0005fresult_0002ejspa
 dvanced_0005fsection_0005fresult_jsp_38._jspService(_0002ftek_
 0002fadvanced_0005fsection_0005fresult_0002ejspadvanced_0005fs
 ection_0005fresult_jsp_38.java:68)
   at 
snip/



Re: AW: AW: AW: Why doesn't this work:

2001-05-31 Thread Terje Kristensen

I don't see anything wrong with it. Do you?




package tek;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.Vector;
import org.apache.jasper.runtime.*;
import java.beans.*;
import org.apache.jasper.JasperException;
import java.util.*;


public class 
_0002ftek_0002fadvanced_0005fsection_0005fresult_0002ejspadvanced_0005fsection_0005fresult_jsp_42
 extends HttpJspBase {


static {
}
public 
_0002ftek_0002fadvanced_0005fsection_0005fresult_0002ejspadvanced_0005fsection_0005fresult_jsp_42(
 ) {
}

private static boolean _jspx_inited = false;

public final void _jspx_init() throws JasperException {
}

public void _jspService(HttpServletRequest request, HttpServletResponse  response)
throws IOException, ServletException {

JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
String  _value = null;
try {

if (_jspx_inited == false) {
_jspx_init();
_jspx_inited = true;
}
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType(text/html;charset=8859_1);
pageContext = _jspxFactory.getPageContext(this, request, response,
, true, 8192, true);

application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();

// HTML // begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(0,32);to=(8,0)]
out.write(\r\n\r\nhtml\r\n\thead\r\n\t\ttitleLSP200 - Section 
Selection - Result/title\r\n\t/head\r\n\tlink rel=\STYLESHEET\ 
type=\text/css\ href=\includes/stylesheet.css\/\r\n\tbody 
style=\font-family:Tahoma;font-size:8pt;\\r\n);
// end
// begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(8,2);to=(18,4)]
 
String opn  = request.getParameter(opn);
Enumeration paramNames = request.getParameterNames();
while(paramNames.hasMoreElements()) {
String paramName = (String)paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
if (paramValues.length == 1) {
String paramValue = paramValues[0];
int length  = paramValue.length();
String fil = advanced_result_ + paramName + 
.xsql?opn= + opn +  + paramName + = + paramValue.substring(1,length) +  + 
paramName + R= + paramValue.substring(0,1);
 
// end
// HTML // begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(18,6);to=(19,5)]
out.write(\r\n\t\t\t \t);
// end
// begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(19,5);to=(19,50)]
{
String _jspx_qStr = ;
pageContext.include( fil  + _jspx_qStr);
}
// end
// HTML // begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(19,50);to=(20,0)]
out.write(\r\n);
// end
// begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(20,2);to=(23,3)]


if (paramValue.length() == 0) { 

// end
// HTML // begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(23,5);to=(23,10)]
out.write(error);
// end
// begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(23,12);to=(29,4)]
 
}
} else { 
for(int i=0; iparamValues.length; i++) { 
int length  = paramValues[i].length();
String fil = advanced_result_ + paramName + 
.xsql?opn= + opn +  + paramName + = + paramValues[i].substring(1,length) +  
+ paramName + R= + paramValues[i].substring(0,1);
 
// end
// HTML // begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(29,6);to=(30,5)]
out.write(\r\n\t\t\t \t);
// end
// begin 
[file=C:\\xsql\\tek\\advanced_section_result.jsp;from=(30,5);to=(30,50)]
  

Re: AW: AW: AW: Why doesn't this work:

2001-05-31 Thread Cox, Charlie
Title: Re: AW: AW: AW: Why doesn't this work:





2 comments:


1. you can insert a 
% try { %
at the beginning of your jsp and then 
% } catch (NullPointerException npe)
{
 System.err.println(***);
 npe.printStackTrace();
}
%
at the end of your code.


This will give you the exact line in the jsp. The line number given in the 'root cause' was not the same for the null pointer that I had.

2. The line
String[] paramValues = request.getParameterValues(paramName);


can return null(if there are no values), and your next line, if (paramValues.length == 1), could be throwing the null pointer exception since paramValues is null.

Charlie


-Original Message-
From: Terje Kristensen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 31, 2001 9:37 AM
To: [EMAIL PROTECTED]
Subject: Re: AW: AW: AW: Why doesn't this work:



I don't see anything wrong with it. Do you?






AW: Why doesn't this work:

2001-05-31 Thread Ralph Einfeldt

It looks like request.getParameterValues(paramName)
returns a null value on at least one param.

 -Ursprüngliche Nachricht-
 Von: Terje Kristensen [mailto:[EMAIL PROTECTED]]
 Gesendet: Donnerstag, 31. Mai 2001 15:37
 An: [EMAIL PROTECTED]
 Betreff: Re: AW: AW: AW: Why doesn't this work:
 
 
 I don't see anything wrong with it. Do you?
 
 
 



AW: Why doesn't this work:

2001-05-30 Thread Ralph Einfeldt

Are there no log messages from tomcat ?

How do you know that the jsp:include ../ is not working?
It might be working and the error is in the included page.

To verify that, you could strip down the included page
to something like:
%
  log(this.getClass().getName() + : I'm included);
%
and see if this message makes it to the log.

Another thing you can check is, if there is a generated
java file and it's compiled version for your included jsp.

 -Ursprüngliche Nachricht-
 Von: Terje Kristensen [mailto:[EMAIL PROTECTED]]
 Gesendet: Mittwoch, 30. Mai 2001 09:30
 An: '[EMAIL PROTECTED]'
 Betreff: Why doesn't this work:
 Could anyone tell my why the jsp:include doesn't work? I'm 
 getting an 500 error. 
snip/



Re: AW: Why doesn't this work:

2001-05-30 Thread Terje Kristensen

I did what you asked me, and the files did get included, but it doesn't tell me much. 
To try an clear what I am trying to do:

I want this url:
http://localhost:8080/xsql/tek/advanced_section_result.jsp?opn=1PCS=0AC10APCS=AAC10A

To do this:
(info 1)
jsp:include page=advanced_result_PCS.xsql flush=true
jsp:param name=opn value=1/
jsp:param name=PCS value=AC10A/
jsp:param name=PCSR value=0/
/jsp:include

jsp:include page=advanced_result_PCS.xsql flush=true
jsp:param name=opn value=1/
jsp:param name=PCS value=AC10A/
jsp:param name=PCSR value=A/
/jsp:include

By doing so:
(info 2)
%@ page import=java.util.* %
% 
String opn  = request.getParameter(opn);
Enumeration paramNames = request.getParameterNames();
while(paramNames.hasMoreElements()) {
String paramName = (String)paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
if (paramValues.length == 1) {
String paramValue = paramValues[0];
if (paramValue.length() == 0) { 
%error% 
}
} else { 
for(int i=0; iparamValues.length; i++) { 
int length  = paramValues[i].length();
String fil = advanced_result_ + paramName + .xsql;
 %
jsp:include page=%= fil % flush=true
jsp:param name=opn value=%= opn %/
jsp:param name=%= paramName % value=%= 
paramValues[i].substring(1,length) %/
jsp:param name=%= paramName %R value=%= 
paramValues[i].substring(0,1) %/
/jsp:include
%
}
}
} %


This gets me an error. If i type in info 1 it works perfectly, but when i try to do 
info 2 gives me an error.

What to do?

Terje 
snip
-- Original Message --
From: Ralph Einfeldt [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
Date: Wed, 30 May 2001 10:31:00 +0200

Are there no log messages from tomcat ?

How do you know that the jsp:include ../ is not working?
It might be working and the error is in the included page.

To verify that, you could strip down the included page
to something like:
%
  log(this.getClass().getName() + : I'm included);
%
/snip



AW: AW: Why doesn't this work:

2001-05-30 Thread Ralph Einfeldt

Sorry, but I'm not shure that I understand right.

To verify that I unstood well so far:
- Your code sniplet (info 2) is from the source 
  advanced_section_result.jsp
- info 1 is the desired effect of the for loop
  in advanced_section_result.jsp
- If you directly use the sniplet info 1 instead of the 
  loop everything works
- If you remove the  inside the include, the code
  that is generated looks like info 1 without 

BTW:

int length = a.length(); 
a.substring(1,length);

is equivalent with

a.substring(1);

 -Ursprüngliche Nachricht-
 Von: Terje Kristensen [mailto:[EMAIL PROTECTED]]
 Gesendet: Mittwoch, 30. Mai 2001 14:25
 An: [EMAIL PROTECTED]
 Betreff: Re: AW: Why doesn't this work:
 
 
 I did what you asked me, and the files did get included, but 
 it doesn't tell me much. To try an clear what I am trying to do:
 
 I want this url:
 http://localhost:8080/xsql/tek/advanced_section_result.jsp?opn
 =1PCS=0AC10APCS=AAC10A
 
 To do this:
 (info 1)
 jsp:include page=advanced_result_PCS.xsql flush=true
   jsp:param name=opn value=1/
   jsp:param name=PCS value=AC10A/
   jsp:param name=PCSR value=0/
 /jsp:include
 
 jsp:include page=advanced_result_PCS.xsql flush=true
   jsp:param name=opn value=1/
   jsp:param name=PCS value=AC10A/
   jsp:param name=PCSR value=A/
 /jsp:include
   
 By doing so:
 (info 2)
 %@ page import=java.util.* %
 % 
 String opn= request.getParameter(opn);
 Enumeration paramNames = request.getParameterNames();
 while(paramNames.hasMoreElements()) {
   String paramName = (String)paramNames.nextElement();
   String[] paramValues = request.getParameterValues(paramName);
 if (paramValues.length == 1) {
   String paramValue = paramValues[0];
   if (paramValue.length() == 0) { 
   %error% 
   }
   } else { 
   for(int i=0; iparamValues.length; i++) { 
   int length  = paramValues[i].length();
   String fil = advanced_result_ + 
 paramName + .xsql;
%
   jsp:include page=%= fil % 
 flush=true
   jsp:param name=opn 
 value=%= opn %/
   jsp:param name=%= 
 paramName % value=%= paramValues[i].substring(1,length) %/
   jsp:param name=%= 
 paramName %R value=%= paramValues[i].substring(0,1) %/
   /jsp:include
 %
   }
   }
 } %
 
 
 This gets me an error. If i type in info 1 it works 
 perfectly, but when i try to do info 2 gives me an error.
 
 What to do?
 
 Terje