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 struts 2 tags question, certain jsp code not being executed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts 2 tags question, certain jsp code not being executed" Watch "struts 2 tags question, certain jsp code not being executed" New topic
Author

struts 2 tags question, certain jsp code not being executed

Ghazy Mahjub
Greenhorn

Joined: Apr 05, 2009
Posts: 1
I have the following code in my jsp...

<s:url action="stockQuote" id="stockQuoteCharter">
<s:param name="sTicker"><s:property value="sTicker" /></s:param>
<s:param name="category"><s:property value="category" /></s:param>
</s:url>
<div align="top" style="width: 300px;border-style: solid; background-color: #F5FFFA">
<s:div id="chart1" theme="ajax" href="%{stockQuoteCharter}" loadingText="Loading..." listenTopics="/refresh10"/>
</div>



<s:url id="stockQuoteInitChart" action="stockQuote">
<s:param name="sTicker"><s:property value="sTicker" /></s:param>
<s:param name="category">SP500</s:param>
</s:url>
<s:a theme="ajax" href="%{stockQuoteInitChart}" executeScripts="true" targets="chart1"><b><font size="2.0" color="blue"><s:property value="sTicker" /></font></b></s:a>
</td>

As you can see, pressing on a link here should executed the action stockQuote and then display the result in the target div id="chart1". Well, everything is fine except that it does not display the result in the target div, it simply takes me to a new page and displays the result jsp on a new page. Why??? I don't know. In addition, when this page gets loaded, it should load the contents of the div, but it is simply empty. This is getting really frustrating so please any help is much appreciated. Thank you!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60792
    
  65

Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Have you included the <s:head> tag with the "ajax" theme? This is required to load the Dojo scripts. Also, you may need to use OGNL's "#" character when referencing the URL created with the <s:url> tag in the <s:a> tag's "href" attribute.
 
Consider Paul's rocket mass heater.
 
subject: struts 2 tags question, certain jsp code not being executed
 
Similar Threads
Problem With I18n feature of Struts2
Accessing param in Struts.xml Action Mapping
> expected error in JSP (struts 2)
struts url problem
passing form parameters such us textfield values using url tag