You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anjib Mulepati <an...@hotmail.com> on 2011/01/04 19:24:47 UTC

Struts 1 tags

Strits 1.3.8

Is there any error in following code? I am getting blank page. Can 
someone help me out?

<html:select title="Organizational Unit" styleId="organizationalUnit" 
property="organizationalUnit" tabindex="1">
<%
                             ArrayList<String> agencyList = 
(ArrayList<String>)request.getAttribute("list");
                             for(int i=0; i<agencyList.size(); i++){
                         %>
<html:option value='<%= agencyList.get(i) %>'></html:option>
<% } %>
</html:select>



Anjib

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Passing request objects - Struts 1

Posted by Dave Newton <da...@gmail.com>.
The first one: don't call a different action to get the options--get the
options in the same action that handles the original request.

The second one: read something about ajax; any tutorial discusses how to
deal with what you get back.

Dave
On Jan 5, 2011 12:14 AM, "Anjib" <an...@hotmail.com> wrote:
>
> Sorry I didn't get the first one. Can you please elaborate for me?
>
> For second option I didn't find the way to pass result to view
> especially Sturts tag.
>
> Anjib
>
>
> On 1/4/2011 7:47 PM, Dave Newton wrote:
>> Don't make a separate request? I mean, why wouldn't you just use the same
>> service inside the action you're actually calling?
>>
>> Either that, or do the Ajax call, and use normal Ajax response handling
>> mechanisms (HTML, JSON, whatever) you want.
>>
>> Dave
>>
>> On Tue, Jan 4, 2011 at 7:29 PM, Anjib<an...@hotmail.com> wrote:
>>
>>> How can I achieve this with only using Struts then?
>>>
>>>
>>> On 1/4/2011 7:20 PM, Dave Newton wrote:
>>>
>>>> The ajax post is an entirely separate request.
>>>>
>>>> Dave
>>>> On Jan 4, 2011 5:38 PM, "Anjib Mulepati"<an...@hotmail.com> wrote:
>>>>
>>>>> struts 1.3.8
>>>>> 1. I try to use JSTL but when i include jstl reference it doesn't let
me
>>>>> in saying it version conflict wih web.xml.
>>>>> My web.xml has
>>>>> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>>>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>>>>>
>>>>> I have been debugging this problem for a while and fig out that
problem
>>>>> was because I am not able to get value in the request object. So still
>>>>> looking for the solution.
>>>>>
>>>>> Here is the latest scenario:
>>>>> I am trying to populate the drop down box in the initial login page.
>>>>> a) Struts config file have action mapping for login page as
>>>>> <action path="/Login" forward="loginPage"/>
>>>>>
>>>>> and getting list action mapping as
>>>>> <action path="/getAgencyList"
>>>>> type="gov.ma.itd.grouping.actions.GetAgencyListAction">
>>>>>
>>>>> b) login.jsp page call the action class to get the list on page load.
>>>>> $(document).ready(function() {
>>>>> $.post("getAgencyList.do");
>>>>> }
>>>>>
>>>>> and populate in the drop down list
>>>>>
>>>>> <html:select title="Organizational Unit" styleId="organizationalUnit"
>>>>>
>>>> property="organizationalUnit" tabindex="1">
>>>>
>>>>> <%
>>>>> ArrayList<String> agencyList =
>>>>>
>>>> (ArrayList<String>)request.getAttribute("list");
>>>>
>>>>> for(int i=0; i<agencyList.size(); i++){
>>>>> %>
>>>>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>>>>> <% } %>
>>>>> </html:select>
>>>>>
>>>>> c) Action class return the list as follow
>>>>> ArrayList<String> agencyList = new ArrayList<String>();
>>>>> AgencyDAO agency = new AgencyDAO();
>>>>> agencyList = agency.getAllAgency();
>>>>> request.setAttribute("list", agencyList);
>>>>> return mapping.findForward(SUCCESS);
>>>>>
>>>>> Right now I haven't map the success to any page. I am assuming once I
set
>>>>>
>>>> the request object with result in action class JSP page can get that
value
>>>> as this action class is called on by this page. Is my assumption right
or
>>>> wrong?
>>>>
>>>>> Can you suggest how can I fix this problem?
>>>>>
>>>>> Anjib
>>>>>
>>>>>
>>>>>
>>>>> On 1/4/2011 3:07 PM, Dave Newton wrote:
>>>>>
>>>>>> 1) Why aren't you using existing mechanisms to do this and instead
>>>>>>
>>>>> relying
>>>>> on scriptlets? Either JSTL or whatever that existing S1 tag for option
>>>>>> collections is would be far cleaner.
>>>>>>
>>>>>> 2) Is there anything in the logs?
>>>>>>
>>>>>> 3) Are you using Tiles (which back in the day swallowed exceptions
whole
>>>>>> sometimes)?
>>>>>>
>>>>>> 4) Are you using the rtexpr tags?
>>>>>>
>>>>>> Dave
>>>>>>
>>>>>> On Tue, Jan 4, 2011 at 1:24 PM, Anjib Mulepati<an...@hotmail.com>
>>>>>>
>>>>> wrote:
>>>>> Strits 1.3.8
>>>>>>> Is there any error in following code? I am getting blank page. Can
>>>>>>>
>>>>>> someone
>>>>> help me out?
>>>>>>> <html:select title="Organizational Unit"
styleId="organizationalUnit"
>>>>>>> property="organizationalUnit" tabindex="1">
>>>>>>> <%
>>>>>>> ArrayList<String> agencyList =
>>>>>>> (ArrayList<String>)request.getAttribute("list");
>>>>>>> for(int i=0; i<agencyList.size(); i++){
>>>>>>> %>
>>>>>>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>>>>>>> <% } %>
>>>>>>> </html:select>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Anjib
>>>>>>>
>>>>>>>
---------------------------------------------------------------------
>>>>>>> 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
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> 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
>

Re: Passing request objects - Struts 1

Posted by Anjib <an...@hotmail.com>.
  Sorry I didn't get the first one. Can you please elaborate for me?

For second option I didn't find the way to pass result to view 
especially Sturts tag.

Anjib


On 1/4/2011 7:47 PM, Dave Newton wrote:
> Don't make a separate request? I mean, why wouldn't you just use the same
> service inside the action you're actually calling?
>
> Either that, or do the Ajax call, and use normal Ajax response handling
> mechanisms (HTML, JSON, whatever) you want.
>
> Dave
>
> On Tue, Jan 4, 2011 at 7:29 PM, Anjib<an...@hotmail.com>  wrote:
>
>>   How can I achieve this with only using Struts then?
>>
>>
>> On 1/4/2011 7:20 PM, Dave Newton wrote:
>>
>>> The ajax post is an entirely separate request.
>>>
>>> Dave
>>> On Jan 4, 2011 5:38 PM, "Anjib Mulepati"<an...@hotmail.com>   wrote:
>>>
>>>> struts 1.3.8
>>>> 1. I try to use JSTL but when i include jstl reference it doesn't let me
>>>> in saying it version conflict wih web.xml.
>>>> My web.xml has
>>>> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>>>>
>>>> I have been debugging this problem for a while and fig out that problem
>>>> was because I am not able to get value in the request object. So still
>>>> looking for the solution.
>>>>
>>>> Here is the latest scenario:
>>>> I am trying to populate the drop down box in the initial login page.
>>>> a) Struts config file have action mapping for login page as
>>>> <action path="/Login" forward="loginPage"/>
>>>>
>>>> and getting list action mapping as
>>>> <action path="/getAgencyList"
>>>> type="gov.ma.itd.grouping.actions.GetAgencyListAction">
>>>>
>>>> b) login.jsp page call the action class to get the list on page load.
>>>> $(document).ready(function() {
>>>> $.post("getAgencyList.do");
>>>> }
>>>>
>>>> and populate in the drop down list
>>>>
>>>> <html:select title="Organizational Unit" styleId="organizationalUnit"
>>>>
>>> property="organizationalUnit" tabindex="1">
>>>
>>>> <%
>>>> ArrayList<String>   agencyList =
>>>>
>>> (ArrayList<String>)request.getAttribute("list");
>>>
>>>> for(int i=0; i<agencyList.size(); i++){
>>>> %>
>>>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>>>> <% } %>
>>>> </html:select>
>>>>
>>>> c) Action class return the list as follow
>>>> ArrayList<String>   agencyList = new ArrayList<String>();
>>>> AgencyDAO agency = new AgencyDAO();
>>>> agencyList = agency.getAllAgency();
>>>> request.setAttribute("list", agencyList);
>>>> return mapping.findForward(SUCCESS);
>>>>
>>>> Right now I haven't map the success to any page. I am assuming once I set
>>>>
>>> the request object with result in action class JSP page can get that value
>>> as this action class is called on by this page. Is my assumption right or
>>> wrong?
>>>
>>>> Can you suggest how can I fix this problem?
>>>>
>>>> Anjib
>>>>
>>>>
>>>>
>>>> On 1/4/2011 3:07 PM, Dave Newton wrote:
>>>>
>>>>> 1) Why aren't you using existing mechanisms to do this and instead
>>>>>
>>>> relying
>>>> on scriptlets? Either JSTL or whatever that existing S1 tag for option
>>>>> collections is would be far cleaner.
>>>>>
>>>>> 2) Is there anything in the logs?
>>>>>
>>>>> 3) Are you using Tiles (which back in the day swallowed exceptions whole
>>>>> sometimes)?
>>>>>
>>>>> 4) Are you using the rtexpr tags?
>>>>>
>>>>> Dave
>>>>>
>>>>> On Tue, Jan 4, 2011 at 1:24 PM, Anjib Mulepati<an...@hotmail.com>
>>>>>
>>>> wrote:
>>>> Strits 1.3.8
>>>>>> Is there any error in following code? I am getting blank page. Can
>>>>>>
>>>>> someone
>>>> help me out?
>>>>>> <html:select title="Organizational Unit" styleId="organizationalUnit"
>>>>>> property="organizationalUnit" tabindex="1">
>>>>>> <%
>>>>>> ArrayList<String>   agencyList =
>>>>>> (ArrayList<String>)request.getAttribute("list");
>>>>>> for(int i=0; i<agencyList.size(); i++){
>>>>>> %>
>>>>>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>>>>>> <% } %>
>>>>>> </html:select>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Anjib
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>>>
>>>>
>> ---------------------------------------------------------------------
>> 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


