liferay namespace用法

在Jsp页面代码如下: 


<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

<portlet:defineObjects />

This is the <b>Namespace</b> portlet in View mode.

<form name="userInfoForm">
      username : <input id= "<portlet:namespace/>username" name="<portlet:namespace/>usernameusername"  type="text" > </br>
      <input type="button" onclick="<portlet:namespace/>submit()" value="submit">
     
</form>

<script>
     function  <portlet:namespace/>submit(){
    	  var  username = document.getElementById("<portlet:namespace/>username").value
    	 alert("username = " + username);
     }

</script>


对应页面如

liferay namespace用法_第1张图片


采用namespace (见上面代码) 后,当点击 Namespace portlet的submit能得到相应的username值(见上面图片),比如username = 9/8/


你可能感兴趣的:(liferay namespace用法)