G
Guest
Hi,
I have an existing web application with java beans that I wanne migrate to
ASP.NET using C#.
The existing web application has some jsp files that use java beans as
follows:
....
<%@ page language="java" import="reportgen.*"%>
<%@ page import="java.lang.reflect.Array" %>
<jsp:useBean id="webAppConstants" scope="session"
class="reportgen.WebAppConstants">
</jsp:useBean>
<% webAppConstants.loadProperties(config); %>
<% session.setAttribute("WebAppConstants", webAppConstants);%>
<html>
<head>
<title></title>
....
....
<td bordercolor="#000000" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="340"
class="Text_Small">
<tr>
<td valign="top" height="72">
<%out.print(webAppConstants.WELCOME);%>
<br>
Now I'm looking for a possibility to use/make some C# objects that behave
nearly the same way that java beans do. That means I want to use them in the
html-code of an aspx-file.
In the above example webAppConstants is a selfdefined java class. But
because of "<jsp:useBean..." the class is instantiated to webAppConstants and
can be used in the following html-code.
I tried the following solution that should give me an object from a session:
<%@ Page CodeBehind="Login.aspx.cs" Language="c#" AutoEventWireup="false"
Inherits="ReportGenerator.Login" %>
<%@ Import namespace="ReportGenerator" %>
<% ReportConstants reportConstants = new ReportConstants(); %>
<script Language="c#" runat="server">
ReportConstants reportConstants =
(ReportConstants)Session["ReportConstants"];
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Tran0sitional//EN" >
<HTML>
....
But Session is unknown. So how do I get access to the session? Or is what
would be another solution.
Thanks in advance for any help.
Stephen
I have an existing web application with java beans that I wanne migrate to
ASP.NET using C#.
The existing web application has some jsp files that use java beans as
follows:
....
<%@ page language="java" import="reportgen.*"%>
<%@ page import="java.lang.reflect.Array" %>
<jsp:useBean id="webAppConstants" scope="session"
class="reportgen.WebAppConstants">
</jsp:useBean>
<% webAppConstants.loadProperties(config); %>
<% session.setAttribute("WebAppConstants", webAppConstants);%>
<html>
<head>
<title></title>
....
....
<td bordercolor="#000000" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="340"
class="Text_Small">
<tr>
<td valign="top" height="72">
<%out.print(webAppConstants.WELCOME);%>
<br>
Now I'm looking for a possibility to use/make some C# objects that behave
nearly the same way that java beans do. That means I want to use them in the
html-code of an aspx-file.
In the above example webAppConstants is a selfdefined java class. But
because of "<jsp:useBean..." the class is instantiated to webAppConstants and
can be used in the following html-code.
I tried the following solution that should give me an object from a session:
<%@ Page CodeBehind="Login.aspx.cs" Language="c#" AutoEventWireup="false"
Inherits="ReportGenerator.Login" %>
<%@ Import namespace="ReportGenerator" %>
<% ReportConstants reportConstants = new ReportConstants(); %>
<script Language="c#" runat="server">
ReportConstants reportConstants =
(ReportConstants)Session["ReportConstants"];
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Tran0sitional//EN" >
<HTML>
....
But Session is unknown. So how do I get access to the session? Or is what
would be another solution.
Thanks in advance for any help.
Stephen