Web Extension

Web Extension - for web application development
Mirjana's picture

10. JSP pages - web application in action


  • Login page: 

Login page should appear as the first page of the web application.

You can log in with any valid SI user/password.

 


 

  • jsp1.jsp

 

JSP1 page has 2 text boxes.

Parameters that you will enter here, will not be used in background processing, just they will be used for demonstrating how they are taken into Process Data as well as Primary Document

 


 

  • If you enter XXX, and YYY values for these 2 fields, what you will get in Process Data and Primary Document (in SOMU_webapp_selectUser.bp), run in jsp2.jsp, is as follows:

 

Process Data:

 

<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
      <PrimaryDocument SCIObjectID="MIRJANA:node1:13575b0ed83:376678"/>
      <system-account-user-id>admin</system-account-user-id>
      <secondParam>YYY</secondParam>
      <firstParam>XXX</firstParam>
      <username>admin</username>
</ProcessData>
 

Primary Document:

 

<inputDocument>
      <firstParam>XXX</firstParam>
      <secondParam>YYY</secondParam>
</inputDocument>

 

  • In jsp2.jsp, you can find java code that is used to create strNvp and inputDocumentString, that are used for attribute values in runBP tag:

 

<sec:runBP user="<%=strUser%>" nvp="<%=strNvp%>" pridoc="<%=inputDocumentString%>" bpname="<%=strBP%>">               
                  <%
                  String strBPResults = XMLUtil.documentToString(bpResults, false);
                  org.dom4j.Document d = new org.dom4j.io.DOMReader().read(bpResults);
                  pageContext.setAttribute("org.apache.taglibs.xtags.taglib.Context", d);
                  %>               
</sec:runBP>

 

  • jsp2.jsp

 

jsp2.jsp will run SOMU_webapp_selectUsers business process that returns the list of all the users in SI system.

 


 

If you click on any user, you will get audit details, that means all admin activities for that user.

 

  • jsp3.jsp


Mirjana's picture

9. Http Server Adapter setting

You have to configure Http Server Adapter in order to run web application on SI

 

  • Go to Dasboard -> Deployment -> Services -> Configuration
  • Search for Http Server Adapter
  • In the option URI, click on 'add' and create a new URI with the name e.g. /SOMU_webApp
  • For ‘Launch BP Or WAR’, choose War File
  • For ‘WAR Config’, enter the full path to .war file (SOMU_webApp.war)

 

Once when all is done, you can run the web application by writing in the browser:

 

http://SI_IP:httpServerAdapter_port/SOMU_webApp

Mirjana's picture

8. BPs used in the web application


  • SOMU_webapp_selectUser.bp – run in jsp2.jsp

 

<process name="default">
      <sequence name="Sequence Start">
            <operation name="Lightweight JDBC Adapter">
                  <participant name="LightweightJDBCAdapterQuery"/>
                  <output message="LightweightJDBCAdapterTypeInputMessage">
                        <assign to="." from="*"/>
                        <assign to="pool">mysqlPool</assign>
                        <assign to="query_type">SELECT</assign>
                        <assign to="result_name">RESULT</assign>
                        <assign to="row_name">ROW</assign>
                        <assign to="sql">select yfs_user.USERNAME, yfs_user.BILLINGADDRESS_KEY, yfs_user.SESSION_TIMEOUT, yfs_person_info.FIRST_NAME, yfs_person_info.LAST_NAME, yfs_person_info.EMAILID, yfs_person_info.PERSON_INFO_KEY from yfs_user, yfs_person_info where yfs_user.BILLINGADDRESS_KEY = yfs_person_info.PERSON_INFO_KEY</assign>
                  </output>
                  <input message="inmsg">
                        <assign to="." from="*"/>
                  </input>
            </operation>
            <operation name="Business Process Response Service Type">
                  <participant name="BusinessProcessResponseService"/>
                  <output message="BusinessProcessResponseServiceTypeInputMessage">
                        <assign to="." from="*"/>
                  </output>
                  <input message="inmsg">
                        <assign to="." from="*"/>
                  </input>
            </operation>
      </sequence>
</process>

 

 

  • SOMU_webapp_selectUserAuditDetails.bp – run in jsp3.jsp

 
 

