struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: Passing request objects - Struts 1
Date Wed, 05 Jan 2011 00:47:25 GMT
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 <anjibcs@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"<anjibcs@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<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
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message