struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anjib Mulepati <anji...@hotmail.com>
Subject Passing request objects - Struts 1
Date Tue, 04 Jan 2011 22:11:49 GMT
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<anjibcs@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


Mime
View raw message