<process name="default">
      <sequence name="Sequence Start">
            <operation name="Lightweight JDBC Adapter">
                  <participant name="LightweightJDBCAdapterQuery"/>
                  <output message="LightweightJDBCAdapterTypeInputMessage">
                        <assign to="." from="*"/>
                        <assign to="param1" from="userParam/text()"/>
                        <assign to="paramtype1">String</assign>
                        <assign to="pool">mysqlPool</assign>
                        <assign to="query_type">SELECT</assign>
                        <assign to="result_name">RESULT</assign>
                        <assign to="row_name">ROW</assign>
                        <assign to="sql">select OBJECT_TYPE, OBJECT_NAME, ACTION_TYPE, ACTION_VALUE, TIME from admin_audit where PRINCIPAL = ?</assign>
                  </output>
                  <input message="inmsg">
                        <assign to="." from="*"/>
                  </input>
            </operation>
            <operation name="Business Process Response Service Type">
                  <participant name="BusinessProcessResponseService"/>
                  <output message="BusinessProcessResponseServiceTypeInputMessage">
                        <assign to="." from="*"/>
                  </output>
                  <input message="inmsg">
                        <assign to="." from="*"/>
                  </input>
            </operation>
      </sequence>
</process>
 
Mirjana's picture

7. Build web application – SOMU_webApp.war

    • 1st way - build.xml ant script, in eclipse, that will build a war file

 

<project name="ServiceSDK" default="dist" basedir=".">
      <property name="srcdir" value="../src" />
      <property name="application" value="SOMU_webApp" />
      <property name="version" value="1.0" />
      <property name="classpath" value="../WebContent/WEB-INF/lib" />
     
      <target name="compile">
           
            <echo message="Make dir ..."/>
            <mkdir dir="../WebContent/WEB-INF/classes"/>
 
            <echo message="Compile class ..."/>
            <javac classpath="${classpath}" srcdir="${srcdir}" destdir="../WebContent/WEB-INF/classes" />
           
      </target>
     
      <target name="dist" depends="compile">
            <echo message="Compile and package jar ..."/>
            <jar destfile="./${application}.war" basedir="../WebContent" />
      </target>
 
</project>

 

  • 2nd way - batch script that can build the war file

 

C:\path_to_root_folder_for_web_app\SOMU_webApp
 
set PATH=%PATH%;C:\j2sdk1.4.2_12\bin
 
jar cvf SOMU_webApp.war *

 

  • Move .war file to SI server

 

When .war file is created, you can copy it to SI server, at any place thatcan be accesible from SI installation

Mirjana's picture

6. web.xml - deployment descriptor file

<?xml version="1.0" encoding="UTF-8"?>
<web-app>
      <display-name>
      SOMU_webApp</display-name>
      <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>default.html</welcome-file>
            <welcome-file>default.htm</welcome-file>
            <welcome-file>default.jsp</welcome-file>
      </welcome-file-list>
      <error-page>
            <error-code>404</error-code>
            <location>/html/error404.html</location>
      </error-page>
      <error-page>
            <error-code>500</error-code>
            <location>/html/error500.html</location>
      </error-page>
      <taglib>
            <taglib-uri>http://www.stercomm.com/uix/security</taglib-uri>
            <taglib-location>tld/userautho.tld</taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/xtags-1.0</taglib-uri>
            <taglib-location>tld/taglibs-xtags.tld</taglib-location>
      </taglib>
</web-app>
 
Mirjana's picture

5. Error pages – in html folder

  • error404.html 

<HTML>
          <HEAD>
                   <TITLE>Test error 404 page</TITLE>
          </HEAD>
          <BODY class="MAINBODY" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
                   <TABLE width="100%" height="100%" border="0" cellPadding="0" cellSpacing="0" height="95%" valign="bottom">
                             <TBODY>
                                      <TR vAlign="top" height="95%">
                                                <TD align="left" bgcolor="#EEEEEE">
                                                          <ul>
                                                                   <font size="4" face="Arial, Helvetica, sans-serif">
                                                                             <br/>
                                                                             <br/>Nothing
          on this server matches the url you provided!<br/>
                                                                   </font>
                                                                   <br/>
                                                                   <br/>
                                                                   <br/>
                                                                   <br/>
                                                          </ul>
                                                </TD>
                                      </TR>
                             </TBODY>
                   </TABLE>
          </BODY>
</HTML>

 

 

 

  • error500.html

 

