• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem displaying link content in a perticular page using Struts

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am new to struts applications. I have a link in my jsp which points to an actionClass whcih has two forwards.


My struts-config has something like:

<action path="/TopicList" type="symc.simple.ui.actions.TopicAction"
name="searchForm"
scope="session">

<forward name="showSearchListData" path="/pages/searchList.jsp"/>
<forward name="showTopicData" path="/pages/details.jsp"/>
</action>

but whenever I click on any link in the jsp, like:

<html:link action="/TopicList.do?topic=something" title="" target="basefrm">List</html:link><br>

The contents (arrayList) is shown in the details.jsp, even though I have directed it to searchList.jsp, as given by the "else" section of my ActionClass:

The Action looks like this:
public class TopicAction extends ViewAction
{

...
public ActionForward execute(...)
{
if(<<some condition>>
{
//...do the processings
return mapping.findForward("showTopicData");
}
else
{
//initialize arraylist
request.getSession().setAttribute("resultList", arrayList);
searchForm.setResultList(arrayList);
return mapping.findForward("showSearchListData");

}
}
}

The funniest part is that "details.jsp" does not even have the <iterate> tag to handle arrayLists, but still the link content gets displayed there.

Please help me.

Regards,
Entheos
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On what condition are you forwarding your requests?
Did you check your code in

if(<<some condition>>

 
sumita mukherjee
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,

Thanks for your reply. I kind of figured out where the problem lies....
in my jsp I have something like:


<html:link action="/TopicList.do?topic=myTopic" styleId="leftmenuHREF" title="" target="basefrm">VBR Database</html:link><br>

Now the target="basefrm" comes from:
<iframe id=basefrm name=basefrm width=100% height=100% frameborder=0 src="<%= contextPath %>/pages/details.jsp"></iframe>


However, I have another Iframe as:


<iframe id=help_frame name=help_frame width=100% height=100%% frameborder=0 src="<%= contextPath %>/pages/searchList.jsp"></iframe>


Thus the target was always set to basefrm and I see the result of the link on the wrong portion of the screen.

Can anybody please help me as to how to dynamically set this "target" parameter in the Link tag, so that if forward is "showSearchListdata" the target is "help_frame" and if the forward is "showSearchData" the target should be "basefrm". Will a javascript help in this case? Also, how will I let the link know what forward it is set to?

Please help me.

Thanks in advance,
~E
 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In stead of


you could try something like this -


and set it using <html-el:link..> tag like this...


You could also set the <html-el:link.. > action dynamically in a similar fashion...
[ August 28, 2007: Message edited by: Bhaskar Reddy ]
 
sumita mukherjee
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This helped. Thanks a lot!!:-)

~E
 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice to know someone you helped could gain from it!!

happy coding!
 
reply
    Bookmark Topic Watch Topic
  • New Topic