Re: Passing request objects - Struts 1

Posted by Dave Newton <da...@gmail.com>.
Don't make a separate request? I mean, why wouldn't you just use the same
service inside the action you're actually calling?

Either that, or do the Ajax call, and use normal Ajax response handling
mechanisms (HTML, JSON, whatever) you want.

Dave

On Tue, Jan 4, 2011 at 7:29 PM, Anjib <an...@hotmail.com> wrote:

>
>  How can I achieve this with only using Struts then?
>
>
> On 1/4/2011 7:20 PM, Dave Newton wrote:
>
>> The ajax post is an entirely separate request.
>>
>> Dave
>> On Jan 4, 2011 5:38 PM, "Anjib Mulepati"<an...@hotmail.com>  wrote:
>>
>>> struts 1.3.8
>>> 1. I try to use JSTL but when i include jstl reference it doesn't let me
>>> in saying it version conflict wih web.xml.
>>> My web.xml has
>>> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>>>
>>> I have been debugging this problem for a while and fig out that problem
>>> was because I am not able to get value in the request object. So still
>>> looking for the solution.
>>>
>>> Here is the latest scenario:
>>> I am trying to populate the drop down box in the initial login page.
>>> a) Struts config file have action mapping for login page as
>>> <action path="/Login" forward="loginPage"/>
>>>
>>> and getting list action mapping as
>>> <action path="/getAgencyList"
>>> type="gov.ma.itd.grouping.actions.GetAgencyListAction">
>>>
>>> b) login.jsp page call the action class to get the list on page load.
>>> $(document).ready(function() {
>>> $.post("getAgencyList.do");
>>> }
>>>
>>> and populate in the drop down list
>>>
>>> <html:select title="Organizational Unit" styleId="organizationalUnit"
>>>
>> property="organizationalUnit" tabindex="1">
>>
>>> <%
>>> ArrayList<String>  agencyList =
>>>
>> (ArrayList<String>)request.getAttribute("list");
>>
>>> for(int i=0; i<agencyList.size(); i++){
>>> %>
>>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>>> <% } %>
>>> </html:select>
>>>
>>> c) Action class return the list as follow
>>> ArrayList<String>  agencyList = new ArrayList<String>();
>>> AgencyDAO agency = new AgencyDAO();
>>> agencyList = agency.getAllAgency();
>>> request.setAttribute("list", agencyList);
>>> return mapping.findForward(SUCCESS);
>>>
>>> Right now I haven't map the success to any page. I am assuming once I set
>>>
>> the request object with result in action class JSP page can get that value
>> as this action class is called on by this page. Is my assumption right or
>> wrong?
>>
>>> Can you suggest how can I fix this problem?
>>>
>>> Anjib
>>>
>>>
>>>
>>> On 1/4/2011 3:07 PM, Dave Newton wrote:
>>>
>>>> 1) Why aren't you using existing mechanisms to do this and instead
>>>>
>>> relying
>>
>>> on scriptlets? Either JSTL or whatever that existing S1 tag for option
>>>> collections is would be far cleaner.
>>>>
>>>> 2) Is there anything in the logs?
>>>>
>>>> 3) Are you using Tiles (which back in the day swallowed exceptions whole
>>>> sometimes)?
>>>>
>>>> 4) Are you using the rtexpr tags?
>>>>
>>>> Dave
>>>>
>>>> On Tue, Jan 4, 2011 at 1:24 PM, Anjib Mulepati<an...@hotmail.com>
>>>>
>>> wrote:
>>
>>> Strits 1.3.8
>>>>>
>>>>> Is there any error in following code? I am getting blank page. Can
>>>>>
>>>> someone
>>
>>> help me out?
>>>>>
>>>>> <html:select title="Organizational Unit" styleId="organizationalUnit"
>>>>> property="organizationalUnit" tabindex="1">
>>>>> <%
>>>>> ArrayList<String>  agencyList =
>>>>> (ArrayList<String>)request.getAttribute("list");
>>>>> for(int i=0; i<agencyList.size(); i++){
>>>>> %>
>>>>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>>>>> <% } %>
>>>>> </html:select>
>>>>>
>>>>>
>>>>>
>>>>> Anjib
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Passing request objects - Struts 1

