473,508 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

jsp:getproperty always null

4 New Member
Greetings,

Trying to assign a javabean property and get it in another page with <jsp:getProperty ....

I can get it in the same page, but in different page it is always null.

scope = "session" is in the jsp:usebean tag.

I am still trying to do this as an alternative to passing query string in URL...

Any advice greatly appreciated.

Thanks,
JK
Nov 6 '06 #1
3 3347
r035198x
13,262 MVP
Greetings,

Trying to assign a javabean property and get it in another page with <jsp:getProperty ....

I can get it in the same page, but in different page it is always null.

scope = "session" is in the jsp:usebean tag.

I am still trying to do this as an alternative to passing query string in URL...

Any advice greatly appreciated.

Thanks,
JK
And why not use request.getParameter()
or request.setAttribute() with request.getAttribute?
They are especially made for passing values values between pages
Nov 6 '06 #2
Judy K
4 New Member
I am opening a jsp website via Delphi code and passing in parameters in the query string of the URL like this:
http://sabre/fwb_live/fastweb/html/PreLoad_11_3.jsp?custname=lctest&login=logintest

This works fine – BUT I really don’t want all those values to be visible because of security concerns, so I am trying to “hide” the custname parameter by using a java bean, so I can reference it later. (I am able to reference that value in the same page.) I am getting the value by using request.getParameter.

Then I redirect to a new html page with the first page's onload event without including the custname parameter in the URL The new page is index.html (which uses frames). One of the frames’ src is nav.jsp. In nav.jsp I am trying to get the value back from the bean so I can put it in an XML document and send it on it’s way, but the custname is always NULL! I cannot send you all the code as there are lots of dependencies, but am sending the most pertinent parts.

If you have any ideas what I am doing wrong, or if you know of a better way to do this, I would be most grateful for advice.

I am using Internet Explorer 5.0 on a Tomcat 3.0 webserver.


Thanks very much,
Judy
--------------------
Excerpts from JspUIHelper:

package com.medcmp.fastweb.view;

