searchbyinitfactory.jsp

来自「jakarta-taglibs」· JSP 代码 · 共 51 行

JSP
51
字号
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<HTML>
<HEAD><TITLE>Search by Init Factory Context</TITLE></HEAD>
<BODY>
<%@ taglib uri="http://jakarta.apache.org/taglibs/jndi-1.0" prefix="jndi" %>

<jndi:useDirContext 
    id="test" 
    scope="page" 
    initialFactory='<%=request.getParameter("initfac")%>' 
    providerUrl='<%=request.getParameter("provider")%>'
/>


The Context is "<%=test.toString()%>"<BR/>
The filter was "<%=request.getParameter("filter")%>"<br>

<table border="true">
<th>name</th><th>class</th><th>objectclass</th>
  <jndi:search 
    countLimit='10'
    contextRef='test' 
    filter='<%=request.getParameter("filter")%>' 
    name='<%=request.getParameter("name")%>' 
    id="result"
    searchScope="SUBTREE_SCOPE"
    bindings='false'
  >
    <tr>
      <td><jsp:getProperty name="result" property="name" /></td>
      <td><jsp:getProperty name="result" property="className" /></td>
      <td><jndi:getAttribute ref='result' attribute='objectclass' multivalue='separator'><BR/></jndi:getAttribute></tf>
    </tr>
  </jndi:search>
</table>

First value of each attribute of last result:
<table border>
<th>attribute name</th><th>AttributeValue</TH>
<jndi:forEachAttribute ref='result' id='attr'>
  <jndi:getAttribute ref='attr' id='val' multivalue='iterate'>
    <tr>
      <td><jsp:getProperty name='attr' property='ID'/></td>
      <td><%=val%></td>
    </tr>
  </jndi:getAttribute>
</jndi:forEachAttribute>
</table>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?