You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andrés José Rodríguez Carrasco <an...@um.es> on 2003/12/15 17:36:44 UTC

EJB parameter changed to null

Hi!, let's se if anyone can help me, I have a problem with EJB parameters, 
I've made a component that accepts an object of the type mtl.data.InductiveML
 as a parameter, this is an EJB object (The interface Inherits from EJBObject).

The component represents a creation form for a kind of object, and InductiveML 
is an Entity Bean that stores information related to these objects,  needed 
to do the actual creation of this object, such as the JNDIPath for the home Object.

Here is the .jwc file, 

<component-specification class="mtl.webapp.components.AlgHomeCreate"
	allow-informal-parameters="no"
	allow-body="no">

	<parameter name="configurePage" type="java.lang.String"
		required="yes" direction="in" default-value="AlgorithmConfigure"/>

	<parameter name="algorithm" type="mtl.data.InductiveML"
		required="yes" direction="in"/>
	
	<component id="createForm" type="Form">		
		<binding name="listener" expression="listeners.createListener"/>
		<binding name="delegate" expression="beans.delegate"/>
	</component>

	<component id="createButton" type="Submit">
		<static-binding name="label" value="Create Algorithm"/>
	</component>

</component-specification>

And here is the html file:

<form jwcid="createForm" direct="false">
 <table cellpadding="4">
	<tr><td>Session: <span jwcid="@Insert"value="ognl:algorithm.JNDIPath"/></td></tr>
	<tr><td><span jwcid="createButton"/></td></tr>	
 </table>
</form>

Finally, this is the handler for the create Button:

  public void createListener(IRequestCycle cycle)
  {
    log.debug("Link clicked");

    try {
      // Create the algorithm
      log.debug("Getting initial context...");
      InitialContext context = getVisit().getInitialContext();
      log.debug("Initial context: " + context);

      log.debug("Getting algorithm's Home: " + getAlgorithm().getJNDIPath());
    } catch .....	
  }

Of course, both are reduced to the minimum.

Everything is displayed fine at the first load of the page, the Insert component
prints a good value, but the problem comes when clicking the button, because 
when I do it, the algorithm parameter seems to be nulled without any reason (Known to me).
When doing this, I get an exception: 

"source is null for getProperty(null, "JNDIPath")"

Seems that the component is null, in fact, if I remove the Insert component, the error
does not appear there, but in the handler, I also get a NullPointerException for
the line

      log.debug("Getting algorithm's Home: " + getAlgorithm().getJNDIPath());

So, the getAlgorithm method is returning a null value, but the parameter passed OK, 
because in other case it would not be displayed the first time, so I'm wondering if it's 
a problem with rewind, or maybe anything related to the way tapestry manages EJB properties 
(Read in the User's guide about that, but not much information). 

It would be great if any of you could answer my question...

-- 
Andrés José Rodríguez Carrasco

"What I have in my head 
you can't buy, steal or borrow"

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: EJB parameter changed to null

Posted by David Solis <ds...@legosoft.com.mx>.
A quick fix is keep algorithm in Visit object.
By definition a parameter with direction in is just for rendering. Then
parameter is set to null.
Try to change to direction auto.

Regards

D.

> -----Original Message-----
> From: Andrés José Rodríguez Carrasco [mailto:andresrc@um.es]
> Sent: Monday, December 15, 2003 10:37 AM
> To: Tapestry users
> Subject: EJB parameter changed to null
> 
> Hi!, let's se if anyone can help me, I have a problem with EJB
parameters,
> I've made a component that accepts an object of the type
> mtl.data.InductiveML
>  as a parameter, this is an EJB object (The interface Inherits from
> EJBObject).
> 
> The component represents a creation form for a kind of object, and
> InductiveML
> is an Entity Bean that stores information related to these objects,
> needed
> to do the actual creation of this object, such as the JNDIPath for the
> home Object.
> 
> Here is the .jwc file,
> 
> <component-specification class="mtl.webapp.components.AlgHomeCreate"
> 	allow-informal-parameters="no"
> 	allow-body="no">
> 
> 	<parameter name="configurePage" type="java.lang.String"
> 		required="yes" direction="in" default-
> value="AlgorithmConfigure"/>
> 
> 	<parameter name="algorithm" type="mtl.data.InductiveML"
> 		required="yes" direction="in"/>
> 
> 	<component id="createForm" type="Form">
> 		<binding name="listener"
> expression="listeners.createListener"/>
> 		<binding name="delegate" expression="beans.delegate"/>
> 	</component>
> 
> 	<component id="createButton" type="Submit">
> 		<static-binding name="label" value="Create Algorithm"/>
> 	</component>
> 
> </component-specification>
> 
> And here is the html file:
> 
> <form jwcid="createForm" direct="false">
>  <table cellpadding="4">
> 	<tr><td>Session: <span
> jwcid="@Insert"value="ognl:algorithm.JNDIPath"/></td></tr>
> 	<tr><td><span jwcid="createButton"/></td></tr>
>  </table>
> </form>
> 
> Finally, this is the handler for the create Button:
> 
>   public void createListener(IRequestCycle cycle)
>   {
>     log.debug("Link clicked");
> 
>     try {
>       // Create the algorithm
>       log.debug("Getting initial context...");
>       InitialContext context = getVisit().getInitialContext();
>       log.debug("Initial context: " + context);
> 
>       log.debug("Getting algorithm's Home: " +
> getAlgorithm().getJNDIPath());
>     } catch .....
>   }
> 
> Of course, both are reduced to the minimum.
> 
> Everything is displayed fine at the first load of the page, the Insert
> component
> prints a good value, but the problem comes when clicking the button,
> because
> when I do it, the algorithm parameter seems to be nulled without any
> reason (Known to me).
> When doing this, I get an exception:
> 
> "source is null for getProperty(null, "JNDIPath")"
> 
> Seems that the component is null, in fact, if I remove the Insert
> component, the error
> does not appear there, but in the handler, I also get a
> NullPointerException for
> the line
> 
>       log.debug("Getting algorithm's Home: " +
> getAlgorithm().getJNDIPath());
> 
> So, the getAlgorithm method is returning a null value, but the
parameter
> passed OK,
> because in other case it would not be displayed the first time, so I'm
> wondering if it's
> a problem with rewind, or maybe anything related to the way tapestry
> manages EJB properties
> (Read in the User's guide about that, but not much information).
> 
> It would be great if any of you could answer my question...
> 
> --
> Andrés José Rodríguez Carrasco
> 
> "What I have in my head
> you can't buy, steal or borrow"
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org