2012-12-21 4 views
1

내가 만든 URL의 페이지에 매개 변수를 추가하고 있는데, 생성 된 URL에 매개 변수를 추가하는 이유는 무엇입니까?struts2의 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="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은 내가 URL에 추가 한 menuId 매개 변수가이

http://localhost:8090/HelloStruts2/#resultContent=_sj_action_anchor_860825673resultContent 

입니까?

이것이 차이를 가져올 지 모르겠지만이 플러그인을 jquery 용으로 사용하고 있습니다.

struts2-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> 
+0

생성 된 html 코드를 게시 할 수 있습니까? –

+0

@MohanaRaoSV 확인해주세요. – KyelJmD

+0

"HelloStruts2/# resultContent = _sj_action_anchor_860825673resultContent"라는 URL이 정확히 어디에 표시됩니까? –

답변

2

사용 액션 태그와 중첩 PARAM 태그를 사용하여 코드 아래를 참조하십시오.

<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> 
+0

아약스 요청을 통해 페이지를로드하고있다. 전체 페이지를 다시로드하지 않겠습니까? – KyelJmD

관련 문제