Hi gang,
I am trying to convert the ASP file to a JSP file. I am getting an empty
parameter name somewhere deep inside my Java classes and it is throwing an
exception. Can you please take a look at both files and tell me whether both of
them are doing the same thing (or) am i missing some functionality in the JSP
page which is giving me this exception. Thank you.
I don't get this error in asp..
One more thing..initially when i access the JSP page i am getting the below
error in weblogic...
"From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error"
But on the same page when i do a refresh, i get my data perfectly.
btw i am using jsp 1.0 running on WebLogic and/or Jrun 2.3.3. I keep getting the
same error on both the webservers.
submitpage.asp
-------------------------
<%@ LANGUAGE="VBSCRIPT" %>
<%
Dim objUI
Dim sHTML
Dim strUI
Dim strValidation
Dim strObj
Response.Expires = 0
strValidation = Session("vpSecurity")
strUI = Request.QueryString("UI")
strFormUI = Request.Form("UI")
if strUI = "" then
strUI = strFormUI
end if
strObj = "JRP.PageInterface"
'
' response.write("strValidation=" + strValidation + "<BR>")
' response.write("strUI=" + strUI + "<BR>")
' response.write("strObj=" + strObj + "<BR>")
' response.write("Session(LastUI)=" + Session("LastUI") + "<BR>" )
' response.write("strValidation=" + strValidation + "<BR>" )
'
If Session("LastUI") <> strUI Then
If Session("PageInterface") <> "Instantiated" Then
Set objUI = server.CreateObject(strObj)
Session("PageInterface") = "Instantiated"
' response.write("objUI1=" + objUI + "<BR>" )
Else
Set objUI = Session("LastUIObject")
' response.write("objUI2=" + objUI)
End If
objUI.setPage(strUI)
Session("LastUI") = strUI
Set Session("LastUIObject") = objUI
Else
Set objUI = Session("LastUIObject")
objUI.setPage(strUI)
End If
'
' response.write("Session(LastUIObject)=" + Session("LastUIObject") + "<BR>" )
'
iRetVal = objUI.setValidationString(strValidation)
For Each strControl In Request.Form
iRetVal = objUI.set(strControl, Request.Form(strControl))
' response.write(strControl + "=" + Request.Form(strControl) +"<BR>")
Next
For Each strControl In Request.QueryString
iRetVal = objUI.set(strControl, Request.QueryString(strControl))
' response.write(strControl + "=" + Request.QueryString(strControl) +"<BR>")
Next
objUI.process()
sHTML = objUI.toHTML()
Response.Write(sHTML)
' Get the validation string
strValidation = objUI.getValidationString()
Session("vpSecurity") = strValidation
%>
submitpage.jsp
-----------------------
<%@ page import="com.vapower.PPS.*" %>
<%@ page session="true" %>
<%@ page import ="java.util.Enumeration" %>
<%@ page import ="java.util.NoSuchElementException" %>
<%
PPSPageInterface objUI = null ;
String sHTML = "" ;
String strUI = "" ;
String strValidation = "" ;
String strObj = "PPSPageInterface" ;
/* force browser refresh */
response.setHeader("Expires", "Tues, 01 Jan 1980 00:00:00 GMT");
response.setContentType("text/html") ;
try
{
strValidation = (String)session.getValue("vpSecurity") ;
}
catch(NullPointerException exn)
{
strValidation = "" ;
}
if(strValidation == null)
strValidation = "" ;
// get the value associated with the UI parameter name
strUI = getParameter( request , "UI" ) ;
if(strUI == null)
strUI="" ;
// System.err.println("Testing --strUI--" + strUI ) ;
String str = null ;
try
{
str = (String)session.getValue("LastUI") ;
}
catch(NullPointerException ex)
{(
str = "" ;
}
if(str == null)
str = "" ;
// System.err.println("Testing --str--" + str + "--strUI--" + strUI ) ;
// if both variable values 'LastUI' and 'UI' do not match, then create a new
Object
if ( ! str.equals(strUI) )
{
String str1 = null ;
try
{
str1 = (String)session.getValue("PageInterface") ;
}
catch(NullPointerException en)
{
str1 = "" ;
}
if(str1 == null)
str1 = "" ;
// System.err.println("Testing -->str1" + str1 ) ;
if ( ! str1.equals("Instantiated") ) // if no instantiation of the
object has ever taken place..then
{
// System.err.println("Testing -->2" ) ;
objUI = new PPSPageInterface() ;
// System.err.println("Testing -->3" ) ;
session.putValue( "PageInterface" , "Instantiated" ) ;
// System.err.println("Testing -->4" ) ;
}
else
{
objUI = (PPSPageInterface)session.getValue("LastUIObject") ;
}
objUI.setPage(strUI) ;
session.putValue("LastUI", strUI) ;
session.putValue("LastUIObject" , objUI ) ;
}
else
{
objUI = (PPSPageInterface)session.getValue("LastUIObject") ;
objUI.setPage(strUI) ;
}
// System.err.println("Testing -->strValidation" + strValidation ) ;
objUI.setValidationString(strValidation) ;
Enumeration enum = request.getParameterNames() ;
int iRetVal = -1 ;
String nameStr = null ;
while(enum.hasMoreElements())
{
nameStr = (String) enum.nextElement() ;
iRetVal = objUI.set( nameStr , getParameter(request, nameStr) ) ;
}
objUI.process() ;
sHTML = objUI.toHTML() ;
out.println(sHTML) ;
out.flush() ;
// out.close() ;
// Get the validation string
strValidation = objUI.getValidationString() ;
if(strValidation == null)
strValidation="" ;
session.putValue("vpSecurity" , strValidation ) ;
%>
<%!
// global method declaration
public String getParameter( HttpServletRequest req, String param )
{
/*
String value = null ;
String values[] = req.getParameterValues(param) ;
if (values != null)
{
value = values[0] ;
if (value != null)
value = value.trim() ;
}
return value ;
*/
return req.getParameter(param) ;
}
%>
===========================================================================
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