Define tag cannot set a null value' error

2003-06-07 Thread Mick Knutson
I need help with a Define tag cannot set a null value' error I get.
I have a state and country that _is_ null, when the user first comes into 
this form for the first time. I do validate this when they submit the form, 
but I don't get that far.
Can someone please help me with this?

Here is the 2 relevant items from my registration.jsp:

%@ taglib uri=/WEB-INF/statetag.tld prefix=states %
%@ taglib uri=/WEB-INF/cntrtag.tld prefix=countries %
bean:define id=state name=registrationForm property=state /
bean:define id=country name=registrationForm property=country /
.
   tr
   tdbean:message key=form.state//td
   td
   logic:present name=registrationForm property=state
   states:state name=state default='%= (String)state %' /
   /logic:present
   logic:notPresent name=registrationForm property=state
   states:state name=state /
   /logic:notPresent
   /td
 	/tr
   tr
   	tdbean:message key=form.country//td
   	td
   logic:present name=registrationForm property=country
   countries:country  name=country default='%= 
(String)country %' /
   /logic:present
   logic:notPresent name=registrationForm property=country
   countries:country  name=country /
   /logic:notPresent
	/td
 	/tr



StackTrace:

ServletException in:/WEB-INF/default/body/registration.jsp] Define tag 
cannot set a null value' javax.servlet.jsp.JspException: Define tag cannot 
set a null value at 
org.apache.struts.taglib.bean.DefineTag.doEndTag(DefineTag.java:272) at 
org.apache.jsp.registration$jsp._jspService(registration$jsp.java:93) at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201) 
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) 
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294) 
at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:192) at 
org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:121) at 
org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtilStrutsModulesImpl.java:122) 
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:161) at 
org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:702) at 
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:817) 
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:466) at 
org.apache.jsp.default$jsp._jspService(default$jsp.java:321) at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201) 
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) 
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294) 
at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:192) at 
org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:129) at 
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1058) 
at 
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269) 
at 
org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:249) 
at 
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:303) 
at 
org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401) 
at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) 
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420) 
at 
com.baselogic.yoursos.struts.ExtendedActionServlet.process(ExtendedActionServlet.java:40) 
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at 
org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:342) 
at 
com.baselogic.yoursos.security.SecurityContextFilter.doFilter(SecurityContextFilter.java:102) 
at 
org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334

RE: Help needed in define tag..........urgent

2002-03-13 Thread Galbreath, Mark

To begin with, what's the point of storing the package name in a variable?
The problem is that test2 is assigned at run time, while type is assigned
at compile time (or is it the other way around? - I forget).  The container
is trying to assign a package name to type that doesn't yet exist.

Mark