<HTML>
          <HEAD>
                   <TITLE>Test error 500 page</TITLE>
          </HEAD>
          <BODY class="MAINBODY" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
                   <TABLE width="100%" height="100%" border="0" cellPadding="0" cellSpacing="0" height="95%" valign="bottom">
                             <TBODY>
                                      <TR vAlign="top" height="95%">
                                                <TD align="left" bgcolor="#EEEEEE">
                                                          <ul>
                                                                   <font size="4" face="Arial, Helvetica, sans-serif">
                                                                             <br/>
                                                                             <br/>An internal error occurred!</font>
                                                                   <br/>
                                                                   <br/>
                                                                   <br/>
                                                                   <br/>
                                                                   <br/>
                                                          </ul>
                                                </TD>
                                      </TR>
                             </TBODY>
                   </TABLE>
          </BODY>
</HTML>

 

Mirjana's picture

4. JSP pages - code - in jsps folder

  • index.html
<html>
<script language="javascript">
      location.href='jsps/login.jsp';
</script>
<body/>
</html>
 
  • login.jsp
 
<html>
 
<%
      String _logoutusr = (String)session.getAttribute("username");
      if (_logoutusr != null) session.invalidate();
%>
<%
      String message = request.getParameter("message");
      if (message == null) message = "Please log in";
      String title = request.getParameter("title");
      if (title == null) title= "Please log in";
 
%>
<head>
<title>Login</title>
</head>
<body bgcolor="#EFEFEF" onLoad="document.frm.username.focus()">
<div align="center">
<img src="/SOMU_webApp/images/mickey-mouse.gif">
 
<form action='checkautho.jsp' method='post' name='frm'>
   <table>
            <tr>
                  <td align="center" colspan="2"><%=title%></td>
            </tr>
      <tr>
        <td align='right'>Username</td>
        <td><input type='text' name='username'></td>
      </tr>
      <tr>
        <td align='right'>Password</td>
        <td><input type='password' name='password'></td>
      </tr>
      <tr>
        <td align='center' colspan=2><input type='submit' value=Login></td>
      </tr>
      <tr>
        <td align='center' colspan=2><%=message%></td>
      </tr>
   </table>
</form>
<br><b></b>
</html>
 
 
  • checkautho.jsp
 
<%@page contentType="text/html"%>
 
<%@ page import="java.util.*"%>
<%@ page import="com.sterlingcommerce.woodstock.security.*" %>
 
<%@ taglib uri='http://www.stercomm.com/uix/security' prefix='sec' %>
<%
String strUser = request.getParameter("username");
String strPass = request.getParameter("password");
%>
<sec:authenticate user="<%=strUser%>" pass="<%=strPass%>" login="login.jsp?title=USERNAME/PASSWORD INCORRECT!!!" />
<%
User u = (User) session.getAttribute("user");
int intTimeOut = u.getTimeout();
session.setAttribute("timeout", String.valueOf(intTimeOut));
session.setMaxInactiveInterval(intTimeOut);
session.setAttribute("username", strUser);
session.setAttribute("fullName", u.getFullName());
session.setAttribute("token", u.getUserToken());
%>
<jsp:forward page='jsp1.jsp'/>
 
<html>
<body>
 
</body>
</html>
 
  • jsp1.jsp

 

<%@page contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1"%>
<%@page import="java.util.*,java.text.*"%>
<%@page import="org.w3c.dom.Document"%>
<%@page import="com.sterlingcommerce.woodstock.util.xml.XMLUtil"%>
<%@page import="com.sterlingcommerce.woodstock.security.*"%>
<%@page import="com.sterlingcommerce.woodstock.security.util.*"%>
<%@taglib uri="http://www.stercomm.com/uix/security" prefix="sec"%>
<%@taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags"%>
 
<sec:validSession login="login.jsp?message=Session expired. Please log in again"/>
 
<%
                 
      SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
      String currentDate = formatter.format(new Date());   
 
%>         
           
<html>
<head>
      <title>JSP1</title>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>   
</head>
<body bgcolor="#EFEFEF">
<form id="testForm" name="testForm" method="post">
 
