You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Engbers, ir. J.B.O.M." <J....@dlg.agro.nl> on 2003/12/04 11:44:49 UTC

(bean-)property gets out of scope/session?

I'm fairly new to Struts, java and servlets so maybe it's a stupid question
but I have this problem:

Based on the pattern that is used by Steve Raeburn in his struts-examples, I
start my web-application with a prepareAction in which I declare
	ArrayList codering= new ArrayList();
	codering.add("NA");
	codering.add("NF");
	request.setAttribute("codering",codering);

I then forward to 
	return mapping.findForward("success");

which redirects to Search.jsp

In Search.jsp I want to use this code:
      <html:select property="landCode" >
	  <html:options name="codering" />
	</html:select><BR>

Tomcat however complains:
org.apache.jasper.JasperException: Cannot find bean under name codering

If I replace <html:options> with <html:option>-tags the Search page gives no
problem.

As far as I understand the Struts-architecture, request.setAttribute and
request.getAttribute are complimentory.
In his code-examples, I can't  find any directives that could serve to
include the bean (jsp:useBean?)

Maybe I'm overlooking something but who has any thoughts?

Ben Engbers




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


Re: SV: (bean-)property gets out of scope/session?

Posted by Hien Q Nguyen <hi...@comcast.net>.
or

<html:select size="13" property="subject">
	<html:optionsCollection 		
		property="myCollection" value="key" labelProperty="label">
	</html:options>
</html:select>

You don't even have to specify value="key" and  labelProperty="label"   
if the bean in your array list has 2 properties "key" and "label" as  
Hakan said.

Take a look at the doc here:  
http://jakarta.apache.org/struts/userGuide/struts- 
html.html#optionsCollection

-H

On Dec 4, 2003, at 6:27 AM, Håkan Fransson wrote:

> I'm using the collection attribute instead. The collection is an  
> ArrayList
> of individual beans with properties "key" and "label".
>
> <html:select size="13" property="subject">
> 	<html:options
> 		collection="<%= CourseCatalogueJSPAttributes.JSPATTRIBUTE_SUBJECT %>"
> 		property="value" labelProperty="label">
> 	</html:options>
> </html:select>
>
> -----Ursprungligt meddelande-----
> Från: Engbers, ir. J.B.O.M. [mailto:J.B.O.M.Engbers@dlg.agro.nl]
> Skickat: den 4 december 2003 11:45
> Till: 'struts-user@jakarta.apache.org'
> Ämne: (bean-)property gets out of scope/session?
>
>
> I'm fairly new to Struts, java and servlets so maybe it's a stupid  
> question
> but I have this problem:
>
> Based on the pattern that is used by Steve Raeburn in his  
> struts-examples, I
> start my web-application with a prepareAction in which I declare
> 	ArrayList codering= new ArrayList();
> 	codering.add("NA");
> 	codering.add("NF");
> 	request.setAttribute("codering",codering);
>
> I then forward to
> 	return mapping.findForward("success");
>
> which redirects to Search.jsp
>
> In Search.jsp I want to use this code:
>       <html:select property="landCode" >
> 	  <html:options name="codering" />
> 	</html:select><BR>
>
> Tomcat however complains:
> org.apache.jasper.JasperException: Cannot find bean under name codering
>
> If I replace <html:options> with <html:option>-tags the Search page  
> gives no
> problem.
>
> As far as I understand the Struts-architecture, request.setAttribute  
> and
> request.getAttribute are complimentory.
> In his code-examples, I can't  find any directives that could serve to
> include the bean (jsp:useBean?)
>
> Maybe I'm overlooking something but who has any thoughts?
>
> Ben Engbers
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


SV: (bean-)property gets out of scope/session?

Posted by Håkan Fransson <hn...@ladok.umu.se>.
I'm using the collection attribute instead. The collection is an ArrayList
of individual beans with properties "key" and "label".

<html:select size="13" property="subject">
	<html:options
		collection="<%= CourseCatalogueJSPAttributes.JSPATTRIBUTE_SUBJECT %>"
		property="value" labelProperty="label">
	</html:options>
</html:select>

-----Ursprungligt meddelande-----
Från: Engbers, ir. J.B.O.M. [mailto:J.B.O.M.Engbers@dlg.agro.nl]
Skickat: den 4 december 2003 11:45
Till: 'struts-user@jakarta.apache.org'
Ämne: (bean-)property gets out of scope/session?


I'm fairly new to Struts, java and servlets so maybe it's a stupid question
but I have this problem:

Based on the pattern that is used by Steve Raeburn in his struts-examples, I
start my web-application with a prepareAction in which I declare
	ArrayList codering= new ArrayList();
	codering.add("NA");
	codering.add("NF");
	request.setAttribute("codering",codering);

I then forward to
	return mapping.findForward("success");

which redirects to Search.jsp

In Search.jsp I want to use this code:
      <html:select property="landCode" >
	  <html:options name="codering" />
	</html:select><BR>

Tomcat however complains:
org.apache.jasper.JasperException: Cannot find bean under name codering

If I replace <html:options> with <html:option>-tags the Search page gives no
problem.

As far as I understand the Struts-architecture, request.setAttribute and
request.getAttribute are complimentory.
In his code-examples, I can't  find any directives that could serve to
include the bean (jsp:useBean?)

Maybe I'm overlooking something but who has any thoughts?

Ben Engbers




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


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