-
Notifications
You must be signed in to change notification settings - Fork 0
JavaEE_TagLib_en
رامي مناف edited this page Jun 20, 2019
·
1 revision
Sofof offers a library of the main commands which will help you when using sofof in a website. Before you start you should read about configuring and starting Sofof in your website and using the sofof.xml file to configure session and naming them.
To load the tag library it's enough to add this tag:
<%@taglib prefix="sofof" uri="http://sofof.org"%>When you write any tag or a group of tags you should surround them with the session tag. This tag should specify the session the commands will be executed on it. This tag has two ways to specify the session:
- passing all the connection configurations host, port, username, and password and the tag will start a new connection using that information
- passing the name of the session that you have configured in the sofof.xml file
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="sofof" uri="http://sofof.org"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<sofof:session name="main">
<sofof:bind object="<%="Hello JSP from Sofof!"%>"/>
<sofof:select clazz="<%=String.class%>" var="list"/>
</sofof:session>
<c:forEach items="${list}" var="obj">
<h3>${obj}</h3><br/>
</c:forEach>
</body>
</html>
<!-- result :
Hello JSP from Sofof!
-->