Java 未显示在struts2中的url中添加参数
我在我试图进入的页面的url中添加了一个参数,但在生成的url中没有显示,这是为什么 这是我的jspJava 未显示在struts2中的url中添加参数,java,ajax,url,struts2,get,Java,Ajax,Url,Struts2,Get,我在我试图进入的页面的url中添加了一个参数,但在生成的url中没有显示,这是为什么 这是我的jsp <%@ taglib prefix="s" uri="/struts-tags"%> <%@ taglib prefix="sj" uri="/struts-jquery-tags"%> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="t
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<sj:head ajaxhistory = "true" ajaxcache="true" />
<script>
</script>
</head>
<body>
<h5>Struts Jquery Ajax Integration</h5>
<div id="resultContent"></div>
<noscript>Please Turn On Javascript to make the full use of this site</noscript>
<h4>Choose A task</h4>
<ul>
<s:url value="views/ajaxvalidation.jsp" var="ajaxvalidation" >
<s:param name="menuId" value="1"/>
</s:url>
<li><sj:a targets="resultContent" href="%{ajaxvalidation}">Ajax Validation</sj:a></li>
</ul>
<div>
<h6>Play A Music while You Navigate</h6>
<audio src="x.mp3" controls>Your browser does not support the
audio element.
</audio>
</div>
</body>
</html>
我在url中添加的menuId
参数在哪里
我不知道这是否会有所不同,但我正在使用这个插件进行jquery
生成的HTML
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="/HelloStruts2/struts/js/base/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/HelloStruts2/struts/js/base/jquery.ui.core.min.js?s2j=3.5.0"></script>
<script type="text/javascript" src="/HelloStruts2/struts/js/plugins/jquery.subscribe.min.js"></script>
<script type="text/javascript" src="/HelloStruts2/struts/js/plugins/jquery.ba-bbq.min.js"></script>
<script type="text/javascript" src="/HelloStruts2/struts/js/struts2/jquery.struts2.min.js?s2j=3.5.0"></script>
<script type="text/javascript">
$(function() {
jQuery.struts2_jquery.version="3.5.0";
jQuery.scriptPath = "/HelloStruts2/struts/";
jQuery.struts2_jquery.ajaxhistory = true;
jQuery.ajaxSettings.traditional = true;
jQuery.ajaxSetup ({
cache: false
});
jQuery.struts2_jquery.require("js/struts2/jquery.ui.struts2.min.js");
jQuery(window).trigger('hashchange');
});
</script>
<link id="jquery_theme_link" rel="stylesheet" href="/HelloStruts2/struts/themes/smoothness/jquery-ui.css?s2j=3.5.0" type="text/css"/>
<script>
</script>
</head>
<body>
<h5>Struts Jquery Ajax Integration By Kyel</h5>
<div id="resultContent"></div>
<noscript>Please Turn On Javascript to make the full use of this site</noscript>
<h4>Choose A task</h4>
<ul>
<li><a id="anchor_2068827505" href="javascript:void(0)">Ajax Validation</a>
<script type='text/javascript'>
jQuery(document).ready(function () {
var options_anchor_2068827505 = {};
options_anchor_2068827505.jqueryaction = "anchor";
options_anchor_2068827505.id = "anchor_2068827505";
options_anchor_2068827505.targets = "resultContent";
options_anchor_2068827505.href = "views/ajaxvalidation.jsp";
options_anchor_2068827505.hrefparameter = "menuId=1";
jQuery.struts2_jquery.bind(jQuery('#anchor_2068827505'),options_anchor_2068827505);
});
</script></li>
<li><a id="anchor_1381525763" href="javascript:void(0)">Thank you JSP</a>
<script type='text/javascript'>
jQuery(document).ready(function () {
var options_anchor_1381525763 = {};
options_anchor_1381525763.jqueryaction = "anchor";
options_anchor_1381525763.id = "anchor_1381525763";
options_anchor_1381525763.targets = "resultContent";
options_anchor_1381525763.href = "views/thankyou.jsp";
options_anchor_1381525763.hrefparameter = "menuId=2";
jQuery.struts2_jquery.bind(jQuery('#anchor_1381525763'),options_anchor_1381525763);
});
</script></li>
</ul>
<div>
<h6>Play A Music while You Navigate</h6>
<audio src="x.mp3" controls>Your browser does not support the
audio element.
</audio>
</div>
</body>
在此处插入标题
$(函数(){
jQuery.struts2_jQuery.version=“3.5.0”;
jQuery.scriptPath=“/HelloStruts2/struts/”;
jQuery.struts2_jQuery.ajaxhistory=true;
jQuery.ajaxSettings.traditional=true;
jQuery.ajaxSetup({
缓存:false
});
struts2_jQuery.require(“js/struts2/jQuery.ui.struts2.min.js”);
jQuery(window.trigger('hashchange');
});
Kyle的Struts Jquery Ajax集成
请打开Javascript以充分利用此网站
选择一项任务
-
jQuery(文档).ready(函数(){
var选项\u anchor\u 2068827505={};
选项\u anchor\u 2068827505.jqueryaction=“anchor”;
选项--U锚定--U 2068827505.id=“锚定--U 2068827505”;
选项\u anchor\u 2068827505.targets=“resultContent”;
选项\u anchor\u 2068827505.href=“views/ajaxvalidation.jsp”;
选项\u anchor\u 2068827505.hrefparameter=“menuId=1”;
jQuery.struts2_jQuery.bind(jQuery(“#anchor_2068827505”)、options_anchor_2068827505);
});
-
jQuery(文档).ready(函数(){
var options_anchor_1381525763={};
选项\u anchor\u 1381525763.jqueryaction=“anchor”;
选项\u anchor\u 1381525763.id=“anchor\u 1381525763”;
选项\u anchor\u 1381525763.targets=“resultContent”;
选项\u anchor\u 1381525763.href=“views/thankyou.jsp”;
选项\u anchor\u 1381525763.hrefparameter=“menuId=2”;
jQuery.struts2_jQuery.bind(jQuery('#anchor_1381525763'),options_anchor_1381525763);
});
在导航时播放音乐
您的浏览器不支持
音频元素。
使用动作标记和嵌套参数标记参见下面的代码
<s:url id="login" action="admin/showProfile" var="profileUrl">
<s:param name="user">Rais</s:param>
</s:url>
<a href='<s:property value="#profileUrl"/>'>
<s:property value="#profileUrl"/></a>
赖斯
你能发布生成的html代码吗?@MohanaRaoSV我已经发布了,请检查你在哪里看到这个url“HelloStruts2/#resultContent=\u sj\u action\u anchor\u 860825673resultContent”?它杂乱无章,并且没有生成我想要的url,我想要它有点像REST url。我希望它有一个干净的URL,那么问题是什么?您的url是否不包含参数,或者您只需要REST url?我正在通过ajax请求加载页面,如果我这样做了,它不会重新加载整个页面吗?
<s:url id="login" action="admin/showProfile" var="profileUrl">
<s:param name="user">Rais</s:param>
</s:url>
<a href='<s:property value="#profileUrl"/>'>
<s:property value="#profileUrl"/></a>