On 9/7/06, Ashish Vijaywargiya <[EMAIL PROTECTED]> wrote:

Thx for the reply puz.
I changed as you said.
and kept the values in pageContext and i also converted the member
variable to "public static".

<%
request.setAttribute("hours", StaticData.hours);
request.setAttribute("minutes", StaticData.minutes);
%>

I think you need to give fully qualified name for your class.

And in case you are using this hours and minutes for this page only then do
this

<%
pageContext.setAttribute("hours", fully.qualified.name.StaticData,
PageContext.PAGE_SCOPE);
%>

But in the combo box it is not populating the values.The combo box code is :
        <html:select property="startTimeHour">
           <html:options name="hours" labelName="hours" />
        </html:select>
        <html:select property="startTimeMinute">
            <html:options name="minutes" labelName="minutes" />
         </html:select>

I also created the getter setter methods for the startTimeMinute &
startTimeHour
When printed the values from StaticData.minutes[1],StaticData.minutes[2]
then it is displaying the value in the console.But it is not populating
the values in combo box.My case is resemble as those example given in the
struts-example.war file that comes with struts distribution.But my value
is not populating in combo box.

Please help.
Thanks in advance.



[EMAIL PROTECTED] wrote:
Create the Interface attributes / member variables as "public static "
attributes.

Then in the JSP use the attribute and set the value into pageContext.

then u can easily use it wityh Struts tag libs.

Thanks and regards,
Pazhanikanthan. P (Paz)

Consultant for AXA,
Senior Software Engineer,
HCL Australia Services Pty. Ltd.
Off   : +61-3-9618-4085
Mob : +61-0411-354-838



Ashish Vijaywargiya <[EMAIL PROTECTED]> 07/09/2006 02:11 PM
Please respond to "Struts Users Mailing List"

        To:        Struts-Users Mailing List <user@struts.apache.org>
        cc:
        Subject:        How to access Static Data in jsp file


Hello,

I created an Interface as the code shown below :

public interface StaticData {
     String[] minutes = { "01", "02", "03", "04", "05", "06", "07", "08",
"09",
             "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
"20",
             "21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
"31",
             "32", "33", "34", "35", "36", "37", "38", "39", "40", "41",
"42",
             "43", "44", "45", "46", "47", "48", "49", "50", "51", "52",
"53",
             "54", "55", "56", "57", "58", "59" };

     String[] hours = { "00", "01", "02", "03", "04", "05", "06", "07",
"08",
             "09", "10", "11", "12", "13", "14", "15", "16", "17", "18",
"19",
             "20", "21", "22", "23" };
}


I would like use this values in jsp file with the help of <jsp:useBean> &
<bean:define>.And then I would like to populate resulted value in combo box.

Can anybody of you tell me how to access this values in jsp file ???
I don't want to create the getter() setter() methods for it.

Thanks in advance.
Regards
Ashish Vijaywargiya




---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call
rates.

_____________________________________________________________________
This e-mail has been scanned for viruses by MCI's Internet Managed
Scanning Services - powered by MessageLabs. For further information
visit http://www.mci.com





*********************************************************************************
Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege.  If you are not
the intended recipient you must not use, distribute or copy this
email.  If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of AXA.   Thank you.

**********************************************************************************


---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.




--
Puneet

Reply via email to