-Original Message-
From: Piyush Srivastava [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 12:26 AM
To: Struts Users Mailing List
Subject: Help needed in define tag..urgent


hi,

I am facing problem with the bean:define tag provided
by struts. When I directly give the package name for
the type attribute, it works fine but when we define a
variable to refer the package name and use it through
JSP expression for the type attribute. It throws class
cast exception. 

To elaborate...

The code given below works fine :

bean:define id=formTest scope=session name=test
type=com.egm.fusion.VehicleForm /

but if I give 

%String test2 = com.egm.fusion.VehicleForm;%

bean:define id=formTest scope=session name=test
type=%=test2% /

It gives the following exception

java.lang.ClassCastException: java.lang.Object
at
org.apache.struts.taglib.bean.DefineTei.getVariableInfo(DefineTei.java:87)

Can anybody help on this.

Regards,
Piyush


__
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Help needed in define tag..........urgent

2002-03-12 Thread Piyush Srivastava

hi,

I am facing problem with the bean:define tag provided
by struts. When I directly give the package name for
the type attribute, it works fine but when we define a
variable to refer the package name and use it through
JSP expression for the type attribute. It throws class
cast exception. 

To elaborate...

The code given below works fine :

bean:define id=formTest scope=session name=test
type=com.egm.fusion.VehicleForm /

but if I give 

%String test2 = com.egm.fusion.VehicleForm;%

bean:define id=formTest scope=session name=test
type=%=test2% /

It gives the following exception

java.lang.ClassCastException: java.lang.Object
at
org.apache.struts.taglib.bean.DefineTei.getVariableInfo(DefineTei.java:87)

Can anybody help on this.

Regards,
Piyush


__
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




define tag usage within message tag

2002-02-12 Thread David Larson

any idea why this works???

struts_bean:define id=shippingOptionKey name=order
property=shippingOption.webMessageResourceKey /
% String key=retail.shippingOption. + shippingOptionKey.toString(); %
struts_bean:message key=%=key% /

but this does not (tried several variations of this)?

struts_bean:define id=shippingOptionKey name=order
type=java.lang.String property=shippingOption.webMessageResourceKey /
struts_bean:message key=retail.shippingOption.%=shippingOptionKey% /

thx


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Help with define tag

2001-06-11 Thread Chuck Stern

Hi,

I think I'm missing something here.  I have a bean that is available to my
page in the request scope.  Within that I have another bean that has
properties I want to display.  I'm trying to use the define tag to get a
reference to the embedded bean and I'm getting the infamous:
javax.servlet.jsp.JspException: No getter method for property homeAddress of
bean policyHolderInfo

Here's the code -
In my bean policyHolderInfo bean attached to the request obj:

public AddressInfo homeAddress;

public AddressInfo
getHomeAddress(AddressInfo homeAddress)
{
return homeAddress;
}

public void
setHomeAddress( AddressInfo homeAddress)
{
this.homeAddress = homeAddress;
}

My jsp tag is:
bean:define id=policyHolderAddress name=policyHolderInfo
property=homeAddress /

All other getters on the policyHolderInfo bean work just fine.

Am I doing something wrong or is there another way to do this?  Any
suggestions would be appreciated.
Thanks,
Chuck



Re: Help with define tag

2001-06-11 Thread Martin Cooper

Is your getter method really as you posted it? That just returns the 
parameter it is passed. It should be this:

public AddressInfo getHomeAddress()
{
 return this.homeAddress;
}

Note the absence of the parameter. The rest looks fine, although I would 
advocate making the homeAddress member private instead of public.

--
Martin Cooper


At 10:46 AM 6/11/01, Chuck Stern wrote:
Hi,

I think I'm missing something here.  I have a bean that is available to my
page in the request scope.  Within that I have another bean that has
properties I want to display.  I'm trying to use the define tag to get a
reference to the embedded bean and I'm getting the infamous:
javax.servlet.jsp.JspException: No getter method for property homeAddress of
bean policyHolderInfo

Here's the code -
In my bean policyHolderInfo bean attached to the request obj:

public AddressInfo homeAddress;

public AddressInfo
getHomeAddress(AddressInfo homeAddress)
{
 return homeAddress;
}

public void
setHomeAddress( AddressInfo homeAddress)
{
 this.homeAddress = homeAddress;
}

My jsp tag is:
bean:define id=policyHolderAddress name=policyHolderInfo
property=homeAddress /

All other getters on the policyHolderInfo bean work just fine.

Am I doing something wrong or is there another way to do this?  Any
suggestions would be appreciated.
Thanks,
Chuck





Re: Help with define tag

2001-06-11 Thread Oleg V Alexeev

Hello Chuck,

comments below...

Monday, June 11, 2001, 9:46:56 PM, you wrote:

CS Hi,

CS I think I'm missing something here.  I have a bean that is available to my
CS page in the request scope.  Within that I have another bean that has
CS properties I want to display.  I'm trying to use the define tag to get a
CS reference to the embedded bean and I'm getting the infamous:
CS javax.servlet.jsp.JspException: No getter method for property homeAddress of
CS bean policyHolderInfo

CS Here's the code -
CS In my bean policyHolderInfo bean attached to the request obj:

CS public AddressInfo homeAddress;

CS public AddressInfo
CS getHomeAddress(AddressInfo homeAddress)

wrong here^

CS {
CS return homeAddress;
CS }

CS public void
CS setHomeAddress( AddressInfo homeAddress)
CS {
CS this.homeAddress = homeAddress;
CS }

CS My jsp tag is:
CS bean:define id=policyHolderAddress name=policyHolderInfo
CS property=homeAddress /

CS All other getters on the policyHolderInfo bean work just fine.

CS Am I doing something wrong or is there another way to do this?  Any
CS suggestions would be appreciated.
CS Thanks,
CS Chuck

Your property support must looks like -

public AddressInfo
getHomeAddress()
{
return homeAddress;
}

public void
setHomeAddress( AddressInfo homeAddress)
{
this.homeAddress = homeAddress;
}


-- 
Best regards,
 Olegmailto:[EMAIL PROTECTED]





define tag

2001-02-02 Thread John Hunt

Hi
If we use struts-bean:define tag and if the variable
is not found, does it raise exception. If yes how can
I catch it and handle it.
Normally if A is in Sesion scope and a property B
then we would do 
bean:define id="m" name="A" scope="session"
type="typeA" /
bean:define id="B" name="m" scope="page" type="typeB"
/

Now if for some reason we cant find A in the session
or say A is null, we cant put a series of if
conditions in the jsp. How are we supposed to handle
such scenarios
Thanks
Hunt

__
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/



Re: define tag

2001-02-02 Thread Ted Husted

OK, lame-brain is back again. Here's the example I was looking for. 

--

%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %
%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %
HTML
logic:present name="guava"bean:define id="cool"
name="guava"//logic:present
BODY
P
logic:present name="cool"bean:write name="cool"
property="name"//logic:present
logic:notPresent name="cool"Ooops/logic:notPresent
/P
/BODY
/HTML

--

Also note that logic:present / notPresent can be told which scope to
check, if that's important.

*** REPLY SEPARATOR  ***

On 2/2/2001 at 11:46 AM John Hunt wrote:

Hi
If we use struts-bean:define tag and if the variable
is not found, does it raise exception. If yes how can
I catch it and handle it.
Normally if A is in Sesion scope and a property B
then we would do 
bean:define id="m" name="A" scope="session"
type="typeA" /
bean:define id="B" name="m" scope="page" type="typeB"
/

Now if for some reason we cant find A in the session
or say A is null, we cant put a series of if
conditions in the jsp. How are we supposed to handle
such scenarios
Thanks
Hunt


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 425-0252; Fax 716 223-2506.
-- http://www.husted.com/about/struts/