File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Problem displaying link content in a perticular page using Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem displaying link content in a perticular page using Struts" Watch "Problem displaying link content in a perticular page using Struts" New topic
Author

Problem displaying link content in a perticular page using Struts

sumita mukherjee
Greenhorn

Joined: Aug 27, 2007
Posts: 22
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
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
On what condition are you forwarding your requests?
Did you check your code in
if(<<some condition>>
sumita mukherjee
Greenhorn

Joined: Aug 27, 2007
Posts: 22
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

Joined: Dec 17, 2002
Posts: 52
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

Joined: Aug 27, 2007
Posts: 22
This helped. Thanks a lot!!:-)

~E
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Nice to know someone you helped could gain from it!!

happy coding!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem displaying link content in a perticular page using Struts