struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jipu Jiang" <j.ji...@nesc.gla.ac.uk>
Subject RE: HELP!!! DoubleSeclect tag with default values
Date Mon, 10 Nov 2008 17:33:00 GMT
Hi Felippe,

Thank you so much for the response. Sure, here is the code:

JSP:

<s:form id="editRecordForm" action="updateRecord" theme="simple">
	<table class="query-page-table">
		<tr>
			<s:iterator value="sections" id="sec"
status="secs">
				<table class="section-table">
					<tr>
						<td colspan="3">
							<h3>
	
<s:property value="name" />
							</h3>
						</td>
					</tr>

					<s:iterator value="parameters"
id="para" status="paras">
						<tr>
							<td
class="parameter-label">
	
<s:property value="label" />
							</td>
							<td>
								<s:if
test="type == \"menu\"">
	
<s:set name="menuoptions" value="menu.menuoptions"></s:set>
	
<s:set name="tertiaryParamName" value="menu.tertiaryParamName"></s:set>
	
<s:if test="menu.tertiary == 1">
	
<s:doubleselect name="%{'identifier.' + paramName}"
	
headerKey="" headerValue="--- Please Select ---"
	
list="menu.menuoptions" listKey="value" listValue="value"
	
doubleId="%{'editRecordForm_identifier_' + menu.tertiaryParamName}"
	
doubleName="%{'identifier.' + menu.tertiaryParamName}"
	
doubleList="tertiaryoptions" doubleListKey="name"
	
doubleListValue="name" />
	
</s:if>
	
<s:else>
	
<s:select name="%{'identifier.' + paramName}"
	
listKey="value" label="%{para.label}" list="menu.menuoptions"
	
listValue="value" emptyOption="false" headerKey=""
	
headerValue="--- Please Select ---" theme="simple" />
	
</s:else>
								</s:if>
							</td>
						</tr>

					</s:iterator>
				</table>
			</s:iterator>
		</tr>
		<tr>
			<td colspan="3" align="right">
				<br />
				<s:submit value="Update Record"
theme="simple"></s:submit>
				<s:reset theme="simple"></s:reset>
			</td>
		</tr>
	</table>

</s:form>

------------------------------------------------------------------------
Here is the updateRecordView Method in the UpdateRecordAction.java: 

	public String updateRecordView() throws Exception {
		try {
			this.sections =
this.parameterManager.getSections();
			this.identifier =
this.identifierManager.getIdentifierByRegisterId(this.id);
			return SUCCESS;
		} catch (CannotCreateTransactionException e) {
			log.error("CannotCreateTransactionException:
Hibernate transaction exception!!! Timeout.");
			e.printStackTrace();
			return EXPIRE;
		} catch (Exception e) {
			log.error("Exception caught in
readRecordView()!!!");
			return ERROR;
		}
	}


User access goes to updateRecordView action first, and fetch data from
database. If successful, it goes to the jsp page to show the parameters
and associated values. But the doubleselect tag shows only the value of
fist select box, second box shows the first option in from the list, not
the one suppose to display. 

Any help would be much appreciated. 

Many thanks,
Jipu

-----Original Message-----
From: Felippe Scheidt [mailto:felippescheidt@gmail.com] 
Sent: Monday, November 10, 2008 12:22 PM
To: Struts Users Mailing List
Subject: Re: HELP!!! DoubleSeclect tag with default values

Can you paste your code please?

Scheidt.


On Mon, Nov 10, 2008 at 9:04 AM, Jipu Jiang <j.jiang@nesc.gla.ac.uk>
wrote:

> Dear all,
>
> I was trying to display a JSP page with some parameters from the
> database. Everything shows up perfectly except the second dropdown
list
> of the doubleselect tag, which should display the value from java
action
> but it always shows the first value of the second list.
>
> For example, the first list contains countries and the second list
> contains cities. E.g. if I select UK from the first select box, the
> second should be London, Birmingham, Edinburgh etc.
>
> Now the default values of the select boxes depend on what's in the
> database. I can get the first select box to show UK, but the second
one
> always shows London, which is the first one in the second list.
Instead,
> it should show other cities based on values in database.
>
> I guess it's because of javascript. Does anyone know how to deal with
> such problem?
>
> Also, when I assign values to the doubleHeaderKey and
doubleHeaderValue
> of doubleselect tag, the second select box shows no header at all. How
> can I make this work?
>
> Many thanks in advance,
> Jipu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Mime
View raw message