<br/>
<br/>
<table>
      <tr>
            <td>Enter the first parameter:</td>
            <td><input type='text' name='firstParam'></td>
      </tr>
      <tr>
            <td>Enter the second parameter:</td>
            <td><input type='text' name='secondParam'></td>
      </tr>
      <tr>
            <td colspan="2"><input type="submit" name="submit" value="Submit" onClick="document.testForm.action='jsp2.jsp'; document.testForm.submit();"/></td>
      </tr>
</table>
</form>
</body>
</html>
 
  • jsp2.jsp

 

<%@page contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1"%>
<%@page import="java.util.*,java.text.*"%>
<%@page import="org.w3c.dom.Document"%>
<%@ page import="org.dom4j.*" %>
 
<%@page import="com.sterlingcommerce.woodstock.util.xml.XMLUtil"%>
<%@page import="com.sterlingcommerce.woodstock.security.*"%>
<%@page import="com.sterlingcommerce.woodstock.security.util.*"%>
<%@taglib uri="http://www.stercomm.com/uix/security" prefix="sec"%>
<%@taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags"%>
 
<sec:validSession login="login.jsp?message=Session expired. Please log in again"/>
 
<%
 
      // taking username from the session
 
      String strUser = (String)session.getAttribute("username");
 
      // taking request params from jsp1.jsp
     
      String firstParam = request.getParameter("firstParam");
      String secondParam = request.getParameter("secondParam");
     
      // creating name value pair for sending params in Process Data
     
      StringBuffer stringBufferForPD = new StringBuffer();
     
      stringBufferForPD.append("firstParam=");
      stringBufferForPD.append(firstParam);
      stringBufferForPD.append("&");
      stringBufferForPD.append("secondParam=");
      stringBufferForPD.append(secondParam);
   
      String strNvp = stringBufferForPD.toString();
     
      // creating XML for Primary Document
     
      StringBuffer stringBufferForPrimaryDocument = new StringBuffer();
     
      stringBufferForPrimaryDocument.append("<inputDocument>\n");
     
      stringBufferForPrimaryDocument.append("<firstParam>");
      stringBufferForPrimaryDocument.append(firstParam);
      stringBufferForPrimaryDocument.append("</firstParam>\n");
 
      stringBufferForPrimaryDocument.append("<secondParam>");
      stringBufferForPrimaryDocument.append(request.getParameter("secondParam"));
      stringBufferForPrimaryDocument.append("</secondParam>\n");
           
      stringBufferForPrimaryDocument.append("</inputDocument>\n");
           
      String inputDocumentString = stringBufferForPrimaryDocument.toString();
     
      // define BP that will be run in SI system, when submitting this form
     
      String strBP = "SOMU_webapp_selectUsers";            
     
 
%>         
      <sec:autho permission="<%=strBP%>" checkExistence="true">        
            <sec:runBP user="<%=strUser%>" nvp="<%=strNvp%>" pridoc="<%=inputDocumentString%>" bpname="<%=strBP%>">                 
                  <%
                  String strBPResults = XMLUtil.documentToString(bpResults, false);
                  org.dom4j.Document d = new org.dom4j.io.DOMReader().read(bpResults);
                  pageContext.setAttribute("org.apache.taglibs.xtags.taglib.Context", d);
                  %>               
            </sec:runBP>                       
      </sec:autho>           
 
<html>
<head>
      <title>JSP2</title>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>   
</head>
<body bgcolor="#EFEFEF">
<form id="testForm" name="testForm" method="post">
<hr/>
List of users from Sterling Integrator:
<hr/>
<br/>
<br/>
<table border="1">
      <tr>
            <th>User ID</th>
            <th>First name</th>
            <th>Last name</th>
            <th>Email</th>
            <th>Session timeout</th>
            <th>Person info key</th>
      </tr>
      <xtags:forEach select="//RESULT/ROW">
            <tr>
                  <td><a href="jsp3.jsp?userParam=<xtags:valueOf select="USERNAME/text()"/>"><xtags:valueOf select="USERNAME/text()"/></a></td>
                  <td><xtags:valueOf select="FIRST_NAME/text()"/></td>
                  <td><xtags:valueOf select="LAST_NAME/text()"/></td>
                  <td><xtags:valueOf select="EMAILID/text()"/></td>
                  <td><xtags:valueOf select="SESSION_TIMEOUT/text()"/></td>
                  <td><xtags:valueOf select="PERSON_INFO_KEY/text()"/></td>
            </tr>
      </xtags:forEach>