Posted by Anjib <an...@hotmail.com>.
  How can I achieve this with only using Struts then?

On 1/4/2011 7:20 PM, Dave Newton wrote:
> The ajax post is an entirely separate request.
>
> Dave
> On Jan 4, 2011 5:38 PM, "Anjib Mulepati"<an...@hotmail.com>  wrote:
>> struts 1.3.8
>> 1. I try to use JSTL but when i include jstl reference it doesn't let me
>> in saying it version conflict wih web.xml.
>> My web.xml has
>> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>>
>> I have been debugging this problem for a while and fig out that problem
>> was because I am not able to get value in the request object. So still
>> looking for the solution.
>>
>> Here is the latest scenario:
>> I am trying to populate the drop down box in the initial login page.
>> a) Struts config file have action mapping for login page as
>> <action path="/Login" forward="loginPage"/>
>>
>> and getting list action mapping as
>> <action path="/getAgencyList"
>> type="gov.ma.itd.grouping.actions.GetAgencyListAction">
>>
>> b) login.jsp page call the action class to get the list on page load.
>> $(document).ready(function() {
>> $.post("getAgencyList.do");
>> }
>>
>> and populate in the drop down list
>>
>> <html:select title="Organizational Unit" styleId="organizationalUnit"
> property="organizationalUnit" tabindex="1">
>> <%
>> ArrayList<String>  agencyList =
> (ArrayList<String>)request.getAttribute("list");
>> for(int i=0; i<agencyList.size(); i++){
>> %>
>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>> <% } %>
>> </html:select>
>>
>> c) Action class return the list as follow
>> ArrayList<String>  agencyList = new ArrayList<String>();
>> AgencyDAO agency = new AgencyDAO();
>> agencyList = agency.getAllAgency();
>> request.setAttribute("list", agencyList);
>> return mapping.findForward(SUCCESS);
>>
>> Right now I haven't map the success to any page. I am assuming once I set
> the request object with result in action class JSP page can get that value
> as this action class is called on by this page. Is my assumption right or
> wrong?
>> Can you suggest how can I fix this problem?
>>
>> Anjib
>>
>>
>>
>> On 1/4/2011 3:07 PM, Dave Newton wrote:
>>> 1) Why aren't you using existing mechanisms to do this and instead
> relying
>>> on scriptlets? Either JSTL or whatever that existing S1 tag for option
>>> collections is would be far cleaner.
>>>
>>> 2) Is there anything in the logs?
>>>
>>> 3) Are you using Tiles (which back in the day swallowed exceptions whole
>>> sometimes)?
>>>
>>> 4) Are you using the rtexpr tags?
>>>
>>> Dave
>>>
>>> On Tue, Jan 4, 2011 at 1:24 PM, Anjib Mulepati<an...@hotmail.com>
> wrote:
>>>> Strits 1.3.8
>>>>
>>>> Is there any error in following code? I am getting blank page. Can
> someone
>>>> help me out?
>>>>
>>>> <html:select title="Organizational Unit" styleId="organizationalUnit"
>>>> property="organizationalUnit" tabindex="1">
>>>> <%
>>>> ArrayList<String>  agencyList =
>>>> (ArrayList<String>)request.getAttribute("list");
>>>> for(int i=0; i<agencyList.size(); i++){
>>>> %>
>>>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>>>> <% } %>
>>>> </html:select>
>>>>
>>>>
>>>>
>>>> Anjib
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Passing request objects - Struts 1

