File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Show the value in select tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Show the value in select tag" Watch "Show the value in select tag" New topic
Author

Show the value in select tag

Achyut Behera
Greenhorn

Joined: Mar 09, 2009
Posts: 17
I have declare ar arry in form bean class and use two select box having same property name.
when i am retrive i am putting into the array.

but in the select box it is not showing.

can any body know, how to retrive an array into select box.

Thanks,
Achyut
Rajul Konkar
Greenhorn

Joined: Nov 05, 2008
Posts: 20




this select options will have same key-value .


Only pioneer take the untravelled path.


Only pioneer take the untraveled path

Achyut Behera
Greenhorn

Joined: Mar 09, 2009
Posts: 17
How i am using in my jsp i have written below.
<sLogic:iterate name="interCompanyRent" id="interCompany">
<TR>
<TD align="right"><layout:label>Rem Div:</layout:label></TD>
<TD>
<rem:select property="divisionId" value='"<bean:write name="interCompany" property="divisionId"/>' >
<htmlption value="">-- Select Division --</htmlption>
<htmlptions collection="all_division_list" property="id" labelProperty="label" />
</rem:select>
</TD>
<TD align="center"><layout:label>Account No:</layout:label></TD>
<TD>
<INPUT name="accountNo" type="text" size="20" value="<bean:write name="interCompany" property="accountNo"/>"/>
</TD>
</sLogic:iterate>

In the rem:select tag i m using value attribute, but it is not retriving.
Can you please give me the details in the class level what things i have to define .
and how to set into that drop down box.

Thanks in Advance,
Achyut

Achyut Behera
Greenhorn

Joined: Mar 09, 2009
Posts: 17
I have define in my select tag as per your code.
Is it like this way?
<rem:select property="divisionId" styleId="divisionId">
<sLogic:notEmpty name="interCompanyRent" property="divisionId" >
<bean:define id="id" name="interCompanyRent" property="divisionId" />
<htmlption value="">-- Select Division --</htmlption>
<htmlptions collection="all_division_list" property="id" labelProperty="label" />
</sLogic:notEmpty>
</rem:select>

when i am setting this way it showing jsp compiling error
[Servlet Error]-[No getter method for property divisionId of bean interCompanyRent]: javax.servlet.jsp.JspException: No getter method for property divisionId of bean interCompanyRent

<rem:select property="divisionId" styleId="divisionId">
This divisionId is an array in formbean class.
<sLogic:notEmpty name="interCompanyRent" property="divisionId" >
I have store the value in session scope as name interCompanyRent.
And InterCompanyRent is a bean class where i have set the divisionId.

I need to know how i will define the bean class. and how to retrive and set.
Please help. Its urgent.

Thanks in Advance,
Achyut

Achyut Behera
Greenhorn

Joined: Mar 09, 2009
Posts: 17
I need help.

Can anybody look into this problem.

Thanks,
Achyut
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're not giving much to go on. Post the config of the action that displays the JSP and the code of the action where the bean is put in to scope.
Achyut Behera
Greenhorn

Joined: Mar 09, 2009
Posts: 17
In the action class i m set the value into the bean class and store into session.

request.setAttribute("interCompanyRent", interComp.getInterCompanyRent());

interComp.getInterCompanyRent() returns list data structure.

here is the bean class.

public class InterCompanyRentChang
{
private Long divisionId;
private String accountNo;
private String amount;
private List interCompanyRent=new ArrayList();

and setter getter methods for each variable.
}

I am iterating in jsp. want to set the value in jsp drop down box.
Is there anything i am missing. Let me know.

Thanks,
Achyut
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Show the value in select tag