Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Streuts: html:select not being updated properly in DynaActionValidatorForm

Reply
Thread Tools

Streuts: html:select not being updated properly in DynaActionValidatorForm

 
 
Thomas 'Skip' Hollowell
Guest
Posts: n/a
 
      05-20-2004
<html:form action="dynAdminGroupMaint">
<html:select property="parmGroup" onchange="this.form.submit();">
<option>
<c:forEach var="group" items="${allGroups}">
<option value="<cut value="${group.id}"/>">
<cut value="${group.name}"/>
</option>
</c:forEach>
</html:select>
</html:form>

I would expect that the select is not being upated with the selected
value because I am not using an <htmlption> tag, just the plain
<option> tag. But I get errors out the wazoo when I try the following:

<htmlption value="<cut value="${group.id}"/>">
<cut value="${group.name}"/>
</htmlption>

It does not like the ${group_id} in the option value parameter.

Any ideas how I can get around this? I want to parse the list and
display the list values in the select box, and then after submitting the
form, display ther select box with the selected value higglighted.

Thanks

Skip.
 
Reply With Quote
 
 
 
 
Sudsy
Guest
Posts: n/a
 
      05-20-2004
Thomas 'Skip' Hollowell wrote:
> <html:form action="dynAdminGroupMaint">
> <html:select property="parmGroup" onchange="this.form.submit();">
> <option>
> <c:forEach var="group" items="${allGroups}">
> <option value="<cut value="${group.id}"/>">
> <cut value="${group.name}"/>
> </option>
> </c:forEach>
> </html:select>
> </html:form>


Grouping is wrong. Note the beginning and end tags of the option:
one is outside the loop while the other is inside.

> I would expect that the select is not being upated with the selected
> value because I am not using an <htmlption> tag, just the plain
> <option> tag. But I get errors out the wazoo when I try the following:
>
> <htmlption value="<cut value="${group.id}"/>">
> <cut value="${group.name}"/>
> </htmlption>


You're nesting quotes. Try this:
<htmlption value='<cut value="${group.id}"/>' >
(or swap the single and double quotes and try again)

For more sophisticated apps, try this article:
<http://www.sudsy.net/technology/struts-advanced.html>

 
Reply With Quote
 
 
 
 
Thomas 'Skip' Hollowell
Guest
Posts: n/a
 
      05-20-2004
Sudsy wrote:

>
> Grouping is wrong. Note the beginning and end tags of the option:
> one is outside the loop while the other is inside.


The grouping is ok, I have one blank option in there (no close option
tag) and then the options with data.
>
>> I would expect that the select is not being upated with the selected
>> value because I am not using an <htmlption> tag, just the plain
>> <option> tag. But I get errors out the wazoo when I try the following:
>>
>> <htmlption value="<cut value="${group.id}"/>">
>> <cut value="${group.name}"/>
>> </htmlption>

>
>

The quoting was a bit doubled up, but changing the inner double quotes
to singles didn't help, or changing the outers. I have a feeling there
is a more straightforward way to tackle something like this, but I just
can't grasp it at the moment. I have bookmarked your page though, it
has quite a few nice tricks to remember.


> You're nesting quotes. Try this:
> <htmlption value='<cut value="${group.id}"/>' >
> (or swap the single and double quotes and try again)
>
> For more sophisticated apps, try this article:
> <http://www.sudsy.net/technology/struts-advanced.html>
>

 
Reply With Quote
 
David W. Burhans
Guest
Posts: n/a
 
      05-20-2004
Sudsy <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Thomas 'Skip' Hollowell wrote:
> > <html:form action="dynAdminGroupMaint">
> > <html:select property="parmGroup" onchange="this.form.submit();">
> > <option>
> > <c:forEach var="group" items="${allGroups}">
> > <option value="<cut value="${group.id}"/>">
> > <cut value="${group.name}"/>
> > </option>
> > </c:forEach>
> > </html:select>
> > </html:form>

>
> Grouping is wrong. Note the beginning and end tags of the option:
> one is outside the loop while the other is inside.


Although the grouping is wrong, it has no bearing on the problem.
Instead, you must make sure that the form bean for the
"dynaAdminGroupMain" action includes a property that is the same name
as the select element property.

You might also use the the struts <htmlptionsCollection> tag instead
of the <c:foreach> loop here.

>
> > I would expect that the select is not being upated with the selected
> > value because I am not using an <htmlption> tag, just the plain
> > <option> tag. But I get errors out the wazoo when I try the following:
> >
> > <htmlption value="<cut value="${group.id}"/>">
> > <cut value="${group.name}"/>
> > </htmlption>

>
> You're nesting quotes. Try this:
> <htmlption value='<cut value="${group.id}"/>' >
> (or swap the single and double quotes and try again)
>


The quotes are in no way nested. Note that the <cut> thingy inside
the option value attribute is a JSP tag and will be processed before
the HTML is sent to the client (i.e. the double quotes around the
${group.id} reference will not be present when the HTML is processed
by the client).

> For more sophisticated apps, try this article:
> <http://www.sudsy.net/technology/struts-advanced.html>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ Topic - Why is my AJAX page not updated properly when using an HTTP GET request in Internet Explorer? (2007-11-23) FAQ server Javascript 10 11-27-2007 10:22 PM
updated object not properly sent over socket Digital Puer Java 3 03-15-2006 05:35 AM
Lost work due to USB flash pen not being recognised properly numberonepipboy Computer Support 1 07-15-2004 09:36 AM
Datagrid not updated during delete, but updated during insert and update Dmitry Korolyov ASP .Net Datagrid Control 0 09-22-2003 10:57 AM
More American Graffiti: Properly Framed, Properly Scored? Scot Gardner DVD Video 0 09-02-2003 02:28 AM



Advertisments