</table>
 
<br/>
 
</body>
</html>
 
  • jsp3.jsp
 
<%@page contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1"%>
<%@page import="java.util.*,java.text.*"%>
<%@page import="org.w3c.dom.Document"%>
<%@ page import="org.dom4j.*" %>
<%@page import="com.sterlingcommerce.woodstock.util.xml.XMLUtil"%>
<%@page import="com.sterlingcommerce.woodstock.security.*"%>
<%@page import="com.sterlingcommerce.woodstock.security.util.*"%>
<%@taglib uri="http://www.stercomm.com/uix/security" prefix="sec"%>
<%@taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags"%>
 
<sec:validSession login="login.jsp?message=Session expired. Please log in again"/>
 
<%
      //taking username from the session
     
      String strUser = (String) session.getAttribute("username");
 
      //BP name that will be run
 
      String strBP = "SOMU_webapp_selectUserAuditDetails";             
     
      //taking userParam from request
     
      String userParam = request.getParameter("userParam");
     
      //defining userParam for nvp, will be set in the Process Data
     
      String nvp = "userParam=" + userParam;
     
%>         
      <sec:autho permission="<%=strBP%>" checkExistence="true">        
            <sec:runBP user="<%=strUser%>" nvp="<%=nvp%>" pridoc="" bpname="<%=strBP%>">             
                  <%
                  String strBPResults = XMLUtil.documentToString(bpResults, false);
                  org.dom4j.Document d = new org.dom4j.io.DOMReader().read(bpResults);
                  pageContext.setAttribute("org.apache.taglibs.xtags.taglib.Context", d);
                  %>               
            </sec:runBP>                       
      </sec:autho>           
 
<html>
<head>
      <title>JSP3</title>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>   
</head>
<body bgcolor="#EFEFEF">
<form id="testForm" name="testForm" method="post">
<hr/>
<table>
      <tr>
            <td>Audit details for the user <i style="color:red;"><%=userParam%></i></td>
            <td><input type="submit" name="submit" value="Back - list of users" onClick="document.testForm.action='jsp2.jsp'; document.testForm.submit();"/>
            <td><input type="submit" name="submit" value="First page" onClick="document.testForm.action='jsp1.jsp'; document.testForm.submit();"/></td>
      </tr>
</table>
<hr/>
<br/>
<br/>
 
<table>
      <tr>
            <th align="left">Object type</th>
            <th align="left">Object name</th>
            <th align="left">Action type</th>
            <th align="left">Action value</th>
            <th align="left">Time of changes</th>
      </tr>
      <xtags:forEach select="//RESULT/ROW">
      <tr>
            <td><b><xtags:valueOf select="OBJECT_TYPE/text()"/></b></td>
            <td><input type="text" name="firstName" size="32" readonly="readonly" value=<xtags:valueOf select="OBJECT_NAME/text()"/>></td>
            <td><input type="text" name="lastName" size="32" readonly="readonly" value=<xtags:valueOf select="ACTION_TYPE/text()"/>></td>
            <td><input type="text" name="email" size="32" readonly="readonly" value=<xtags:valueOf select="ACTION_VALUE/text()"/>></td>
            <td><input type="text" name="address" size="32" readonly="readonly" value=<xtags:valueOf select="TIME/text()"/>></td>
      </tr>
      </xtags:forEach>
           
</table>
 
 
</form>
</body>
</html>
Mirjana's picture

3. Web application structure in Eclipse

After configuring all tag libraries, you should add 3 external java packages in order to resolve all possible build paths problems.

 They are:

  • Studio-API.jar
  • platform_library.jar

 

Both jars mentioned above could be found in install SI folder (SI_install\mesa\studio), and some other places, but better to use both from

\plugins\com.sterlingcommerce.mesa.servicesdk_3207.0.0\lib\3000 that you can see in your eclipse workspace after putting plugin for MESA Developer Studio from SI

 

You can see they are not of the same size.

 

 

Note: I do not know why we cannot find full size jars in SI installation folder, but just when they are taken into eclipe during installing MESA plug in into eclipse.

  •  dom4j.jar

 dom4j.jar should be used because document from BP should be loaded as org.dom4j.Document in order to be parsed by XTags. Can be found in installDir/SI/jar/dom4j/1_5_2 folder

