⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helponfocus.jsp

📁 jsf与JavaScript结合的范例。让你轻松学会网络编程。
💻 JSP
字号:
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib prefix="js" uri="/js.tld" %>

<f:view>
<html>
<head>
    <title>Search Form with Help</title>
    <script type="text/javascript"
        src="<%=request.getContextPath()%>/HelpOnFocus.js">
    </script>
</head>
<body>
    <h1>Search Form with Help</h1>
    <js:helpOnFocus>
        <h:form id="searchForm">
            <h:panelGrid columns="1" border="0" cellspacing="5">
                <h:panelGroup>
                    <h:outputLabel value="Text: " for="text"/>
                    <h:inputText id="text" value="#{searchBean.text}"
                            required="true" requiredMessage="Required" size="20">
                        <f:attribute name="helpOnFocus"
                            value="Enter the text you want to search for."/>
                    </h:inputText>
                    <h:message for="text"/>
                </h:panelGroup>
                <h:panelGroup>
                    <h:selectBooleanCheckbox id="matchCase"
                            value="#{searchBean.matchCase}">
                        <f:attribute name="helpOnFocus"
                            value="Distinguish between lowercase and uppercase
                                                                characters."/>
                    </h:selectBooleanCheckbox>
                    <h:outputLabel value="Match Case" for="matchCase"/>
                </h:panelGroup>
                <h:panelGroup>
                    <h:outputLabel value="Language: " for="language"/>
                    <h:selectOneMenu id="language" value="#{searchBean.language}">
                        <f:selectItem itemValue="English" itemLabel="English"/>
                        <f:selectItem itemValue="Spanish" itemLabel="Spanish"/>
                        <f:selectItem itemValue="French" itemLabel="French"/>
                        <f:attribute name="helpOnFocus"
                            value="Select the language of the searched text."/>
                    </h:selectOneMenu>
                </h:panelGroup>
                <h:commandButton id="search" value="Search"
                    action="#{searchBean.searchAction}"/>
                <f:verbatim>
                    <div id="helpOnFocus">
                    </div>
                </f:verbatim>
            </h:panelGrid>
        </h:form>
    </js:helpOnFocus>
</body>
</html>
</f:view>

⌨️ 快捷键说明

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