Posted by Dave Newton <da...@gmail.com>.
The ajax post is an entirely separate request.

Dave
On Jan 4, 2011 5:38 PM, "Anjib Mulepati" <an...@hotmail.com> wrote:
> struts 1.3.8
> 1. I try to use JSTL but when i include jstl reference it doesn't let me
> in saying it version conflict wih web.xml.
> My web.xml has
> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>
> I have been debugging this problem for a while and fig out that problem
> was because I am not able to get value in the request object. So still
> looking for the solution.
>
> Here is the latest scenario:
> I am trying to populate the drop down box in the initial login page.
> a) Struts config file have action mapping for login page as
> <action path="/Login" forward="loginPage"/>
>
> and getting list action mapping as
> <action path="/getAgencyList"
> type="gov.ma.itd.grouping.actions.GetAgencyListAction">
>
> b) login.jsp page call the action class to get the list on page load.
> $(document).ready(function() {
> $.post("getAgencyList.do");
> }
>
> and populate in the drop down list
>
> <html:select title="Organizational Unit" styleId="organizationalUnit"
property="organizationalUnit" tabindex="1">
> <%
> ArrayList<String> agencyList =
(ArrayList<String>)request.getAttribute("list");
> for(int i=0; i<agencyList.size(); i++){
> %>
> <html:option value='<%= agencyList.get(i) %>'></html:option>
> <% } %>
> </html:select>
>
> c) Action class return the list as follow
> ArrayList<String> agencyList = new ArrayList<String>();
> AgencyDAO agency = new AgencyDAO();
> agencyList = agency.getAllAgency();
> request.setAttribute("list", agencyList);
> return mapping.findForward(SUCCESS);
>
> Right now I haven't map the success to any page. I am assuming once I set
the request object with result in action class JSP page can get that value
as this action class is called on by this page. Is my assumption right or
wrong?
>
> Can you suggest how can I fix this problem?
>
> Anjib
>
>
>
> On 1/4/2011 3:07 PM, Dave Newton wrote:
>> 1) Why aren't you using existing mechanisms to do this and instead
relying
>> on scriptlets? Either JSTL or whatever that existing S1 tag for option
>> collections is would be far cleaner.
>>
>> 2) Is there anything in the logs?
>>
>> 3) Are you using Tiles (which back in the day swallowed exceptions whole
>> sometimes)?
>>
>> 4) Are you using the rtexpr tags?
>>
>> Dave
>>
>> On Tue, Jan 4, 2011 at 1:24 PM, Anjib Mulepati<an...@hotmail.com>
wrote:
>>
>>> Strits 1.3.8
>>>
>>> Is there any error in following code? I am getting blank page. Can
someone
>>> help me out?
>>>
>>> <html:select title="Organizational Unit" styleId="organizationalUnit"
>>> property="organizationalUnit" tabindex="1">
>>> <%
>>> ArrayList<String> agencyList =
>>> (ArrayList<String>)request.getAttribute("list");
>>> for(int i=0; i<agencyList.size(); i++){
>>> %>
>>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>>> <% } %>
>>> </html:select>
>>>
>>>
>>>
>>> Anjib
>>>
>>> ---------------------------------------------------------------------
>>> 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
>