Mirjana's picture

2. Base file system structure for web application

Here is the structure of the folders for a web application:

 

SOMU_webApp (folder)

css              (folder)

html             (folder)

images         (folder)

jsps             (folder)

                    index.html

                   ...

WEB-INF      (folder)

                    tld      (folder)

                   web.xml

 

... tld files has to be placed into tld folder

 

There are 2 files we have to have for SI web app development.

In the same time we have to have 2 corresponding packages (jars) containing classes used for creating tag libraries:

 

You can find paths for both tld files that are used in the test web application.

 

.tld/.jar

Description

Folder

userautho.tld

userautho.jar

contains tags for connection/authentication/validation at SI

installDir/jar/gis/4.3/gis.jar

install/container/Applications/helloworld/WEB-INF/tld

taglibs-xtags.tld

taglibs-xtags.jar

contains tags for presentation part in the forms (similar to XSLT)

installDir/SI/jar/xtags/1_0/taglibs-xtags.jar

/install/container/Applications/dashboard/WEB-INF/templates/jsp/tld

 

 

Mirjana's picture

1. TAGS - describe, specify, declare and use in this web app

To define a tag, you need to:

  • Develop a tag handler and helper classes for the tag (we will use 2 tag libraries already developed, one by IBM/Sterling Commerce, i.e. userautho and Apache one i.e. taglibs-xtags). In a table below, you can see where you can find them and load into your project, either in file system or in eclipse.
  • Describe the tag in a tag library descriptor, tld file.
  • Specify tags in web.xml descriptor file
  • Declare the tag in web page where it is used

 

Describe the tag – .tld files in WEB-INF/tld

Descibe the tag in a tag library descriptor file (WEB-INF/tld/userautho.tld).

It is just an example of tld file, for this test web application, you can take userautho.tld and taglibs-xtags.tld from SI installation system and bundle them into your final war file. Paths for the tld files are given in a table below.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"   "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">

<taglib>

      <tlib-version>1.0</tlib-version>

      <jsp-version>1.2</jsp-version>

      <short-name>security</short-name>

      <uri>http://www.stercomm.com/uix/security</uri>

      <display-name>Security</display-name>

      <description>    This tag library contains functionality specific to the    User Authentication and Authorization   </description>

      <tag>

            <name>autho</name>

            <tag-class>

com.sterlingcommerce.woodstock.uix.taglib.common.security.AuthorizeUserAction

</tag-class>

………

<tag>

            <name>validSession</name>

            <tag-class>com.sterlingcommerce.woodstock.uix.taglib.common.security.ValidateSession</tag-class>

            <body-content>empty</body-content>

            <description>             Performs user session validation        if fails, then attempts to forward to login/error page         </description>

            <attribute>

                  <name>login</name>

                  <required>true</required>

                  <rtexprvalue>true</rtexprvalue>

                  <description>relative page url to which user should be forwarded in case of session being invalid/expired failure</description>

            </attribute>

      </tag>

</taglib>

 

Specify the tag – in web.xml

 

Specify the location of your JSP tag library in your Web application’s WEB-INF/web.xml file. Type the following code between the <web-app> and </web-app> tags:

 ….

<taglib>

      <taglib-uri>http://www.stercomm.com/uix/security</taglib-uri>

      <taglib-location>tld/userautho.tld</taglib-location>

</taglib>

<taglib>

      <taglib-uri>http://jakarta.apache.org/taglibs/xtags-1.0</taglib-uri>

      <taglib-location>tld/taglibs-xtags.tld</taglib-location>

</taglib>

 

Declare the tag – in .jsp page

You declare that a JSP page will use tags defined in a tag library by including a taglib directive in the page before any custom tag is used:


<%@ taglib uri=" http://www.stercomm.com/uix/security" prefix="sec" %>

The uri attribute refers to a URI that uniquely identifies the tag library. This URI can be relative or absolute. If it is relative it must be mapped to an absolute location in the taglib element of a Web application deployment descriptor, the configuration file associated with Web applications developed according to the Java Servlet and JavaServer Pages specifications. The prefix attribute defines the prefix that distinguishes tags provided by a given tag library from those provided by other tag libraries.

 

Usage of tags  – in .jsp page

<sec:validSession login="login.jsp?message=Session expired. Please log in again"/>

 

Syndicate content