You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nathan Ewing <Na...@cbhk.com> on 2004/04/20 23:48:50 UTC

Creating an indexed property of DynaActionForms

I'm trying to figure out how to define and use a DynaActionForm which
has an indexed property that is another DynaActionForm.  I'm using
struts 1.1.  Here is something like what I mean:

	First my sample struts-config.xml
	----------------------------------
	<form-bean name="SubForm"
type="org.apache.struts.validator.DynaValidatorForm">
		<form-property name="property1"
type="java.lang.String"/>
		<form-property name="property2"
type="java.lang.String"/>
	</form-bean>

	<form-bean name="SampleMain"
type="org.apache.struts.validator.DynaValidatorForm">
	    <form-property name="subForm1" type="SubForm[]"/>
	    <form-property name="subForm2" type="SubForm[]"/>
	</form-bean>
	
	And the JSP:
	------------------

	<table>
	<c:forEach var="subForm1" items="${SampleMain.map.subForm1}"
varStatus="status">
		<tr>
		    <td><html:text
property="subForm1[${status.index}].property1" size="5" />

		    <td><html:text
property="subForm1[${status.index}].property2" size="5" />
</tr>
	</c:forEach>
	</table>

Unfortunately this doesn't work.  If I try making the subtypes SubForm[]
like above, I get a NullPointer exception when I try to start the
server, when struts tries to create the DynaForm classes.

If I make the property type Object[], I can successfully populate the
form, but when I try to save it, I get an ArrayOutOfBounds error when
struts tries to create the initial DynaForms (Obviously because it has
no idea what type of form to create, I think).

How do I make this work?

Also, once I start implementing validation on this form, is it going to
be possible to use struts validation to validate the subitems?

	Thanks,
	Nathan


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


Keeping track of online users

Posted by Anders Steinlein <an...@steinlein.no>.
Hi!

This might not be a stricly Struts-related question, but as my application
is using Struts and some of you might be interested, I decided to post
here.

I want to keep track of the number of online users in my application. I
know when a user signs in and out, but what about those numerous users who
doesn't explicitly sign out (leaving the session hanging until it
invalidates)? What is the normal way of dealing with this?

I'm running Tomcat 5.0.19 with container managed security (if that
matters) and Struts 1.1.

Thanks for any input.

Regards,
Anders Steinlein



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