Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to keep the selectlist selected ?????

Reply
Thread Tools

How to keep the selectlist selected ?????

 
 
Gianni
Guest
Posts: n/a
 
      04-09-2004
I have in my JSP a select box like this
I can't find the way to keep what user selected in the next page


<select name="selectedParmet" size="17"
onchange="selezionagrandezza();">
<logicresent name="parametri">
<logic:iterate name="parametri" id="parametro"
scope="session">
<option value="<%=((it.sian.MIEDAX.ejb.MieaparmValue)param etro).getID_PARMET()%>"><bean:write
name="parametro" property="DESCR_PARMET"/></option>
</logic:iterate>
</logicresent>
</select>


in the actionform class I have code like this:

public String getSelectedParmet()

{
return this.selectedParmet;
}
public void setSelectedParmet(String selectedParmet)
{
this.selectedParmet = selectedParmet;
}


and in the relative action class I have a this:

dsForm.setSelectedParmet(grandezzaselezionata);


I expect to see selected the next page ... but nothing to do !
Where is the error ??
Thanks Grazie
 
Reply With Quote
 
 
 
 
Andrew S.
Guest
Posts: n/a
 
      04-09-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (Gianni) wrote in message news:<(E-Mail Removed) om>...
> I have in my JSP a select box like this
> I can't find the way to keep what user selected in the next page
>
>
> <select name="selectedParmet" size="17"
> onchange="selezionagrandezza();">
> <logicresent name="parametri">
> <logic:iterate name="parametri" id="parametro"
> scope="session">
> <option value="<%=((it.sian.MIEDAX.ejb.MieaparmValue)param etro).getID_PARMET()%>"><bean:write
> name="parametro" property="DESCR_PARMET"/></option>
> </logic:iterate>
> </logicresent>
> </select>
>
>
> in the actionform class I have code like this:
>
> public String getSelectedParmet()
>
> {
> return this.selectedParmet;
> }
> public void setSelectedParmet(String selectedParmet)
> {
> this.selectedParmet = selectedParmet;
> }
>
>
> and in the relative action class I have a this:
>
> dsForm.setSelectedParmet(grandezzaselezionata);
>
>
> I expect to see selected the next page ... but nothing to do !
> Where is the error ??
> Thanks Grazie


Use the <html:select> tag (which automatically does what you're trying
to do)instead of manually creating the <select> tag.

<html:select property="selectedParmet"
onchange="selezionagrandezza();" >
....
</html:select>

Also, consider using the <htmlptions> tag instead of you having to
iterate and create the various <option>s.

Andrew
 
Reply With Quote
 
 
 
 
Gianni
Guest
Posts: n/a
 
      04-19-2004
(E-Mail Removed) (Andrew S.) wrote in message news:<(E-Mail Removed). com>...
> (E-Mail Removed) (Gianni) wrote in message news:<(E-Mail Removed) om>...
> > I have in my JSP a select box like this
> > I can't find the way to keep what user selected in the next page
> >
> >
> > <select name="selectedParmet" size="17"
> > onchange="selezionagrandezza();">
> > <logicresent name="parametri">
> > <logic:iterate name="parametri" id="parametro"
> > scope="session">
> > <option value="<%=((it.sian.MIEDAX.ejb.MieaparmValue)param etro).getID_PARMET()%>"><bean:write
> > name="parametro" property="DESCR_PARMET"/></option>
> > </logic:iterate>
> > </logicresent>
> > </select>
> >
> >
> > in the actionform class I have code like this:
> >
> > public String getSelectedParmet()
> >
> > {
> > return this.selectedParmet;
> > }
> > public void setSelectedParmet(String selectedParmet)
> > {
> > this.selectedParmet = selectedParmet;
> > }
> >
> >
> > and in the relative action class I have a this:
> >
> > dsForm.setSelectedParmet(grandezzaselezionata);
> >
> >
> > I expect to see selected the next page ... but nothing to do !
> > Where is the error ??
> > Thanks Grazie

>
> Use the <html:select> tag (which automatically does what you're trying
> to do)instead of manually creating the <select> tag.
>
> <html:select property="selectedParmet"
> onchange="selezionagrandezza();" >
> ...
> </html:select>
>
> Also, consider using the <htmlptions> tag instead of you having to
> iterate and create the various <option>s.
>
> Andrew


Im trying to use the Struts select tag to keep the optionlist
selected.
if I use the html tag select everything works
if I use the Struts select and option tags I get this error:

URI richiesta:/bdan/MIEDAL060.jsp



Eccezione:
java.lang.NullPointerException
at oracle.jsp.parse.OpenJspAVInfo.setValue(OpenJspAVI nfo.java:353)
at oracle.jsp.parse.OpenJspTagHandler.processAttribut eValue(OpenJspTagHandler.java:179)
at oracle.jsp.parse.JspParseTag.parse(JspParseTag.jav a:661)
at oracle.jsp.parse.OpenJspTagHandler.parse(OpenJspTa gHandler.java:467)
at oracle.jsp.parse.JspParseTag.parseNextTag(JspParse Tag.java:54




<!-- Select without Struts IT WORKS !!!

<select name ="selectedVarmet" size="17" multiple
onchange="aggiorna();">
<logic:iterate name="varmeteo" id="varmeteo" scope="session">
<option value="<%=((it.sian.MIEDAX.ejb.MieavarmValue)varme teo).getCOD_VARMET()%>"><bean:write
name="varmeteo" property="DESCR_VARMET"/></option>
</logic:iterate>
</select>
The next is the select with Struts DOES NOT WORK !!!!
-->

<html:select name ="selectedVarmet" size="17" multiple
onchange="aggiorna();">
<logicresent name="varmeteo">
<logic:iterate name="varmeteo" id="varmeteo" scope="session">
<htmlption value="<%=((it.sian.MIEDAX.ejb.MieavarmValue)varme teo).getCOD_VARMET()%>"><bean:write
name="varmeteo" property="DESCR_VARMET"/></htmlption>
</logic:iterate>
</logicresent>
</html:select>



Please help ! What do I do wrong ?
Gianni
 
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
How keep python socket alive for ever by setting Keep alive flag. hisan Python 1 06-25-2012 05:30 PM
asp.net mvc SelectList help rodchar ASP .Net 4 09-30-2009 04:22 PM
Create SelectList shapper ASP .Net 5 09-08-2008 04:11 PM
popup after selection from selectlist Giel Raijmakers Ruby 0 01-04-2008 08:47 AM
Mechanize SelectList Issue jwcooper Ruby 1 03-21-2007 03:35 PM



Advertisments