Passing request objects - Struts 1

Posted by Anjib Mulepati <an...@hotmail.com>.
struts 1.3.8
1. I try to use JSTL but when i include jstl reference it doesn't let me 
in saying it version conflict wih web.xml.
My web.xml has
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

I have been debugging this problem for a while and fig out that problem 
was because I am not able to get value in the request object. So still 
looking for the solution.

Here is the latest scenario:
I am trying to populate the drop down box in the initial login page.
a) Struts config file have action mapping for login page as
<action path="/Login" forward="loginPage"/>

and getting list action mapping as
<action path="/getAgencyList" 
type="gov.ma.itd.grouping.actions.GetAgencyListAction">

b) login.jsp page call the action class to get the list on page load.
     $(document).ready(function() {
         $.post("getAgencyList.do");
     }

and populate in the drop down list

<html:select title="Organizational Unit" styleId="organizationalUnit" property="organizationalUnit" tabindex="1">
<%
	ArrayList<String>  agencyList = (ArrayList<String>)request.getAttribute("list");
	for(int i=0; i<agencyList.size(); i++){
%>
<html:option value='<%= agencyList.get(i) %>'></html:option>
<% } %>
</html:select>

c) Action class return the list as follow
	ArrayList<String>  agencyList = new ArrayList<String>();
         AgencyDAO agency = new AgencyDAO();
         agencyList = agency.getAllAgency();
         request.setAttribute("list", agencyList);
         return mapping.findForward(SUCCESS);

Right now I haven't map the success to any page. I am assuming once I set the request object with result in action class JSP page can get that value as this action class is called on by this page. Is my assumption right or wrong?

Can you suggest how can I fix this problem?

Anjib



On 1/4/2011 3:07 PM, Dave Newton wrote:
> 1) Why aren't you using existing mechanisms to do this and instead relying
> on scriptlets? Either JSTL or whatever that existing S1 tag for option
> collections is would be far cleaner.
>
> 2) Is there anything in the logs?
>
> 3) Are you using Tiles (which back in the day swallowed exceptions whole
> sometimes)?
>
> 4) Are you using the rtexpr tags?
>
> Dave
>
> On Tue, Jan 4, 2011 at 1:24 PM, Anjib Mulepati<an...@hotmail.com>  wrote:
>
>> Strits 1.3.8
>>
>> Is there any error in following code? I am getting blank page. Can someone
>> help me out?
>>
>> <html:select title="Organizational Unit" styleId="organizationalUnit"
>> property="organizationalUnit" tabindex="1">
>> <%
>>                             ArrayList<String>  agencyList =
>> (ArrayList<String>)request.getAttribute("list");
>>                             for(int i=0; i<agencyList.size(); i++){
>>                         %>
>> <html:option value='<%= agencyList.get(i) %>'></html:option>
>> <% } %>
>> </html:select>
>>
>>
>>
>> Anjib
>>
>> ---------------------------------------------------------------------
>> 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


Re: Struts 1 tags

Posted by Dave Newton <da...@gmail.com>.
1) Why aren't you using existing mechanisms to do this and instead relying
on scriptlets? Either JSTL or whatever that existing S1 tag for option
collections is would be far cleaner.

2) Is there anything in the logs?

3) Are you using Tiles (which back in the day swallowed exceptions whole
sometimes)?

4) Are you using the rtexpr tags?

Dave

On Tue, Jan 4, 2011 at 1:24 PM, Anjib Mulepati <an...@hotmail.com> wrote:

> Strits 1.3.8
>
> Is there any error in following code? I am getting blank page. Can someone
> help me out?
>
> <html:select title="Organizational Unit" styleId="organizationalUnit"
> property="organizationalUnit" tabindex="1">
> <%
>                            ArrayList<String> agencyList =
> (ArrayList<String>)request.getAttribute("list");
>                            for(int i=0; i<agencyList.size(); i++){
>                        %>
> <html:option value='<%= agencyList.get(i) %>'></html:option>
> <% } %>
> </html:select>
>
>
>
> Anjib
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>