I am trying to use
tag to render my list in Struts2 jsp.
At the same location I have used a tag as well
Data is getting populated
Solved.
May this be of some help to others,
All I had to do was change the web.xml
as below:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
Earlier I had set the filter as
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<session-config>
So the struts2-jquery tag could not find the corresponding .js files
Solution: change from <url-pattern>*.action</url-pattern>
to <url-pattern>/*</url-pattern>
Thus, please be sure to check the web.xml
for such anomalies which often go overlooked as in my case.
You don't need to load jQuery twice, different versions might conflict with each other. This code is wrong
<script src="<%=request.getContextPath()%>/jq/jquery-1.8.2.min.js"
type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/jq/functions.js"
type="text/javascript"></script>
The sj:select
tag should work if your action returns JSON, but it uses old notation. Change it to
<s:url var="remoteurl" action="sample2"/>
<sj:select
href="%{#remoteurl}"
id="echo"
name="echo"
list="languageList"
emptyOption="true"
headerKey="-1"
headerValue="Please Select a Language"
/>
Check that jquery, json plugins are on the class path and taglibs worked.