You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Vijaywargiya <vi...@yahoo.com> on 2006/09/07 06:11:43 UTC
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! Messengers low PC-to-Phone call rates.
Re: [OT] Re: How to access Static Data in jsp file
Posted by Bart Busschots <ba...@so-4pt.net>.
Antonio Petrelli wrote:
> Ashish Vijaywargiya ha scritto:
>> 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 think that this code can be posted at TheDailyWTF :-)
> Just a question: why did you write such a code?
You know I was thinking exact the same thing. Why bother with loops when
you can just waste your time and resources with arrays of sequential
numbers :)
BB
>
>
> ---------------------------------------------------------------------
> 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
[OT] Re: How to access Static Data in jsp file
Posted by Antonio Petrelli <br...@tariffenet.it>.
Ashish Vijaywargiya ha scritto:
> 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 think that this code can be posted at TheDailyWTF :-)
Just a question: why did you write such a code?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to access Static Data in jsp file
Posted by Puneet Lakhina <pu...@gmail.com>.
On 9/8/06, Ashish Vijaywargiya <vi...@yahoo.com> wrote:
>
> Hi Puneet,
>
> Thx for the reply.
> I think if you have the facility to import classes then you should use the
> import statement at the top of JSP file.That's what I did in my case.
>
> Like this :
> <%@ page import="java.util.*, com.exporder.web.StaticData" %>
Yeah ofcourse you can do this, I just thought this might be the problem for
the code not working. Just a shot in the dark u know :)
and then as simple as I used is shown below:
> <%
>
> request.setAttribute("hours", StaticData.hours);
> request.setAttribute("minutes", StaticData.minutes);
> %>
> Anyway I resolved my problem.
> Thanks for your precious time.
>
>
>
> ---------------------------------
> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great
> rates starting at 1¢/min.
>
--
Puneet
Re: How to access Static Data in jsp file
Posted by Ashish Vijaywargiya <vi...@yahoo.com>.
Hi Puneet,
Thx for the reply.
I think if you have the facility to import classes then you should use the import statement at the top of JSP file.That's what I did in my case.
Like this :
<%@ page import="java.util.*, com.exporder.web.StaticData" %>
and then as simple as I used is shown below:
<%
request.setAttribute("hours", StaticData.hours);
request.setAttribute("minutes", StaticData.minutes);
%>
Anyway I resolved my problem.
Thanks for your precious time.
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.
Re: How to access Static Data in jsp file
Posted by Puneet Lakhina <pu...@gmail.com>.
On 9/7/06, Ashish Vijaywargiya <vi...@yahoo.com> 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.
>
>
>
> paz.periasamy@axa.com.au 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 <vi...@yahoo.com> 07/09/2006 02:11 PM
> Please respond to "Struts Users Mailing List"
>
> To: Struts-Users Mailing List <us...@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
Re: How to access Static Data in jsp file
Posted by Puneet Lakhina <pu...@gmail.com>.
On 9/7/06, paz.periasamy@axa.com.au <pa...@axa.com.au> wrote:
>
> The object should be Collection object... not just simple String array
Can someone please clarify on this, coz AFAIK it can be an array of Objects.
--
Puneet
Re: How to access Static Data in jsp file
Posted by pa...@axa.com.au.
The object should be Collection object... not just simple String array
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 <vi...@yahoo.com>
07/09/2006 04:36 PM
To: paz.periasamy@axa.com.au, Struts Users Mailing List
<us...@struts.apache.org>
cc:
Subject: Re: How to access Static Data in jsp file
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);
%>
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.
paz.periasamy@axa.com.au 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 <vi...@yahoo.com>
07/09/2006 02:11 PM
Please respond to "Struts Users Mailing List"
To: Struts-Users Mailing List <us...@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.
_____________________________________________________________________
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.
**********************************************************************************
Re: How to access Static Data in jsp file
Posted by Ashish Vijaywargiya <vi...@yahoo.com>.
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);
%>
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.
paz.periasamy@axa.com.au 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 <vi...@yahoo.com> 07/09/2006 02:11 PM
Please respond to "Struts Users Mailing List"
To: Struts-Users Mailing List <us...@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.
Re: How to access Static Data in jsp file
Posted by pa...@axa.com.au.
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 <vi...@yahoo.com>
07/09/2006 02:11 PM
Please respond to "Struts Users Mailing List"
To: Struts-Users Mailing List <us...@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.
**********************************************************************************