import com.medcmp.log.Log;
import com.medcmp.log.Priority;
import com.medcmp.util.ComponentHelper;
import com.medcmp.util.StringHelper;
import java.rmi.RemoteException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class JspUIHelper
{


(…skipping some…)

public String getCustname() {
return(custname);
}

public void setcustname(String custname) {
this.custname = custname;
}
---------------------------------------

Entire contents of PreLoad_11_3.jsp:


<%@ page errorPage="../../fastweb/jsp/JspException.jsp" import="java.util.*" %>
<jsp:useBean id="myJspUIHelper" class="com.medcmp.fastweb.view.JspUIHelper" sco
pe="application" />

<jsp:setProperty name="myJspUIHelper" property="custname" param="custname" />

<%
// add variable to this list
String id = "";

// add an if statement to map it in
if ( request.getParameter("LogonIDIn") != null ) {
id = request.getParameter("LogonIDIn").trim();
};

String custname = "";
if ( request.getParameter("custname") != null ) {
};

String login = "";
if ( request.getParameter("login") != null ) {
login = request.getParameter("login").trim();
};

// append it to the URL string
String x = "index.html?LogonIDIn=" + id + "&login=" + login;
%>
<HTML>
<HEAD>
<script language=javascript type="text/javascript">

function fwd() {

location.href = "<%=x%>" ; ---if I comment out this line I can see the property from the getProperty call below so I know the Bean is working
};


</script>
</HEAD>
<BODY onLoad = "fwd()">

<jsp:getProperty name="myJspUIHelper" property="custname" />

</BODY>
</HTML>

-----------------------------------------------------------

Excerpts from nav.jsp:

<html><head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<jsp:useBean id="myJspUIHelper" class="com.medcmp.fastweb.view.JspUIHelper" />
<title>Channels</title>
<SCRIPT LANGUAGE=JAVASCRIPT1.2 TYPE="TEXT/JAVASCRIPT">

var preload = "";
var ppathUrl = "";
var cnam = "";
if (top.parent.location.search.length > 0) {
preload= top.location.search.slice(0);
}
cnam = "<%= myJspUIHelper.getCustname() %>";
ppathUrl = "/fwb_live/fastweb/jsp/pPathSeamless10_3_4.jsp" + preload + "&custnam
e=" + "<%= myJspUIHelper.getCustname() %>"; if I change this method to another “get” method in the Bean I get a value
// MENU
function selectSubchannel(channel) {
Nov 6 '06 #3
r035198x
13,262 MVP
I am opening a jsp website via Delphi code and passing in parameters in the query string of the URL like this:
http://sabre/fwb_live/fastweb/html/PreLoad_11_3.jsp?custname=lctest&login=logintest

This works fine – BUT I really don’t want all those values to be visible because of security concerns, so I am trying to “hide” the custname parameter by using a java bean, so I can reference it later. (I am able to reference that value in the same page.) I am getting the value by using request.getParameter.

Then I redirect to a new html page with the first page's onload event without including the custname parameter in the URL The new page is index.html (which uses frames). One of the frames’ src is nav.jsp. In nav.jsp I am trying to get the value back from the bean so I can put it in an XML document and send it on it’s way, but the custname is always NULL! I cannot send you all the code as there are lots of dependencies, but am sending the most pertinent parts.

If you have any ideas what I am doing wrong, or if you know of a better way to do this, I would be most grateful for advice.

I am using Internet Explorer 5.0 on a Tomcat 3.0 webserver.


Thanks very much,
Judy
--------------------
Excerpts from JspUIHelper:

package com.medcmp.fastweb.view;

import com.medcmp.log.Log;
import com.medcmp.log.Priority;
import com.medcmp.util.ComponentHelper;
import com.medcmp.util.StringHelper;
import java.rmi.RemoteException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class JspUIHelper
{


(…skipping some…)

public String getCustname() {
return(custname);
}

public void setcustname(String custname) {
this.custname = custname;
}
---------------------------------------

Entire contents of PreLoad_11_3.jsp:


<%@ page errorPage="../../fastweb/jsp/JspException.jsp" import="java.util.*" %>
<jsp:useBean id="myJspUIHelper" class="com.medcmp.fastweb.view.JspUIHelper" sco
pe="application" />

<jsp:setProperty name="myJspUIHelper" property="custname" param="custname" />

<%
// add variable to this list
String id = "";

// add an if statement to map it in
if ( request.getParameter("LogonIDIn") != null ) {
id = request.getParameter("LogonIDIn").trim();
};

String custname = "";
if ( request.getParameter("custname") != null ) {
};

String login = "";
if ( request.getParameter("login") != null ) {
login = request.getParameter("login").trim();
};

// append it to the URL string
String x = "index.html?LogonIDIn=" + id + "&login=" + login;
%>
<HTML>
<HEAD>
<script language=javascript type="text/javascript">

function fwd() {

location.href = "<%=x%>" ; ---if I comment out this line I can see the property from the getProperty call below so I know the Bean is working
};


</script>
</HEAD>
<BODY onLoad = "fwd()">

<jsp:getProperty name="myJspUIHelper" property="custname" />

</BODY>
</HTML>

-----------------------------------------------------------

Excerpts from nav.jsp:

<html><head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<jsp:useBean id="myJspUIHelper" class="com.medcmp.fastweb.view.JspUIHelper" />
<title>Channels</title>
<SCRIPT LANGUAGE=JAVASCRIPT1.2 TYPE="TEXT/JAVASCRIPT">

var preload = "";
var ppathUrl = "";
var cnam = "";
if (top.parent.location.search.length > 0) {
preload= top.location.search.slice(0);
}
cnam = "<%= myJspUIHelper.getCustname() %>";
ppathUrl = "/fwb_live/fastweb/jsp/pPathSeamless10_3_4.jsp" + preload + "&custnam
e=" + "<%= myJspUIHelper.getCustname() %>"; if I change this method to another “get” method in the Bean I get a value
// MENU
function selectSubchannel(channel) {
If you use a form with hidden input fields and use post instead of get for the form method, there will be no data shown in the url
Nov 7 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6485
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
0
4037
by: vijendra | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file?I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
1
4382
by: Judy K | last post by:
Greetings all, I am new to Java, JSP and javascripting. I was passing parameters in a query string and have learned the dangers therein, so am now trying to pass a parameter as a javabean property...
4
2483
by: mjahabarsadiq | last post by:
HELLO FRIENDS I HAVE ONE JAVA CODE WHICH PARSES AN XML FILE AND PRODUCE A QUERY TO CREATE TABEL IN A DATABASE. BUT I NEED THE CODE TO BE USED IN A JSP PAGE. HOW TO USE THIS PAGE WITH JSP. ...
2
1938
by: judge82 | last post by:
I have two JSPs, one takes a request and the other displays the result and I am having problem with the javabean to connect the two here are my codes takes request <%@page...
0
2897
by: buntyindia | last post by:
Hi, I have a very strange problem with my application. I have developed it using Struts. I have a TextBox With Some fixed value in it and on Submit iam passing it to another page. <html:form...
0
1660
by: Vittorix | last post by:
hi all, in a JSP page: <% String bookBeanBeg; bookBeanBeg = "bookBeanBeg1"; %> <jsp:useBean id="<%=bookBeanBeg%>"
0
2783
by: TeenaRoz | last post by:
Hi, Can some one help me in finding out why this exception occurs when ever I try to load a particular JSP page? Oct 29, 2008 4:23:54 AM org.apache.catalina.loader.WebappClassLoader loadClass...
1
2073
by: prasath03 | last post by:
Hi, I am struggling with the following problem. Can somebody pls help me?. I am developing a wesbite for user can edit their files only, so i am going to develop a page for a Tree Structure in...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.