Home > Domino Tips > Administrator > Web > Parsing URL parameters with a simple class
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

WEB

Parsing URL parameters with a simple class


Walter Traspadini
05.16.2001
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


This is a simple class with some methods very useful that allow parsing the URL parameters in many web agents.

Code

This is a simple class with some methods very useful that allow parsing the URL parameters in many web agents. Class ParseUrl

    Private URL As String
    Private Params List As String
    Private Names As Variant
    Private Values As Variant

    Sub New( sQuery As String)

    If( sQuery = "") Then
        URL = "NULL"
    Else
            URL = sQuery
        Names = Evaluate("@Word(@Explode(@Right(""" & URL & """; ""&""); ""&""); ""=""; 1)")
            Values = Evaluate("@Word(@Explode(@Right(""" & URL & """; ""&""); ""&""); ""=""; 2)")

            Dim i As Integer
            i=0
            Forall v In Names
                Params( v ) = Values(i)
                i = i+1
            End Forall
        End If
    End Sub

    Function getParameter( sParName As String) As String
        Dim value As String

        If Iselement( Params( sParName ) ) = True Then
            value = Params( sParName )
            If value = "" Then
                getParameter = "NULL"
            Else
                getParameter = value
            End If
        Else
            getParameter = "NULL"
        End If

    End Function
End Class

Example:

Notes Agent

(Option)

Use "ClassUrlParameter"

Sub Initialize

Dim session as New NotesSession
Dim docCont as NotesDocument

Set docCont = session.DocumentContext

Dim urlParameters As New ParseUrl( docCont.Query_String(0))

Dim sValue As String
sValue = urlParameters.getParameter( "" )

..........
' <Put here your script >
.........
.........

end Sub

If your Query_String is something like this
"OpenFrom&Cod=10&Tit=Pippo" sValue will be equal to "10".

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Web
Display SharePoint data in a Lotus Notes Web application with Ajax
Top 10 Lotus Notes/Domino administration tips of 2008
How to create a dynamic SVG graph using a Lotus Notes agent
Hosting multiple Lotus Domino servers at one IP address without a VPN
Upgrading and patching Firefox: Security considerations for administrators
Admin2005 Learning Guides
Making old, new flavors of Domino SSO work
A fun site, with serious code
Creating corporate welcome pages with Lotus Notes
Domino Web traffic analyzers

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts