Vector in URL

I am trying to loop through a vector with a few names and use the names as urls in my .jsp using this code:
<%@ page import="java.util.*" %>
<%Vector myVector= new Vector();%>
<%String [] firstNames ={"jack","jill","fred","ted"};%>
<%for (int xx=1;xx<firstNames.length; xx++){myVector.add(firstNames[xx]);}%>
<%for (int x=1; x<myVector.size(); x++){%><A HREF=http://localhost:8080/examples/jsp/learningJSP/Attendance.jsp?student=(String)myVector.get(x)><%=(String)myVector.get(x)%> </A><%}%>
Please note my code does not include the ; before </A><%}%> -- the forum is putting that there. Please ignore it as I can not get rid of it in my post. Odd, but true.
I think the problem is in the syntax in my second for loop as I get the following error:
Undefined variable: x
out.print((String)myVector.get(x));
^
It appears that my intstantiating the x in the for loop is lost when I use the <%%>'s.
I would greatly appreciate a simple syntax example to get the for loop working together with the url.
Thanks,
Scott

Thanks for the advice. I cleaned up the <%%>'s and this worked:
<%@ page import="java.util.*" %>
<%Vector myVector= new Vector();
String [] firstNames ={"jack","jill","fred","ted"};
for (int xx=1;xx<firstNames.length; xx++){myVector.add(firstNames[xx]);}
for (int x=1; x<myVector.size(); x++){
%>
<%=(String)myVector.get(x)%>
<%}%>
Note: again the ';' before </A> is not in my actual code.

Similar Messages

  • Sending a vector to a servlet

    i want to send a vector to a servlet via an applet. i think i have done this properly.
    but i then want to write the information in this vector to a file and i'm wondering why its not working
    i've read postings about how if everything i store in it implements Serializable, i can just serialize it to file.
    i don't completely understand how to do this.
    i'm putting strings into the vector before i send it to the servlet....will this cause a problem?
    are strings serializable?
    thanks
    Andy

    i'm not getting an error, but it appears like the POST isn't working...i think there must be something wrong with how i try to call the servlet
    i think it might have something to do with my setRequestProperty...
    here's my code....
    /************applet************/
    public void sendVector(Vector sendingVector)
    URL baseURL = getCodeBase();
    String protocol = baseURL.getProtocol();
    String host = baseURL.getHost();
    int port = 808;
    try
    String urlSuffix = "/servlet/contactlist.WriteToServlet";
    URL servletURL = new URL(protocol, host, port, urlSuffix);
    URLConnection conn = servletURL.openConnection();
    // inform the connection that we will send output and accept input
    conn.setDoInput(true);
    conn.setDoOutput(true);
    // Don't use a cached version of URL connection.
    conn.setUseCaches (false);
    conn.setDefaultUseCaches (false);
    // Specify the content type that we will send binary data
    conn.setRequestProperty ("Content-Type", "application/octet-stream");
    // send the student object to the servlet using serialization
    ObjectOutputStream outputToServlet = new ObjectOutputStream(conn.getOutputStream());
    // serialize the object
    outputToServlet.writeObject( sendingVector );
    outputToServlet.flush();
    outputToServlet.close();
    } catch (IOException io) { io.printStackTrace(); }
    } // end sendVector
    /*********servlet*************/
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    try
    // get an input stream from the applet
    ObjectInputStream inputFromApplet = new ObjectInputStream(request.getInputStream());
    // read the serialized student data from applet
    Vector passInfo = (Vector)inputFromApplet.readObject();
    inputFromApplet.close();
    for(int i =0; i < passInfo.size(); i++) System.out.println(passInfo.get(i));
    // make this so that the vector filename has no spaces
    FileWriter writer = new FileWriter("G:\\Intranet\\wwwroot\\Contact\\contactlist\\Departments\\" + getFileTitle(passInfo.get(1).toString()) + ".htm");
    // prints information to the file
    int a;
    for(a = 0; a < (passInfo.size()-1); a++)
    {  writer.write(passInfo.get(a) + "\n");
    writer.write(passInfo.get(a).toString());
    writer.flush();
    writer.close();
    catch(Exception e) { e.printStackTrace(); }
    public void doPut(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    doGet(request, response);
    } // end doPut

  • Calling New Function Module from JAVA ISA b2b

    I need to call a new function module which accepts some parameters as input and
    returns some result parameters back as output.
    These returned value needs to be displayed on the JSP pages of ISA B2B applications.
    Can someone please guide me and provide code snippet on how to do this?
    Thanks in advance.
    Points will be awarded for all relevant and helpful answers.

    Stride,
    I did this on CRM ISA 4.0...  I used the dev and extension guide as a basis - I think the ISA 5.0 guide has the examples and tutorials in a separate document that can also be downloaded from service.sap.com.
    Here’s some info on how to do it although I can't guarantee this is the full solution or that it will work the same for ISA 5.0, and I will probably forget a lot of stuff as its been a few years since I did it!  I also can’t guarantee it is the correct way to do it – but it worked!  Basically, we built a link into the order overview page to display url’s to order tracking websites using an RFC on the backend CRM system.  Hope it helps anyway.
    1. Create RFC enabled function module in backend.
    2. Edit file backendobject-config.xml in folder project_root\b2b_z\WEB-INF\xcm\customer\modification:-
    [code] <backendobject
         xmlns:isa="com.sapmarkets.isa.core.config"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xml="http://www.w3.org/XML/1998/namespace">
         <configs>
              <!-- customer changes in backendobject-config should be done here by extending/overwriting the base configuration-->
              <xi:include
                   href="$
    Template for backend object in customer projects
    Concrete implementation of a backend object
    This implemenation demonstrates how a backend object
    is used to communicate with the CRM system
    @see com.ao.isa.backend.boi.Z_AOFuncBackend#getOrderDeliveryTrackingData(java.lang.String)
    Interface used to communicate with a backend object
    The purpose of this interface is to hide backend implementation details
    from the business objects
    Returns a vector of Z_OrderDeliverTracking objects containing data to link
    to external delivery tracking websites
    @param orderNo The sales order document number
    @return A vector of order tracking objects
    @return
    @return
    @return
    @return
    @return
    @param string
    @param string
    @param string
    @param string
    @param string
    /modification/backendobject-config.xml#xpointer(backendobject/configs/*)"/>
              <!-- This is an example customer extension. A new Backend Object is registered in the framework using XCM extension mechanism. -->
              <!-- If you write customer extensions you should register your backend objects in the same way. -->
              <!-- Please make sure that you use the correct base configuration (e.g. crmdefault for CRM or r3default, r3pidefault for R/3) -->
              <config
                   isa:extends="../config[@id='crmdefault']">
                   <businessObject
                        type="Z_AO_Custom"
                        name="Z_AO_Custom"
                        className="com.ao.isa.backend.crm.Z_AOFuncCRM"
                        connectionFactoryName="JCO"
                        defaultConnectionName="ISAStateless"/>
              </config>
         </configs>
    </backendobject>
    [/code]
    File com.ao.isa.backend.crm.Z_AOFuncCRM.java looks like this :-
    [code] package com.ao.isa.backend.crm;
    //jco imports
    import java.util.Vector;
    import com.ao.isa.backend.boi.Z_AOFuncBackend;
    import com.ao.isa.businessobject.order.Z_OrderDeliveryTrackingItem;
    import com.sap.mw.jco.JCO;
    import com.sap.mw.jco.JCO.ParameterList;
    import com.sapmarkets.isa.core.eai.BackendException;
    import com.sapmarkets.isa.core.eai.sp.jco.BackendBusinessObjectBaseSAP;
    import com.sapmarkets.isa.core.logging.IsaLocation;
    public class Z_AOFuncCRM
         extends BackendBusinessObjectBaseSAP
         implements Z_AOFuncBackend
         // initialize logging
         private static IsaLocation log =
              IsaLocation.getInstance(Z_AOFuncCRM.class.getName());
         /* (non-Javadoc)
         public Vector getOrderDeliveryTrackingData(String orderNo)
              Vector urlData = new Vector();
              try
                   // get Java representation of function module
                   JCO.Function func =
                        getDefaultJCoConnection().getJCoFunction(
                             "Z_BAPI_CRM_ORDER_TRACKING_URLS");
                   // provide export parameters
                   ParameterList params = func.getImportParameterList();
                   params.setValue(orderNo, "ORDER_NO");
                   func.setExportParameterList(params);
                   // execute function
                   getDefaultJCoConnection().execute(func);
                   // get result table
                   JCO.Table table =
                        func.getTableParameterList().getTable("TRACKING_DATA");
                   int numRows = table.getNumRows();
                   for (int i = 0; i < numRows; i++)
                        // get row
                        table.setRow(i);
                        // create a new Z_orderdeliverytracking object
                        Z_OrderDeliveryTrackingItem trackItem =
                             new Z_OrderDeliveryTrackingItem(
                                  table.getString(0),
                                  table.getString(1),
                                  table.getString(2),
                                  table.getString(3),
                                  table.getString(4));
                        urlData.addElement(trackItem);
                        trackItem = new Z_OrderDeliveryTrackingItem();
                   return urlData;
              catch (BackendException bex)
                   // The following key has to be added to WEB-INF/classes/ISAResources.properties
                   // in order to see the exception correctly
                   log.config("ao.b2b.order.error.getOrderTrackingURLs", bex);
              return null;
    [/code]
    And file com.ao.isa.backend.boi.Z_AOFuncBackend.java looks like this:-
    [code] package com.ao.isa.backend.boi;
    //package java.ao.com.ao.isa.backend.boi;
    import java.util.Vector;
    import com.sapmarkets.isa.core.eai.sp.jco.JCoConnectionEventListener;
    public interface Z_AOFuncBackend
         public Vector getOrderDeliveryTrackingData(String orderNo);
    [/code]
    Whilst file com.ao.isa.businessobject.order.Z_OrderDeliveryTrackingItem.java looks like this:-
    [code]
    package com.ao.isa.businessobject.order;
    // Referenced classes of package com.sapmarkets.isa.businessobject.order:
    //            PaymentType
    public class Z_OrderDeliveryTrackingItem // extends SalesDocument implements OrderData
         private String deliveryDocNo;
         private String goodsIssuedDate;
         private String consignmentNo;
         private String status;
         private String url;
         public Z_OrderDeliveryTrackingItem()
         public Z_OrderDeliveryTrackingItem(
              String delDocNo,
              String GIDate,
              String consNo,
              String status,
              String url)
              this.setDeliveryDocNo(delDocNo);
              this.setGoodsIssuedDate(GIDate);
              this.setConsignmentNo(consNo);
              this.setStatus(status);
              this.setUrl(url);
         public String getConsignmentNo()
              return consignmentNo;
         public String getDeliveryDocNo()
              return deliveryDocNo;
         public String getGoodsIssuedDate()
              return goodsIssuedDate;
         public String getStatus()
              return status;
         public String getUrl()
              return url;
         public void setConsignmentNo(String string)
              consignmentNo = string;
         public void setDeliveryDocNo(String string)
              deliveryDocNo = string;
         public void setGoodsIssuedDate(String string)
              goodsIssuedDate = string;
         public void setStatus(String string)
              status = string;
         public void setUrl(String string)
              url = string;
    [/code]
    3. Edit file bom-config.xml in folder project_root\b2b_z\WEB-INF\xcm\customer\modification :-
    [code] <BusinessObjectManagers
         xmlns:isa="com.sapmarkets.isa.core.config"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xml="http://www.w3.org/XML/1998/namespace">
         <!-- customer changes in bom-config should be done here by extending/overwriting the base configuration-->
         <xi:include
              href="$/modification/bom-config.xml#xpointer(BusinessObjectManagers/*)"/>
         <!-- This is an example Business Object Manager. It can act as template for customer written Business Object Managers -->
         <BusinessObjectManager
              name="Z_AO-BOM"
              className="com.ao.isa.businessobject.Z_AOBusinessObjectManager"
              />
    </BusinessObjectManagers>
    [/code]
    File com.ao.isa.businessobject.Z_AOBusinessObjectManager.java looks like this:-
    [code] package com.ao.isa.businessobject;
    // Internet Sales imports
    import com.sapmarkets.isa.core.businessobject.management.BOManager;
    import com.sapmarkets.isa.core.businessobject.management.DefaultBusinessObjectManager;
    import com.sapmarkets.isa.core.businessobject.BackendAware;
    Template for a custom BusinessObjectManager in customer projects
    public class Z_AOBusinessObjectManager
         extends DefaultBusinessObjectManager
         implements BOManager, BackendAware {
         // key used for the backend object in customer version of backendobject-config.xml
         public static final String CUSTOM_BOM = "Z_AO-BOM";
         // reference to backend object
         private Z_AOFunc mCustomBasket;
    constructor
         public Z_AOBusinessObjectManager() {
    Method is called by the framework before the session is invalidated.
    The implemenation of this method should free any allocated resources
         public void release() {
    Returns custom business object
         public Z_AOFunc getCustomBasket() {
              if (mCustomBasket == null) {
                   mCustomBasket = new Z_AOFunc();
                   assignBackendObjectManager(mCustomBasket);
              return mCustomBasket;
    [/code]
    And uses file com.ao.isa.businessobject.Z_AOFunc.java which looks like this:-
    [code]
    package com.ao.isa.businessobject;
    // Internet Sales imports
    import com.sapmarkets.isa.core.businessobject.BOBase;
    import com.sapmarkets.isa.core.businessobject.BackendAware;
    import com.sapmarkets.isa.core.eai.BackendObjectManager;
    import com.sapmarkets.isa.core.eai.BackendException;
    import com.sapmarkets.isa.core.logging.IsaLocation;
    // custom imports
    import com.ao.isa.backend.boi.Z_AOFuncBackend;
    import java.util.Vector;
    Template for business object in customer projects
    public class Z_AOFunc extends BOBase implements BackendAware
         // initialize logging
         private static IsaLocation log =
              IsaLocation.getInstance(Z_AOFunc.class.getName());
         private BackendObjectManager bem;
         private Z_AOFuncBackend backendAOBasket;
    Returns a reference to the backend object. The backend object
    is instantiated by the framework.
    @return a reference to the backend object
         private Z_AOFuncBackend getCustomBasketBackend()
              if (backendAOBasket == null)
                   //create new backend object
                   try
                        backendAOBasket =
                             (Z_AOFuncBackend) bem.createBackendBusinessObject(
                                  "Z_AO_Custom");
                        // the backend object is registered in customer version
                        // of backendobject-config.xml using the 'Z_AO_Custom' type
                   catch (BackendException bex)
                        // The following key has to be added to WEB-INF/classes/ISAResources.properties
                        // in order to see the exception correctly
                        log.config("ao.b2b.order.error.getOrderTrackingURLs", bex);
              return backendAOBasket;
    This method is needed when a business object has a corresponding
    backend object.
         public void setBackendObjectManager(BackendObjectManager bem)
              this.bem = bem;
    Returns a vector of url links for tracking
    @return vector of urls
         public Vector getOrderDeliveryTrackingData(String orderNo)
              // the call is delegated to the CRM aware backend object
              return getCustomBasketBackend().getOrderDeliveryTrackingData(orderNo);
    [/code]
    4. Edit file config.xml in folder project_root\b2b_z\WEB-INF to add custom actions (the section below is just the custom stuff added at the end of the file – the Z_orderTracking is the relevant one) :-
    [code] <!-- Begin of custom AO action definitions -->
         <action path="/b2b/Z_orderTracking" type="com.ao.isa.order.actions.Z_OrderTrackingAction">
              <forward name="success" path="/b2b/order/Z_orderTracking.jsp"/>
         </action>
         <action path="/catalog/Z_displaySVGPage" type="com.ao.isa.catalog.actions.Z_SVGPageAction">
              <forward name="success" path="/catalog/Z_SVG_fs.jsp"/>
         </action> [/code]
    Which points at Java file com.ao.isa.order.actions.Z_OrderTrackingAction.java which looks like this :-
    [code] package com.ao.isa.order.actions;
    // internet sales imports
    import com.sapmarkets.isa.core.BaseAction;
    import com.sapmarkets.isa.core.UserSessionData;
    // struts imports
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionForm;
    // servlet imports
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletException;
    // Internet Sales imports
    import com.ao.isa.businessobject.Z_AOBusinessObjectManager;
    import java.util.Vector;
    This action acts as a template for customer extensions
    public class Z_OrderTrackingAction extends BaseAction
    This method is called by the ISA Framework when the
    action is executed
         public ActionForward doPerform(
              ActionMapping mapping,
              ActionForm form,
              HttpServletRequest request,
              HttpServletResponse response)
              throws ServletException
              // get user session data object
              UserSessionData userSessionData =
                   UserSessionData.getUserSessionData(request.getSession());
              // gettting custom BOM
              Z_AOBusinessObjectManager myBOM =
                   (Z_AOBusinessObjectManager) userSessionData.getBOM(
                        Z_AOBusinessObjectManager.CUSTOM_BOM);
              // get the order number being processed
              String orderDocNumber = request.getParameter("orderNo");
              // pass the order number back to the page
              request.setAttribute("orderNo", orderDocNumber);
              if (orderDocNumber != null)
                   // Get a vector of delivery tracking objects from lower layers (Business Object layer =>
                   // Business Logic Service Layer)
                   Vector trackingTable =
                        myBOM.getCustomBasket().getOrderDeliveryTrackingData(
                             orderDocNumber);
                   String error = "";
                   if (trackingTable != null)
                        if (trackingTable.size() == 0)
                             error = "true";
                        else
                             error = "false";
                   else
                        error = "true";
                   request.setAttribute("errorMessage", error);
                   request.setAttribute("trackingTable", trackingTable);
              return mapping.findForward("success");
    [/code]
    5. I added the call to the function module for page orderstatusdetail.jsp in folder project_root\b2b_z\b2b\order to display a custom page Z_orderTracking.jsp in the same folder.  To do this I added a link into the HTML to call a JavaScript function that passed the current order number to the /b2b/Z_orderTracking.do actionhandler mapped in the config.xml file.
    So, in summary!  Create an RFC; define business managers for it in the XML files; create a new Strut action and supporting Java class; create all the Java class’ for the managers.
    I hope this makes some sense!
    Gareth.

  • [Trend Micro Ios content filtering] parameter-type command under policy map not available

    Hi, all:
    I'm trying to configure TrendMicro IOS content filtering. I have this working on a separate box, running 15.1.
    On this particular testbed, I have a 2900 running:
    System image file is "flash0:c2900-universalk9-mz.SPA.152-3.T1.bin"
    And the following licensing:
    Technology Package License Information for Module:'c2900'
    Technology    Technology-package           Technology-package
                  Current       Type           Next reboot 
    ipbase        ipbasek9      Permanent      ipbasek9
    security      securityk9    Permanent      securityk9
    uc            uck9          Permanent      uck9
    data          datak9        Permanent      datak9
    Configuration register is 0x2102
    CUBE_GOLD_MEX#show ip trm subscription status
           Package Name:  Security & Productivity (Trial)
                 Status:  Active
    Status Update Time:  18:02:51 CST Mon Jul 23 2012
        Expiration-Date:  Mon Aug 20 02:00:00 2012
        Last Req Status:  Processed response successfully
    Last Req Sent Time:  18:02:51 CST Mon Jul 23 2012
    CUBE_GOLD_MEX#
    Also, I have the following config lines on it:
    ip host trps.trendmicro.com 216.104.8.100
    ip name-server 4.2.2.2
    ip cef
    multilink bundle-name authenticated
    parameter-map type urlfpolicy trend tm-pmap
    allow-mode on
    [snip]
    parameter-map type trend-global trend-glob-map
    class-map type inspect match-all http-imap
    match protocol http
    class-map type urlfilter trend match-any drop-category
    match url category Abortion
    match url category Activist-Groups
    match url category Adult-Mature-Content
    match url reputation ADWARE
    match url reputation DIALER
    match url reputation DISEASE-VECTOR
    match url reputation HACKING
    match url reputation PASSWORD-CRACKING-APPLICATIONS
    match url reputation PHISHING
    match url reputation POTENTIALLY-MALICIOUS-SOFTWARE
    match url reputation SPYWARE
    match url reputation VIRUS-ACCOMPLICE
    policy-map type inspect urlfilter trend-policy
    class type urlfilter trend drop-category
    I have not been able to get to the good part of configuring the ZBF.
    I've looked over several configuration examples and can't figure out what I'm doing wrong, since I'm not able to see the command 'parameter-map' under the 'policy-map urlfiltering'
    XXXXXX(config)#policy-map type inspect urlfilter trend-policy
    XXXXXX(config-pmap)#?
    Policy-map configuration commands:
      class        policy criteria
      description  Policy-Map description
      exit         Exit from policy-map configuration mode
      no           Negate or set default values of a command
    XXXXXX(config-pmap)#
    I thought it might be an issue with version 15.2.3, but according to configuration guides, commands are the same.
    Can anyone provide some assistance?
    TIA.
    c.

    Hi Carlos,
    I am having the same problem.  I have seen a few diffenent configuration examples and they all show adding the "parameter type urlfpolicy trend parm-map-name" command but it doesn't exist, at least in 15.2(3)T1 and I see it listed in the the IOS documentation for 15.2.  Maybe they forgot it :-)
    I guess I will open a TAC case as I do not want to downgrade...
    I will keep you posted if I find the answer.
    Regards,
    Troy

  • Displaying clickable html page in a JFrame

    Hello again programmers,
    i'm wondering how can i display a clickable html page in a JFrame using any Panel (JEditorPane,.....) can you show me the way plz?
    Bernard

    Makes a pretty crappy browser, but its OK for help-type functions.
    HtmlViewFrame.java
    import java.net.URL;
    import java.io.File;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    *Primitive HTML browser window based on a HtmlViewPane.
    public class HtmlViewFrame extends JFrame
    private HtmlViewPane pane;
    private JFrame frame;
    *Creates a frame based on a file.
    public HtmlViewFrame(File file) throws Exception
         this(file.toURL());
    *Creates a frame based on a URL.
    public HtmlViewFrame(URL url) throws Exception
         frame = this;
         getContentPane().setLayout(new BorderLayout());
         JPanel but_panel = new JPanel();
         but_panel.setLayout(new FlowLayout(FlowLayout.LEFT));
         JButton but_home = new JButton("home");
         but_home.addActionListener(new ActionListener()
                    public void actionPerformed(ActionEvent ae)
                   try
                        pane.home();
                   catch(Exception e)
                        JOptionPane.showMessageDialog(frame, "Error: " + e);
         but_panel.add(but_home);
         JButton but_back = new JButton("back");
         but_back.addActionListener(new ActionListener()
                    public void actionPerformed(ActionEvent ae)
                   try
                        pane.back();
                   catch(Exception e)
                        JOptionPane.showMessageDialog(frame, "Error: " + e);
         but_panel.add(but_back);
         getContentPane().add(but_panel, BorderLayout.NORTH);
         pane = new HtmlViewPane(url);
         JScrollPane jsp = new JScrollPane(pane);
         getContentPane().add(jsp, BorderLayout.CENTER);
         getContentPane().add(pane.getActionField(), BorderLayout.SOUTH);
    *HTML viewer application.
    *Uses java.lang.System.exit(int), so method should not be called from within a Java application.
    *@param     args     String array; provide a URL or file path as args[0]
    public static void main(String[] args)
         if(args.length==0)
              System.out.println("must provide File path or URL as argument");
              System.exit(1);
         Exception err = null;
         try
              File file = null;
              try
                   file = new File(args[0]);
                   if(!file.exists()) file = null;
              catch(Exception ex)
                   file = null;
                   err = ex;
              URL url = null;
              try
                   url = new URL(args[0]);
              catch(Exception ex)
                   url = null;
                   err = ex;
              HtmlViewFrame frame = null;
              if(file!=null) frame = new HtmlViewFrame(file);
              else if(url!=null) frame = new HtmlViewFrame(url);
              else throw err;
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(600,400);
              frame.show();
         catch(Exception e)
              err = e;
         if(err!=null) System.out.println("ERROR: " + err);
    HtmlViewPane.java
    import java.net.*;
    import java.io.*;
    import java.util.Vector;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.html.*;
    *A HTML panel based on JEditorPane.
    *Suitable for rendering primitive HTML files such as help documentation.
    public class HtmlViewPane extends JEditorPane
    /**The maximum number of elements the object can hold in its history.*/
    public static int MAX_HISTORY_SIZE = 100;
    private Vector history = new Vector();
    private URL home;
    private JTextField lab_lastact = new JTextField("loaded document");
    *Creates a panel based on a file.
    public HtmlViewPane(File file) throws Exception
         this(file.toURL());
    *Creates a panel based on a URL.
    public HtmlViewPane(URL url) throws Exception
         home = url;
         setEditable(false);
         addHyperlinkListener(new HtmlViewPaneListener(this));
         setPage(url);
         lab_lastact.setEditable(false);
    void addToHistory(HyperlinkEvent e)
         lab_lastact.setText("ACTION: go here: " + e.getURL().toExternalForm());
         if(history.size()>=MAX_HISTORY_SIZE) history.removeElementAt(0);
         history.add(e);
    *Causes the pane to move back to the last item in the history.
    public void back() throws Exception
         if(history.size()==0)
              lab_lastact.setText("ACTION: exhausted history list (max size=" + MAX_HISTORY_SIZE + ")");
              return;
         HyperlinkEvent e = (HyperlinkEvent) history.lastElement();
         history.removeElement(e);
         processEvent(e, false);
         lab_lastact.setText("ACTION: back to here: " + e.getURL().toExternalForm());
    *Returns a JTextField that reports hyperlink, back and home actions to the user.
    public JTextField getActionField()
         return      lab_lastact;
    *Causes the browser pane to return to the initial page.
    public void home() throws Exception
         setPage(home);
         lab_lastact.setText("ACTION: home to here: " + home.toExternalForm());
    void processEvent(HyperlinkEvent e, boolean addtohistory)
         if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
              if (e instanceof HTMLFrameHyperlinkEvent)
                   HTMLFrameHyperlinkEvent  evt = (HTMLFrameHyperlinkEvent) e;
                   HTMLDocument doc = (HTMLDocument) getDocument();
                   doc.processHTMLFrameHyperlinkEvent(evt);
              else
                   try
                        setPage(e.getURL());
                        if(addtohistory) addToHistory(e);
                   catch (Throwable t)
                        t.printStackTrace();
    class HtmlViewPaneListener implements HyperlinkListener
    private HtmlViewPane pane;
    HtmlViewPaneListener(HtmlViewPane pane)
         this.pane = pane;
    public void hyperlinkUpdate(HyperlinkEvent e)
         pane.processEvent(e, true);
    }

  • Can some explain this to me

    Here is the code.
    import java.net.*;
    import java.util.*;
    import java.awt.*;
    import java.applet.AppletContext;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.lang.String.*;
    import java.text.DateFormat;
    public class Headlines3 extends JApplet implements Runnable{
       private HashMap sites;    // site names and URLs
       private Vector siteNames;   // site names
       private int appletWidth, appletHeight;
       private int yPosition;
       private int xPosition;
       boolean hasTextDisplayed;
       Thread runner;
       static int x;
       CustomPanel panel;
       private JTextField timeField;
       Object object;
       String output = "";
       int newsLength;
       Calendar cal= new GregorianCalendar();     // this make a Calendar with current Date - Time.
       Date today;
       String dateOut;
       DateFormat dateFormatter;
       Locale loc= new Locale("EN", "en");
       // read HTML parameters and set up GUI
       public void init()
              hasTextDisplayed = false;
              appletHeight  = yPosition = getSize().height;
              appletWidth =  getSize().width;
              Container container = getContentPane();
              //container.setLayout(new FlowLayout());
              //add date to ticker
            cal.setTime(new java.util.Date());
            dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT,
                                loc);
            today = new Date();
            dateOut = dateFormatter.format(today);
              timeField = new JTextField(dateOut + " ", 20);
            //timeLabel.setVerticalTextPosition( SwingConstants.BOTTOM );
              //container.add( timeField);
              if (runner == null) {
            runner = new Thread(this);
            runner.start();
          // create HashMap and Vector
          sites = new HashMap();
          siteNames = new Vector();
          newsLength = output.length();
           panel = new CustomPanel();
          container.add(timeField);
           container.add(panel);
           //getContentPane().add(timeField);
          //getContentPane().add(panel);
          panel.setBackground(Color.white);
          // obtain parameters from HTML document
          getSitesFromHTMLParameters();}
          // create GUI components and layout interface
           class CustomPanel extends JPanel {
           Headlines3 app = new Headlines3();
            public void update(Graphics g)
              //overwrote this method to avoid repainting of background before all text displays
              if (hasTextDisplayed == true)
                   //repaint the background
                   g.setColor(Color.black);
                   g.fillRect(x+800, 0, appletWidth - (x + 800),
                                appletHeight);
                   g.setColor(Color.white);
              paint(g);
           public void paintComponent(Graphics g) {
           super.paintComponent(g);
              g.setColor(Color.blue);
              int space = 50;
              for (int i =0; i <= 3; i ++ ){
              space = space + 300;
              object = siteNames.get(i);
              //output = "sitename: " + object + "\n";
              URL newDocument = ( URL ) sites.get( object );
              g.setColor(Color.blue);
             g.drawString(""+ object ,space +app.x,20);
              g.setColor(Color.red);
              g.drawString(""+ newDocument ,space +app.x,50);
             g.drawString("",space + app.x,50);
           public void run() {
           Thread thisThread = Thread.currentThread();
           while (runner == thisThread) {
           repaint();
          if ( x <= - 1000 ){
           x = appletWidth;
           hasTextDisplayed = true;
           else x--;
           try {
           thisThread.sleep(10);
          }catch (InterruptedException e) {}
       // obtain parameters from HTML document
       private void getSitesFromHTMLParameters()
          // look for applet parameters in HTML document and add to HashMap
          String title, location;
          URL url;
          int counter = 0;
           int storycount = 0;
           char order;
          title = getParameter( "title" + counter ); // get first site title
           ++storycount;
           order = (char)storycount;
          // loop until no more parameters in HTML document
          while ( title != null ) {
             // obtain site location
             location = getParameter( "location" + counter );
             // place title/URL in HashMap and title in Vector
             try {
                url = new URL( location );// convert location to URL
                sites.put(title, url );   // put title/URL in HashMap
                siteNames.add(title );    // put title in Vector
             // process invalid URL format
             catch ( MalformedURLException urlException ) {
                urlException.printStackTrace();
             ++counter;
             title = getParameter( "title" + counter ); // get next site title
          } // end while
       } // end method getSitesFromHTMLParameters
    } // end class SiteSelectorhtml bit..
    <html>
    <title>produceHeadline</title>
    <body>
    <applet code = "Headlines3.class" width = "300" height = "75">
    <param name = "title0" value = "UK unemployment at 20-year low">
    <param name = "location0" value = "http://news.bbc.co.uk/1/hi/business/3631417.stm">
    <param name = "title1" value = "Innocent people dubbed criminals">
    <param name = "location1" value = "http://news.bbc.co.uk/1/hi/uk/3630971.stm">
    <param name = "title2" value = "Government U-turn on Europe poll">
    <param name = "location2" value = "http://news.bbc.co.uk/1/hi/uk_politics/3635943.stm">
    <param name = "title3" value = "Soldiers caught in roadside bomb">
    <param name = "location3" value = "http://news.bbc.co.uk/1/hi/england/kent/3638297.stm">
    </applet>
    </body>
    </html>
    Its going to be a news ticker. Ok i have these problems
    1)I am new to java GUI, i have a textfield with the date and another with the ticker. I cannot seem to get them to both appear on the applet, the curent code shows just the ticker. Can someone explain how i can get both to show up, sample code would be helpful
    2) Also any suggestions how to make the scrolling text never stop.so when it comes to the last item the first is directly behind it again.

    >
    1)I am new to java GUI, i have a textfield with the
    date and another with the ticker. I cannot seem to get
    them to both appear on the applet, the curent code
    shows just the ticker. Can someone explain how i can
    get both to show up, sample code would be helpful- You can use a GridLayout to evenly distribute every component.
    or
    - You can use your FlowLayout and set the prefferedSize,minimumSize, and maximumSize properties.
    or
    - A constructor of the JTextField accepts an int value that specifies tha width of the component in characters. (May not work well with GridLayout. Personally, I think it's the best solution.)
    2) Also any suggestions how to make the scrolling text
    never stop.so when it comes to the last item the first
    is directly behind it again.Please explain what your applet does before talking about "the scrolling text", we all have valuable time and most of us don't feel like taking our time to decipher somebody else's code just to see if we can help him/her with their problem.

  • EasyVPN - Is it really?

    Recently I have purchased my first Cisco ISR2 2911 with two WAN ports.
    Both of them are used through Policy Based Routing. Traffic filtering is done by Trend-Micro Content Based Security.
    Only Remote Access VPN is needed to finish off the configuration.
    SmartNet Engineer has been trying to configure it for a month now. For a moment I even had to disconnect one of the links to prove him that one of my ISPs is not maliciously filtering the traffic.
    He tried very basic configuration with local DHCP pool and VPN configuration on a physical interface but it would not connect further then the ISR.
    So I have returned to original configuration with EasyVPN Virtual-Template interface and internal Microsoft DHCP so I can manage the pool centrally (see config below).
    Cisco VPN client gets its IP from the server but Default Gateway IP is exactly the same, is don’t think it is ok.
    Currently I can PING internal interface of the ISR from the VPN but not any inside network hosts.
    Could you help please because I lost my hope in the SmatNet.
    service timestamps debug datetime msec
    service timestamps log datetime msec
    service password-encryption
    hostname c2911
    boot-start-marker
    boot system flash c2900-universalk9-mz.SPA.152-1.T.bin
    boot-end-marker
    logging buffered 51200 warnings
    enable secret 5 xxxxxxxxxxxxxxxxxxxxx
    aaa new-model
    aaa authentication login default local
    aaa authentication login ciscocp_vpn_xauth_ml_1 local
    aaa authorization exec default local
    aaa authorization network ciscocp_vpn_group_ml_1 local
    aaa session-id common
    clock timezone London 0 0
    clock summer-time London date Mar 30 2003 1:00 Oct 26 2003 2:00
    no ipv6 cef
    no ip source-route
    ip domain name firma.com
    ip host trps.trendmicro.com 216.104.8.100
    ip name-server 10.57.124.42
    ip port-map user-protocol--1 port tcp 3389
    ip inspect tcp reassembly queue length 64
    ip cef
    multilink bundle-name authenticated
    !parameter-map type urlfpolicy trend cptrendparacatdeny0
    allow-mode on
    block-page message "The website you have accessed is blocked as per corporate policy"
    parameter-map type regex ccp-regex-nonascii
    pattern [^\x00-\x80]parameter-map type urlf-glob cplocclassurlfgloburlblock0
    pattern *.facebook.comparameter-map type urlf-glob cpaddbnwlocparapermit3
    pattern email.btconnect.com
    pattern *.email.btconnect.com
    pattern *.linkedin.com
    parameter-map type trend-global global-param-map
    cache-entry-lifetime 48
    crypto pki token default removal timeout 0
    crypto pki trustpoint Equifax_Secure_CA
    revocation-check none
    crypto pki trustpoint NetworkSolutions_CA
    revocation-check none
    crypto pki trustpoint trps1_server
    revocation-check none
    crypto pki trustpoint test_trustpoint_config_created_for_sdm
    subject-name [email protected]
    revocation-check crl
    crypto pki trustpoint TP-self-signed-2793878619
    enrollment selfsigned
    subject-name cn=IOS-Self-Signed-Certificate-2793878619
    revocation-check none
    crypto pki certificate chain Equifax_Secure_CA
    certificate ca 35CF
      0D010105
      2AA72349
       quit
    crypto pki certificate chain NetworkSolutions_CA
    certificate ca 10EA
      308204A6
      9505FB0A
       quit
    crypto pki certificate chain trps1_server
    certificate ca 00
      30820208
      882BFEC3
       quit
    crypto pki certificate chain test_trustpoint_config_created_for_sdm
    crypto pki certificate chain TP-self-signed-2619
    certificate self-signed 01
      3082022B ...
      D1DC12
       quit
    license udi pid CISCO2911/K9 sn XXXXXXXX
    username xxxx privilege 15 secret 5 xxxx
    redundancy
    track 10 ip sla 1 reachability
    delay down 15 up 15
    track 20 ip sla 2 reachability
    delay down 15 up 15
    class-map type inspect match-all sdm-nat-user-protocol--1-2
    match access-group 103
    match protocol user-protocol--1
    class-map type inspect match-all sdm-nat-user-protocol--1-1
    match access-group 104
    match protocol http
    class-map type inspect match-any SDM_AH
    match access-group name SDM_AH
    class-map type inspect match-any ccp-skinny-inspect
    match protocol skinny
    class-map type inspect match-any ccp-cls-insp-traffic
    match protocol dns
    match protocol ftp
    match protocol https
    match protocol icmp
    match protocol imap
    match protocol pop3
    match protocol netshow
    match protocol shell
    match protocol realmedia
    match protocol rtsp
    match protocol smtp
    match protocol sql-net
    match protocol streamworks
    match protocol tftp
    match protocol vdolive
    match protocol tcp
    match protocol udp
    class-map type inspect match-all ccp-insp-traffic
    match class-map ccp-cls-insp-traffic
    class-map type inspect match-any SDM_IP
    match access-group name SDM_IP
    class-map type inspect match-any SDM_ESP
    match access-group name SDM_ESP
    class-map type inspect match-any SDM_EASY_VPN_SERVER_TRAFFIC
    match protocol isakmp
    match protocol ipsec-msft
    match class-map SDM_AH
    match class-map SDM_ESP
    class-map type inspect match-all SDM_EASY_VPN_SERVER_PT
    match class-map SDM_EASY_VPN_SERVER_TRAFFIC
    class-map type urlfilter match-any cpaddbnwlocclasspermit3
    match  server-domain urlf-glob cpaddbnwlocparapermit3
    class-map type inspect match-any ccp-h323nxg-inspect
    match protocol h323-nxg
    class-map type urlfilter match-any cplocclassurlblock0
    match  server-domain urlf-glob cplocclassurlfgloburlblock0
    class-map type inspect match-any ccp-cls-icmp-access
    match protocol icmp
    match protocol tcp
    match protocol udp
    class-map type inspect match-any ccp-h225ras-inspect
    match protocol h225ras
    class-map type urlfilter trend match-any cptrendclasscatdeny0
    match  url category Adult-Mature-Content
    match  url category Gambling
    match  url category Marijuana
    match  url category Nudity
    match  url category Pornography
    match  url category Violence-hate-racism
    match  url category Alcohol-Tobacco
    match  url category Chat-Instant-Messaging
    match  url category Cult-Occult
    match  url category For-Kids
    match  url category Games
    match  url category Gay-Lesbian
    match  url category Illegal-Drugs
    match  url category Sex-education
    match  url category Weapons
    match  url category Illegal-Questionable
    match  url category Intimate-apparel-swimsuit
    match  url category Peer-to-Peer
    match  url category Personals-Dating
    match  url category Proxy-Avoidance
    match  url category Social-Networking
    match  url category Spam
    match  url category Tasteless
    class-map type inspect match-any ccp-h323annexe-inspect
    match protocol h323-annexe
    class-map type urlfilter trend match-any cptrendclassrepdeny0
    match  url reputation ADWARE
    match  url reputation DIALER
    match  url reputation DISEASE-VECTOR
    match  url reputation HACKING
    match  url reputation PASSWORD-CRACKING-APPLICATIONS
    match  url reputation PHISHING
    match  url reputation POTENTIALLY-MALICIOUS-SOFTWARE
    match  url reputation SPYWARE
    match  url reputation VIRUS-ACCOMPLICE
    class-map type inspect match-any ccp-h323-inspect
    match protocol h323
    class-map type inspect match-all ccp-invalid-src
    match access-group 102
    class-map type inspect match-all ccp-icmp-access
    match class-map ccp-cls-icmp-access
    class-map type inspect match-any ccp-sip-inspect
    match protocol sip
    class-map type inspect match-all ccp-protocol-http
    match protocol http
    policy-map type inspect ccp-permit-icmpreply
    class type inspect ccp-icmp-access
      inspect
    class class-default
      pass
    policy-map type inspect sdm-pol-NATOutsideToInside-1
    class type inspect sdm-nat-user-protocol--1-1
      inspect
    class type inspect sdm-nat-user-protocol--1-2
      inspect
    class class-default
      drop
    policy-map type inspect urlfilter cppolicymap-1
    parameter type urlfpolicy trend cptrendparacatdeny0
    class type urlfilter cpaddbnwlocclasspermit3
      allow
      log
    class type urlfilter cplocclassurlblock0
      reset
      log
    class type urlfilter trend cptrendclasscatdeny0
      reset
      log
    class type urlfilter trend cptrendclassrepdeny0
      reset
      log
    policy-map type inspect ccp-inspect
    class type inspect ccp-invalid-src
      drop log
    class type inspect ccp-protocol-http
      inspect
      service-policy urlfilter cppolicymap-1
    class type inspect ccp-insp-traffic
      inspect
    class type inspect ccp-sip-inspect
      inspect
    class type inspect ccp-h323-inspect
      inspect
    class type inspect ccp-h323annexe-inspect
      inspect
    class type inspect ccp-h225ras-inspect
      inspect
    class type inspect ccp-h323nxg-inspect
      inspect
    class type inspect ccp-skinny-inspect
      inspect
    class class-default
      drop
    policy-map type inspect ccp-permit
    class type inspect SDM_EASY_VPN_SERVER_PT
      pass
    class class-default
      drop
    policy-map type inspect sdm-permit-ip
    class type inspect SDM_IP
      pass
    class class-default
      drop log
    zone security out-zone
    zone security in-zone
    zone security ezvpn-zone
    zone-pair security ccp-zp-self-out source self destination out-zone
    service-policy type inspect ccp-permit-icmpreply
    zone-pair security ccp-zp-in-out source in-zone destination out-zone
    service-policy type inspect ccp-inspect
    zone-pair security ccp-zp-out-self source out-zone destination self
    service-policy type inspect ccp-permit
    zone-pair security sdm-zp-NATOutsideToInside-1 source out-zone destination in-zone
    service-policy type inspect sdm-pol-NATOutsideToInside-1
    zone-pair security sdm-zp-in-ezvpn1 source in-zone destination ezvpn-zone
    service-policy type inspect sdm-permit-ip
    zone-pair security sdm-zp-ezvpn-in1 source ezvpn-zone destination in-zone
    service-policy type inspect sdm-permit-ip
    zone-pair security sdm-zp-out-ezpn1 source out-zone destination ezvpn-zone
    service-policy type inspect sdm-permit-ip
    zone-pair security sdm-zp-ezvpn-out1 source ezvpn-zone destination out-zone
    service-policy type inspect sdm-permit-ip
    crypto logging ezvpn
    crypto isakmp policy 1
    encr 3des
    authentication pre-share
    group 2
    crypto isakmp client configuration group GROUPPOLICY1
    key xxxxxxx
    dns 10.57.124.42 10.57.124.159
    domain firma.com
    dhcp server 10.57.124.159
    crypto isakmp profile ciscocp-ike-profile-1
       match identity group GROUPPOLICY1
       client authentication list ciscocp_vpn_xauth_ml_1
       isakmp authorization list ciscocp_vpn_group_ml_1
       client configuration address respond
       virtual-template 1
    crypto ipsec transform-set ESP-3DES-SHA esp-3des esp-sha-hmac
    crypto ipsec profile CiscoCP_Profile1
    set security-association idle-time 28800
    set transform-set ESP-3DES-SHA
    set isakmp-profile ciscocp-ike-profile-1
    interface Embedded-Service-Engine0/0
    no ip address
    shutdown
    interface GigabitEthernet0/0
    description *** LAN INTERFACE ***$FW_INSIDE$
    ip address 10.57.124.254 255.255.254.0
    ip nat inside
    ip virtual-reassembly in
    zone-member security in-zone
    ip policy route-map PBR
    duplex auto
    speed auto
    interface GigabitEthernet0/1
    description *** LINK TO BT ***$FW_OUTSIDE$$ETH-WAN$
    ip address 1.1.1.210 255.255.255.240
    ip nbar protocol-discovery
    ip nat outside
    ip virtual-reassembly in
    zone-member security out-zone
    duplex auto
    speed auto
    interface GigabitEthernet0/2
    description *** LINK TO BE ***$FW_OUTSIDE$$ETH-WAN$
    ip address 2.2.2.154 255.255.252.0
    ip nbar protocol-discovery
    ip flow ingress
    ip flow egress
    ip nat outside
    ip virtual-reassembly in
    zone-member security out-zone
    duplex auto
    speed auto
    interface Virtual-Template1 type tunnel
    ip unnumbered GigabitEthernet0/2
    zone-member security ezvpn-zone
    tunnel mode ipsec ipv4
    tunnel protection ipsec profile CiscoCP_Profile1
    ip forward-protocol nd
    ip http server
    ip http secure-server
    ip flow-top-talkers
    top 4
    sort-by bytes
    cache-timeout 600000
    ip dns server
    ip nat inside source static tcp 10.57.124.92 3389 interface GigabitEthernet0/1 3389
    ip nat inside source static tcp 10.57.124.48 80 interface GigabitEthernet0/1 80
    ip nat inside source route-map ISP1 interface GigabitEthernet0/1 overload
    ip nat inside source route-map ISP2 interface GigabitEthernet0/2 overload
    ip route 0.0.0.0 0.0.0.0 1.1.1.209 track 10
    ip route 0.0.0.0 0.0.0.0 2.2.2.1 track 20
    ip route 216.104.8.100 255.255.255.255 2.2.2.1
    ip access-list extended NATTRANSLATE
    remark DO NOT NAT VPN
    deny   ip 10.57.124.0 0.0.1.255 10.57.124.0 0.0.1.255
    permit ip 10.57.124.0 0.0.1.255 any
    ip access-list extended SDM_AH
    remark CCP_ACL Category=1
    permit ahp any any
    ip access-list extended SDM_ESP
    remark CCP_ACL Category=1
    permit esp any any
    ip access-list extended SDM_IP
    remark CCP_ACL Category=1
    permit ip any any
    ip sla 1
    icmp-echo 1.1.1.209
    frequency 5
    ip sla schedule 1 life forever start-time now
    ip sla 2
    icmp-echo 2.2.2.1
    frequency 5
    ip sla schedule 2 life forever start-time now
    access-list 1 remark CCP_ACL Category=2
    access-list 1 permit 10.57.124.0 0.0.1.255
    access-list 10 permit 10.57.124.0 0.0.1.255
    access-list 100 deny   ip 10.57.124.0 0.0.1.255 213.123.26.0 0.0.1.255
    access-list 100 deny   ip 10.57.124.0 0.0.1.255 host 194.72.6.57
    access-list 100 deny   ip 10.57.124.0 0.0.1.255 host 194.73.82.242
    access-list 100 deny   ip host 10.57.124.48 any
    access-list 100 deny   ip host 10.57.124.92 any
    access-list 100 permit ip any any
    access-list 101 permit ip any any
    access-list 102 remark CCP_ACL Category=128
    access-list 102 permit ip host 255.255.255.255 any
    access-list 102 permit ip 127.0.0.0 0.255.255.255 any
    access-list 102 permit ip 2.2.2.0 0.0.3.255 any
    access-list 102 permit ip 1.1.1.208 0.0.0.15 any
    access-list 103 remark CCP_ACL Category=0
    access-list 103 permit ip host a.a.a.140 host 10.57.124.92
    access-list 103 permit ip host b.b.b.114.248 host 10.57.124.92
    access-list 103 permit ip host c.c.c.202 host 10.57.124.92
    access-list 104 remark CCP_ACL Category=0
    access-list 104 permit ip any host 10.57.124.48
    route-map PBR permit 10
    match ip address 100
    set ip next-hop verify-availability 2.2.2.1 1 track 20
    route-map PBR permit 30
    match ip address 101
    set ip next-hop verify-availability 1.1.1.209 2 track 10
    route-map ISP2 permit 10
    match ip address NATTRANSLATE
    match interface GigabitEthernet0/2
    route-map ISP1 permit 10
    match ip address NATTRANSLATE
    match interface GigabitEthernet0/1
    control-plane
    banner login ^CCThis system is the property of company ...
    -----------------------------------------------------------------------^C
    line con 0
    line aux 0
    line 2
    no activation-character
    no exec
    transport preferred none
    transport input all
    transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
    stopbits 1
    line vty 0 4
    password 7 xxxxx
    logging synchronous
    transport input all
    scheduler allocate 20000 1000
    ntp update-calendar
    ntp server 0.europe.pool.ntp.org source GigabitEthernet0/2
    ntp server uk.pool.ntp.org prefer source GigabitEthernet0/2
    end

    Problem fixed.
    VPN traffic has to be removed from both access lists 100 and 101 so it is not directed to a physical interface. 101 had ‘allow any’ statement and in consequence even that there was an injected route for EasyVPN clients it would not be chosen over Policy Based Routing.

  • Simple webcrawler

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.ArrayList;
    import java.util.Vector;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class WebCrawler implements Runnable{
          // URLs to be searched
        Vector<String> vectorToSearch = new Vector<String>();
        // URLs already searched
        Vector<String> vectorSearched = new Vector<String>();
        // URLs which match
        Vector<String> vectorMatches = new Vector<String>();
        String address = "http://www.bloomberg.com";
         public static void main(String[] args){
              WebCrawler webCrawler = new WebCrawler();
              webCrawler.start();
         public void start() {
              vectorToSearch.add(address);
              run();
         public void run() {
              try{
                   while (vectorToSearch.size() > 0){
                        System.out.println("Searching "+vectorToSearch.get(0));
                        getAndParsePage(vectorToSearch.get(0));
              catch(Exception e){
                   e.printStackTrace();
         private void getAndParsePage(String add) throws IOException{
              try{
                   URL url = new URL(add);
                   BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                   String i;
                   Vector<String> thisUrl = null;
                   thisUrl = new Vector<String>();
                   while (((i=in.readLine()) != null)){thisUrl.add(i);}
                   for (String input : thisUrl){
                        if (input.indexOf("href=\"http://")!=-1){
                             Pattern pattern = Pattern.compile("http://.*\"");
                             Matcher matcher = pattern.matcher(input);
                             if (matcher.find()){
                                  String result = matcher.group();
                                  result = result.substring(0,result.indexOf("\""));
                                  try {
                                       URL urlLink = new URL(result);
                                       result = urlLink.toString();
                                       if (!result.equals(add))
                                            if(!wasSearched(add))
                                                 vectorToSearch.add(0,result);
                                   catch (MalformedURLException e) {
              }catch(Exception e){
              vectorToSearch.remove(add);
              vectorSearched.add(add);
              System.out.println("closing "+add);
         private boolean wasSearched(String add){
              for (String s : vectorSearched) if (s.equals(add))return true;
              return false;
    }the problem is i search some urls more then once
    Message was edited by:
    Kernel_77

    kernel,
    Pattern.compile("http://.*\"");
    the .* is greedy, meaning that it'll keep matching to the end of the line... sugest you try [^\"]*\" in place of .*
    can't see why it would search some URL's twice though... unless they're in the source page twice.
    keith/
    Message was edited by: corlettk

  • Event calendar

    hi,
    my calendar shows all the events of perticular day. in text
    area its fine. i am defining URL in vector . that URL is appearing
    in text area. is it any solution to click that url address and to
    get in new brouser window. how to dispaly that url in heigh light
    mode.is there any other method to watch all the events of on that
    day for number of url s brousing.

    You can do this very easily in Discoverer if you have that rolled out. Otherwise you are probably into writing a quick report or SQL (very easy SQL, I should add)
    This is a bit of a weakness in current OLM; there is no good place to search for classes by date - a requirement I've had from every customer I've worked on OLM with. Hopefully it will be plugged in a future release.

  • Writing to a server using a servlet

    does anyone know how to write a file (i.e. txt, htm, etc...) to a server using a servlet.
    i'm using tomcat 4.0.1 and an IIS
    i've been trying to figure out how to do this for a few days now and have not been able to figure it out.
    can anyone show me how?
    thanks
    Andy

    i got the above code working, but now when i try to pass a vector into the mix i'm not having any luck.
    i haven't even been able to get a POST message to appear.
    i think there is something wrong with my client-side code....
    /*******applet********/
    public void sendVector(Vector sendingVector)
    URL baseURL = getCodeBase();
    String protocol = baseURL.getProtocol();
    String host = baseURL.getHost();
    int port = 808;
    try
    String urlSuffix = "/servlet/contactlist.WriteToServlet";
    URL servletURL = new URL(protocol, host, port, urlSuffix);
    URLConnection conn = servletURL.openConnection();
    // inform the connection that we will send output and accept input
    conn.setDoInput(true);
    conn.setDoOutput(true);
    // Don't use a cached version of URL connection.
    conn.setUseCaches (false);
    conn.setDefaultUseCaches (false);
    // Specify the content type that we will send binary data
    conn.setRequestProperty ("Content-Type", "application/octet-stream");
    // send the student object to the servlet using serialization
    ObjectOutputStream outputToServlet = new ObjectOutputStream(conn.getOutputStream());
    // serialize the object
    outputToServlet.writeObject( sendingVector );
    outputToServlet.flush();
    outputToServlet.close();
    } catch (IOException io) { io.printStackTrace(); }
    } // end sendVector
    /*********servlet*************/
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    try
    // get an input stream from the applet
    ObjectInputStream inputFromApplet = new ObjectInputStream(request.getInputStream());
    // read the serialized student data from applet
    Vector passInfo = (Vector)inputFromApplet.readObject();
    inputFromApplet.close();
    for(int i =0; i < passInfo.size(); i++) System.out.println(passInfo.get(i));
    // make this so that the vector filename has no spaces
    FileWriter writer = new FileWriter("G:\\Intranet\\wwwroot\\Contact\\contactlist\\Departments\\" + getFileTitle(passInfo.get(1).toString()) + ".htm");
    // prints information to the file
    int a;
    for(a = 0; a < (passInfo.size()-1); a++)
    { writer.write(passInfo.get(a) + "\n");
    writer.write(passInfo.get(a).toString());
    writer.flush();
    writer.close();
    catch(Exception e) { e.printStackTrace(); }
    public void doPut(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    doGet(request, response);
    } // end doPut

  • Really Slow web surfing through ZBF with IOS Content filter

    Edited: attached partial output of "sh policy-map type inspect zone-pair urlfilter"   
    Hey, all
    We have a 1921 router with IOS Content filter subscribsion and it is also configured as ZBF running latest IOS v15.1. End-user keep complaining about slow web surfing. I connected to network and tested myself and found intermittent surfing experience.
    For example, access to www.ibm.com or www.cnn.com hangs 7 times of 10 attempts and maybe only loads reasonablly quick in 1-2 time of the 3. This also affects the speed of download from websites.
    I have the case openned with Cisco TAC and CCIE checked my configure but nothing caught his eyes...
    I decide to post the issue here in case we both missed something:
    Current configuration : 18977 bytes
    version 15.1
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    hostname abc_1921
    boot-start-marker
    boot system flash:/c1900-universalk9-mz.SPA.151-4.M4.bin
    boot-end-marker
    aaa new-model
    aaa authentication login default local
    aaa authentication login NONE_LOGIN none
    aaa authorization exec default local
    aaa session-id common
    clock timezone AST -4 0
    clock summer-time ADT recurring 3 Sun Mar 2:00 2 Sun Nov 2:00
    no ipv6 cef
    ip source-route
    ip auth-proxy max-login-attempts 5
    ip admission max-login-attempts 5
    ip cef
    ip dhcp excluded-address 192.168.1.1 192.168.1.9
    ip dhcp excluded-address 192.168.1.111 192.168.1.254
    ip dhcp pool DHCPPOOL
    import all
    network 192.168.1.0 255.255.255.0
    domain-name abc.local
    dns-server 192.168.10.200 192.168.10.202
    netbios-name-server 4.2.2.4
    default-router 192.168.1.150
    option 202 ip 192.168.1.218
    lease 8
    ip domain name abc.locol
    ip name-server 8.8.8.8
    ip name-server 4.2.2.2
    ip port-map user-port-1 port tcp 5080
    ip port-map user-port-2 port tcp 3389
    ip inspect log drop-pkt
    multilink bundle-name authenticated
    parameter-map type inspect global
    log dropped-packets enable
    parameter-map type urlfpolicy trend cprepdenyregex0
    allow-mode on
    block-page message "The website you have accessed is blocked as per corporate policy"
    parameter-map type urlf-glob cpaddbnwlocparapermit2
    pattern www.alc.ca
    pattern www.espn.com
    pattern www.bestcarriers.com
    pattern www.gulfpacificseafood.com
    pattern www.lafermeblackriver.ca
    pattern 69.156.240.29
    pattern www.tyson.com
    pattern www.citybrewery.com
    pattern www.canadianbusinessdirectory.ca
    pattern www.homedepot.ca
    pattern ai.fmcsa.dot.gov
    pattern www.mtq.gouv.qc.ca
    pattern licenseinfo.oregon.gov
    pattern www.summitfoods.com
    pattern www.marine-atlantic.ca
    pattern www.larway.com
    pattern www.rtlmotor.ca
    pattern *.abc.com
    pattern *.kijiji.ca
    pattern *.linkedin.com
    pattern *.skype.com
    pattern toronto.bluejays.mlb.com
    pattern *.gstatic.com
    parameter-map type urlf-glob cpaddbnwlocparadeny3
    pattern www.facebook.com
    pattern www.radiofreecolorado.net
    pattern facebook.com
    pattern worldofwarcraft.com
    pattern identityunknown.net
    pattern static.break.com
    pattern lyris01.media.com
    pattern www.saltofreight.com
    pattern reality-check.com
    pattern reality-check.ca
    parameter-map type ooo global
    tcp reassembly timeout 5
    tcp reassembly queue length 128
    tcp reassembly memory limit 8192
    parameter-map type trend-global global-param-map
    cache-size maximum-memory 5000
    crypto pki token default removal timeout 0
    crypto pki trustpoint Equifax_Secure_CA
    revocation-check none
    crypto pki trustpoint NetworkSolutions_CA
    revocation-check none
    crypto pki trustpoint trps1_server
    revocation-check none
    crypto pki trustpoint TP-self-signed-3538579429
    enrollment selfsigned
    subject-name cn=IOS-Self-Signed-Certificate-3538579429
    revocation-check none
    rsakeypair TP-self-signed-3538579429
    !! CERTIFICATE OMITED !!
    redundancy
    ip ssh version 2
    class-map type inspect match-any INCOMING_VPN_TRAFFIC_MAP
    match access-group name REMOTE_SITE_SUBNET
    class-map type inspect match-all PPTP_GRE_INSPECT_MAP
    match access-group name ALLOW_GRE
    class-map type inspect match-all INSPECT_SKINNY_MAP
    match protocol skinny
    class-map type inspect match-all INVALID_SOURCE_MAP
    match access-group name INVALID_SOURCE
    class-map type inspect match-all ALLOW_PING_MAP
    match protocol icmp
    class-map type urlfilter match-any cpaddbnwlocclasspermit2
    match  server-domain urlf-glob cpaddbnwlocparapermit2
    class-map type urlfilter match-any cpaddbnwlocclassdeny3
    match  server-domain urlf-glob cpaddbnwlocparadeny3
    class-map type urlfilter trend match-any cpcatdenyclass2
    class-map type inspect match-all cpinspectclass1
    match protocol http
    class-map type inspect match-any CUSTOMIZED_PROTOCOL_216
    match protocol citriximaclient
    match protocol ica
    match protocol http
    match protocol https
    class-map type inspect match-any INSPECT_SIP_MAP
    match protocol sip
    class-map type urlfilter trend match-any cptrendclasscatdeny1
    match  url category Abortion
    match  url category Activist-Groups
    match  url category Adult-Mature-Content
    match  url category Chat-Instant-Messaging
    match  url category Cult-Occult
    match  url category Cultural-Institutions
    match  url category Gambling
    match  url category Games
    match  url category Illegal-Drugs
    match  url category Illegal-Questionable
    match  url category Internet-Radio-and-TV
    match  url category Joke-Programs
    match  url category Military
    match  url category Nudity
    match  url category Pay-to-surf
    match  url category Peer-to-Peer
    match  url category Personals-Dating
    match  url category Pornography
    match  url category Proxy-Avoidance
    match  url category Sex-education
    match  url category Social-Networking
    match  url category Spam
    match  url category Tasteless
    match  url category Violence-hate-racism
    class-map type inspect match-any INSPECT_PROTOCOLS_MAP
    match protocol pptp
    match protocol dns
    match protocol ftp
    match protocol https
    match protocol imap
    match protocol pop3
    match protocol netshow
    match protocol shell
    match protocol realmedia
    match protocol rtsp
    match protocol smtp
    match protocol sql-net
    match protocol streamworks
    match protocol tftp
    match protocol vdolive
    match protocol tcp
    match protocol udp
    match protocol icmp
    class-map type urlfilter trend match-any cptrendclassrepdeny1
    match  url reputation ADWARE
    match  url reputation DIALER
    match  url reputation DISEASE-VECTOR
    match  url reputation HACKING
    match  url reputation PASSWORD-CRACKING-APPLICATIONS
    match  url reputation PHISHING
    match  url reputation POTENTIALLY-MALICIOUS-SOFTWARE
    match  url reputation SPYWARE
    match  url reputation VIRUS-ACCOMPLICE
    class-map type inspect match-all CUSTOMIZED_NAT_MAP_1
    match access-group name CUSTOMIZED_NAT_1
    match protocol user-port-1
    class-map type inspect match-all CUSTOMIZED_NAT_MAP_2
    match access-group name CUSTOMIZED_NAT_2
    match protocol user-port-2
    class-map type inspect match-any INSPECT_H323_MAP
    match protocol h323
    match protocol h323-nxg
    match protocol h323-annexe
    class-map type inspect match-all INSPECT_H225_MAP
    match protocol h225ras
    class-map type inspect match-all CUSTOMIZED_216_MAP
    match class-map CUSTOMIZED_PROTOCOL_216
    match access-group name CUSTOMIZED_NAT_216
    policy-map type inspect OUT-IN-INSPECT-POLICY
    class type inspect INCOMING_VPN_TRAFFIC_MAP
      inspect
    class type inspect PPTP_GRE_INSPECT_MAP
      pass
    class type inspect CUSTOMIZED_NAT_MAP_1
      inspect
    class type inspect CUSTOMIZED_NAT_MAP_2
      inspect
    class type inspect CUSTOMIZED_216_MAP
      inspect
    class class-default
      drop
    policy-map type inspect urlfilter cppolicymap-1
    description Default abc Policy Filter
    parameter type urlfpolicy trend cprepdenyregex0
    class type urlfilter cpaddbnwlocclasspermit2
      allow
    class type urlfilter cpaddbnwlocclassdeny3
      reset
      log
    class type urlfilter trend cptrendclasscatdeny1
      reset
      log
    class type urlfilter trend cptrendclassrepdeny1
      reset
      log
    policy-map type inspect IN-OUT-INSPECT-POLICY
    class type inspect cpinspectclass1
      inspect
      service-policy urlfilter cppolicymap-1
    class type inspect INSPECT_PROTOCOLS_MAP
      inspect
    class type inspect INVALID_SOURCE_MAP
      inspect
    class type inspect INSPECT_SIP_MAP
      inspect
    class type inspect ALLOW_PING_MAP
      inspect
    class type inspect INSPECT_SKINNY_MAP
      inspect
    class type inspect INSPECT_H225_MAP
      inspect
    class type inspect INSPECT_H323_MAP
      inspect
    class class-default
      drop
    zone security inside
    description INTERNAL_NETWORK
    zone security outside
    description PUBLIC_NETWORK
    zone-pair security INSIDE_2_OUTSIDE source inside destination outside
    service-policy type inspect IN-OUT-INSPECT-POLICY
    zone-pair security OUTSIDE_2_INSIDE source outside destination inside
    service-policy type inspect OUT-IN-INSPECT-POLICY
    crypto isakmp policy 10
    encr 3des
    authentication pre-share
    group 2
    crypto isakmp key password address 11.22.3.1
    crypto ipsec security-association lifetime seconds 28800
    crypto ipsec transform-set TunnelToCold esp-3des
    crypto map TunnelsToRemoteSites 10 ipsec-isakmp
    set peer 11.22.3.1
    set transform-set TunnelToCold
    match address TUNNEL_TRAFFIC2Cold
    interface Embedded-Service-Engine0/0
    no ip address
    shutdown
    interface GigabitEthernet0/0
    description OUTSIDE_INTERFACE
    ip address 1.1.1.186 255.255.255.248
    ip nat outside
    ip virtual-reassembly in
    zone-member security outside
    duplex full
    speed 1000
    crypto map TunnelsToRemoteSites
    crypto ipsec df-bit clear
    interface GigabitEthernet0/1
    description INSIDE_INTERFACE
    ip address 192.168.1.150 255.255.255.0
    ip nat inside
    ip virtual-reassembly in
    zone-member security inside
    duplex full
    speed 1000
    ip forward-protocol nd
    ip http server
    ip http access-class 10
    ip http authentication local
    ip http secure-server
    ip nat inside source static tcp 192.168.1.217 5080 interface GigabitEthernet0/0 5080
    ip nat inside source route-map NAT_MAP interface GigabitEthernet0/0 overload
    ip nat inside source static tcp 192.168.1.216 80 1.1.1.187 80 extendable
    ip nat inside source static tcp 192.168.1.216 443 1.1.1.187 443 extendable
    ip nat inside source static tcp 192.168.1.216 1494 1.1.1.187 1494 extendable
    ip nat inside source static tcp 192.168.1.216 2598 1.1.1.187 2598 extendable
    ip nat inside source static tcp 192.168.1.213 3389 1.1.1.187 3390 extendable
    ip nat inside source static tcp 192.168.1.216 5080 1.1.1.187 5080 extendable
    ip route 0.0.0.0 0.0.0.0 1.1.1.185
    ip access-list standard LINE_ACCESS_CONTROL
    permit 192.168.1.0 0.0.0.255
    ip access-list extended ALLOW_ESP_AH
    permit esp any any
    permit ahp any any
    ip access-list extended ALLOW_GRE
    permit gre any any
    ip access-list extended CUSTOMIZED_NAT_1
    permit ip any host 192.168.1.217
    permit ip any host 192.168.1.216
    ip access-list extended CUSTOMIZED_NAT_2
    permit ip any host 192.168.1.216
    permit ip any host 192.168.1.212
    permit ip any host 192.168.1.213
    ip access-list extended CUSTOMIZED_NAT_216
    permit ip any host 192.168.1.216
    ip access-list extended INVALID_SOURCE
    permit ip host 255.255.255.255 any
    permit ip 127.0.0.0 0.255.255.255 any
    ip access-list extended NAT_RULES
    deny   ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
    deny   ip 192.168.1.0 0.0.0.255 192.168.3.0 0.0.0.255
    deny   ip 192.168.1.0 0.0.0.255 192.168.4.0 0.0.0.255
    deny   ip 192.168.1.0 0.0.0.255 192.168.5.0 0.0.0.255
    deny   ip 192.168.1.0 0.0.0.255 192.168.6.0 0.0.0.255
    deny   ip 192.168.1.0 0.0.0.255 192.168.7.0 0.0.0.255
    deny   ip 192.168.1.0 0.0.0.255 192.168.8.0 0.0.0.255
    deny   ip 192.168.1.0 0.0.0.255 192.168.9.0 0.0.0.255
    deny   ip 192.168.1.0 0.0.0.255 192.168.10.0 0.0.0.255
    permit ip 192.168.1.0 0.0.0.255 any
    ip access-list extended REMOTE_SITE_SUBNET
    permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
    permit ip 192.168.3.0 0.0.0.255 192.168.1.0 0.0.0.255
    permit ip 192.168.4.0 0.0.0.255 192.168.1.0 0.0.0.255
    permit ip 192.168.5.0 0.0.0.255 192.168.1.0 0.0.0.255
    permit ip 192.168.6.0 0.0.0.255 192.168.1.0 0.0.0.255
    permit ip 192.168.7.0 0.0.0.255 192.168.1.0 0.0.0.255
    permit ip 192.168.8.0 0.0.0.255 192.168.1.0 0.0.0.255
    permit ip 192.168.9.0 0.0.0.255 192.168.1.0 0.0.0.255
    permit ip 192.168.10.0 0.0.0.255 192.168.1.0 0.0.0.255
    ip access-list extended TUNNEL_TRAFFIC2ABM
    permit ip 192.168.1.0 0.0.0.255 192.168.10.0 0.0.0.255
    ip access-list extended TUNNEL_TRAFFIC2Bridgewater
    permit ip 192.168.1.0 0.0.0.255 192.168.8.0 0.0.0.255
    ip access-list extended TUNNEL_TRAFFIC2ColdbrookDispatch
    permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
    ip access-list extended TUNNEL_TRAFFIC2ColdbrookETL
    permit ip 192.168.1.0 0.0.0.255 192.168.7.0 0.0.0.255
    ip access-list extended TUNNEL_TRAFFIC2ColdbrookTrailershop
    permit ip 192.168.1.0 0.0.0.255 192.168.3.0 0.0.0.255
    ip access-list extended TUNNEL_TRAFFIC2Moncton
    permit ip 192.168.1.0 0.0.0.255 192.168.6.0 0.0.0.255
    ip access-list extended TUNNEL_TRAFFIC2MountPearl
    permit ip 192.168.1.0 0.0.0.255 192.168.4.0 0.0.0.255
    ip access-list extended TUNNEL_TRAFFIC2Ontoria
    permit ip 192.168.1.0 0.0.0.255 192.168.5.0 0.0.0.255
    ip access-list extended WEB_TRAFFIC
    permit tcp 192.168.1.0 0.0.0.255 any eq www
    access-list 10 permit 192.168.1.0 0.0.0.255
    route-map NAT_MAP permit 10
    match ip address NAT_RULES
    snmp-server community 1publicl RO
    control-plane
    line con 0
    logging synchronous
    login authentication NONE_LOGIN
    line aux 0
    line 2
    no activation-character
    no exec
    transport preferred none
    transport input all
    transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
    stopbits 1
    line vty 0 4
    access-class LINE_ACCESS_CONTROL in
    exec-timeout 30 0
    logging synchronous
    transport input all
    scheduler allocate 20000 1000
    ntp server 0.ca.pool.ntp.org prefer
    ntp server 1.ca.pool.ntp.org
    end

    Hi,
    I know this is for a different platform but have a look at this link:
    https://supportforums.cisco.com/thread/2089462
    Read through it to get some idea of the similarity, but in particular note the last entry almost a year after the original post.
    I too am having trouble with http inspection, if I do layers 3 & 4 inspection there is no issue whatsoever, but as soon as I enable layer 7 inspection then I have intermittent browsing issues.
    The easy solution here is to leave it at layers 3 & 4, which doesn't give you the flixibility to do cool things like blocking websites, IM, regex expression matching etc...  but in my opinion I just don't think these routers can handle it.
    It appears to be a hit and miss affair, and going on the last post from the above link, you might be better off in having the unit replaced under warranty.
    The alternative is wasting a lot of time and effort and impacting your users to get something up and running that in the end is so flaky that you have no confidence in the solution and you are then in a situation where ALL future issues users are facing MIGHT be because of this layer 7 inspection bug/hardware issue etc?
    I would recommend you use the router as a frontline firewall with inbound/outbound acl's (no inspection), and then invest a few $ in getting an ASA dedicated firewall (but that's just me )

  • How to pass a Vector as a Query String to a URL

    is there a way to pass a vector as a query string in a URL in Java. If so how?
    thanks in advance

    Yeah may need some more detail, but if you are trying to pass the Vector object itself from one JSP/Servlet to another, you can simply put the object in one of the scopes like session or request then forward page on.
    e.g.
    FirstServletVector things = new Vector();
    things.add("one thing");
    things.add("another thing");
    request.setAttribute("objThings",things);
    getServletContext().getRequestDispatcher("/NextServlet").forward(request, response);SecondServletVector things = new Vector();
    Object o = request.getAttribute("objThings");
    if(o instanceOf Vector) things = (Vector)o;Hope that helps!!

  • How to sort a object vector by its integer item ?

    hi everybody,
    [there were few topics on this in the forum, but nothing could solve my problem yet. so, please instruct me]
    I have to sort a vector which contains objects, where each object represents, different data types of values,
    ex: {obj1, obj2, obj3, ....}
    obj1---->{String name, int ID, String[] departments}
    i have to sort this vector at three times, once by name, then by ID and then by departments.
    Leaving name and department , first i want to sort the ID of each object and then re-arrange the order of objects in the array according to new order.
    what i did was, copied the vector all objects' ID values to an integer array then i sorted it using selection sort. but now i want to re-arrange the vector, but i still can't. please guide.
    here is the sort i did, and the
    int[] ID = new int[mintomaxID.size()];
              for(int i=0;i<mintomaxID.size();i++)
                   ObjectStore_initialData obj_id = (ObjectStore_initialData)mintomaxID.elementAt(i);
                   ID[i] = obj_id.getID();
              System.out.println("Before sorting array");
              for(int i=0;i<ID.length;i++)
                   System.out.println(ID);     
              System.out.println();
              int i, j, m, mi;
    for (i = 0; i < ID.length - 1; i++) {
    /* find the minimum */
    mi = i;
    for (j = i+1; j < ID.length; j++) {
    if (ID[j] < ID[mi]) {
    mi = j;
    m = ID[mi];
    /* move elements to the right */
    for (j = mi; j > i; j--) {
    ID[j] = ID[j-1];
    ID[i] = m;
    System.out.println("After sorting array");
    for(int y=0;y<ID.length;y++)
                   System.out.println(ID[y]);     
    //*****here is where i need to re-arrange the entire vector by ID.
    I do understand this is some sort of database sort type of a question. but there's no database. it's simply i just want to sort the vector.
    Thank you.

    hi camickr,
    thank you for the detailed reply. but i still don't understand somethings. i tried to read the API and look for the collections.
    i have ObjectStore_initialData class (similar to person class), so do i still have to do a comparable class out of this class ? please simplify that.
    public class ObjectStore_initialData
         String NAME;
         int ID;
         String[] DPART;     
         public ObjectStore_initialData(String name, int id, String[] departments)
              NAME=name;
              ID=id;
              DPART = departments;
    public String getName()//----
              return NAME;
    public String getID()//----
              return ID;
    public String getDpart()//----
              return DPART;
    /*next class is the interface to collect the values from the user and put all of them at once in a vector*/
    //this class is to sort the vector by ID
    public class sorter
       public sorter()
       public static void sortbyID(Vector mintomaxID)
             int[] ID = new int[mintomaxID.size()];
              for(int i=0;i<mintomaxID.size();i++)
                   ObjectStore_initialData obj_id = (ObjectStore_initialData)mintomaxID.elementAt(i);
                   ID[i] = obj_id.getID();
              System.out.println("Before sorting array");
              for(int i=0;i<ID.length;i++)
                   System.out.println(ID);     
              System.out.println();
              int i, j, m, mi;
    for (i = 0; i >< ID.length - 1; i++) {
    /* find the minimum */
    mi = i;
    for (j = i+1; j < ID.length; j++) {
    if (ID[j] < ID[mi]) {
    mi = j;
    m = ID[mi];
    /* move elements to the right */
    for (j = mi; j > i; j--) {
    ID[j] = ID[j-1];
    ID[i] = m;
    System.out.println("After sorting array");
    for(int y=0;y<ID.length;y++)
                   System.out.println(ID[y]);     
    //*****here is where i need to re-arrange the entire vector by ID.
    /*new comparable class */
    public class ObjectStore_initialData implements Comparable
         String NAME;
         int ID;
         String[] DPART;     
         public ObjectStore_initialData(String name, int id, String[] departments)
              NAME=name;
              ID=id;
              DPART = departments;
    public String getName()//----
              return NAME;
    public String getID()//----
              return ID;
    public String getDpart()//----
              return DPART;
    static class IDComparator implements Comparator
              public int compare(Object o1, Object o2)
                   ObjectStore_initialData p1 = (ObjectStore_initialData )o1;
                   ObjectStore_initialData p2 = (ObjectStore_initialData )o2;
                   return p1.getID() - p2.getID();
    /*how can i put the vector here to sort? */
    public sorter()
    public static void sortbyID(Vector mintomaxID)
    int[] ID = new int[mintomaxID.size()];
              for(int i=0;i<mintomaxID.size();i++)
                   ObjectStore_initialData obj_id = (ObjectStore_initialData)mintomaxID.elementAt(i);
                   ID[i] = obj_id.getID();
              System.out.println("Before sorting array");
              for(int i=0;i<ID.length;i++)
                   System.out.println(ID[i]);     
              System.out.println();
              int i, j, m, mi;
    for (i = 0; i >< ID.length - 1; i++) {
    /* find the minimum */
    mi = i;
    for (j = i+1; j < ID.length; j++) {
    if (ID[j] < ID[mi]) {
    mi = j;
    m = ID[mi];
    /* move elements to the right */
    for (j = mi; j > i; j--) {
    ID[j] = ID[j-1];
    ID[i] = m;
    System.out.println("After sorting array");
    for(int y=0;y<ID.length;y++)
                   System.out.println(ID[y]);     
    /* using collections to sort*/
    Collections.sort(mintomaxID, new IDComparator());
    and to check the new order i wanted to print the vector to command line.
    still it doesn't do anything.
    the url you mentioned is good as i see. but how can i implement that in my class ? please instruct and simplify. i know i just repeated the code, i didn't understand to do a comparable class in collections for this class. Please explain where i'm head to and where's my misleading point here.
    Thank you.
    Message was edited by:
    ArchiEnger.711

  • Null Pointer and URL parsing

    I am trying to write a Bookmark reader to go through bookmarks on a windows machine and let you know if your booksmarks are old and not valid.
    Anyway, I am getting a nullpointer and having all sorts of problems. My error comes at line 56. (See below, I will point it out)
    import java.io.*;
    import java.net.HttpURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.Vector;
    * Created by IntelliJ IDEA.
    * User: mlubrano
    * Date: Jan 29, 2003
    * Time: 3:01:20 PM
    * To change this template use Options | File Templates.
    public class LinkMain {
    static String desktopDir = System.getProperty("user.home");
    static String osName = System.getProperty("os.name");
    static String FSEP = System.getProperty("file.separator");
    static String workingDir = new File(System.getProperty("user.dir")).getParent().replace('\\', '/');
    private Vector bookmarkList = new Vector();
    private Vector bookmarkURLs = new Vector();
    public static void main(String[] args) {
    String rootDir = desktopDir + FSEP + "Favorites" + FSEP;
    LinkMain lm = new LinkMain(rootDir);
    //lm.recurseDir(rootDir);
    LinkMain(String root) {
    //LinkHTTPConnect();
    //ReadInBookmarks();
    recurseDir(root);
    ReadInBookmarks();
    //read in boookmarks
    public void ReadInBookmarks() {
    BufferedReader br = null;
    for (int i = 0; i < bookmarkList.size(); i++) {
    try {
    br = new BufferedReader(new FileReader((File)bookmarkList.get(i)));
    while(br.ready()) {
    String line = new String("");
    System.err.println(br.readLine());
    line = br.readLine();
    //Problem is somewhere in here!!!!!!!!!!!!!!!!!!!!!!!!!!!
    if (line.startsWith("URL=")) {
    LinkHTTPConnect(line.substring(4).trim());
    //System.out.println(line.substring(4).trim());
    } catch (FileNotFoundException e) {
    e.printStackTrace(); //To change body of catch statement use Options | File Templates.
    catch (IOException ioe) {
    ioe.printStackTrace();
    public void recurseDir(String startDir) {
    File[] children = new File(startDir).listFiles();
    for (int i = 0; i < children.length; i++) {
    if (children.isDirectory())
    recurseDir(children[i].getAbsolutePath());
    bookmarkList.add(new File(children[i].getAbsolutePath()));
    //System.err.println(children[i].getAbsolutePath());
    //Connect and get results
    public void LinkHTTPConnect(String s) {
    try {
    URL url = new URL(s);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("HEAD");
    conn.connect();
    // GET seems to do a better job of locating it
    if (conn.getResponseCode() != 200) {
    conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("GET");
    conn.connect();
    if (conn.getResponseCode() == 200) {
    System.out.println("ok");
    //System.out.println(desktopDir);
    } else
    System.out.println("not found");
    } catch (MalformedURLException e) {
    System.out.println(e);
    } catch (IOException e) {
    System.out.println(e);
    //Print Results in some format

    Oops....
    Well it is not looping right... It seems to be looping the right # of times, but not moving on to the next file...
    The idea is that is looks through your favorites folder and check to make sure that url is valid.. if you run this..
    import java.io.*;
    import java.net.HttpURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.Vector;
    * Created by IntelliJ IDEA.
    * User: mlubrano
    * Date: Jan 29, 2003
    * Time: 3:01:20 PM
    * To change this template use Options | File Templates.
    public class LinkMain {
      //C:\Documents and Settings\mlubrano
      static String desktopDir = System.getProperty("user.home");
      static String osName = System.getProperty("os.name");
      static String FSEP = System.getProperty("file.separator");
      static String workingDir = new File(System.getProperty("user.dir")).getParent().replace('\\', '/');
      private Vector bookmarkList = new Vector();
      private Vector bookmarkURLs = new Vector();
      public static void main(String[] args) {
        String rootDir = desktopDir + FSEP + "Favorites" + FSEP;
        LinkMain lm = new LinkMain(rootDir);
        //lm.recurseDir(rootDir);
      LinkMain(String root) {
        //LinkHTTPConnect();
        //ReadInBookmarks();
        recurseDir(root);
        ReadInBookmarks();
      //read in boookmarks
      public void ReadInBookmarks() {
        BufferedReader br = null;
        for (int i = 0; i < bookmarkList.size(); i++) {
          try {
            br = new BufferedReader(new FileReader((File) bookmarkList.get(i)));
            while (br.ready()) {
              String line = new String("");
              System.err.println(br.readLine());
              line = br.readLine();
              while (line != null) {
                if (line.startsWith("URL=") && line != null) {
                  LinkHTTPConnect(line.substring(4).trim());
                  System.out.println(line.substring(4).trim());
          } catch (FileNotFoundException e) {
            e.printStackTrace();  //To change body of catch statement use Options | File Templates.
          } catch (IOException ioe) {
            ioe.printStackTrace();
      public void recurseDir(String startDir) {
        File[] children = new File(startDir).listFiles();
        for (int i = 0; i < children.length; i++) {
          if (children.isDirectory())
    recurseDir(children[i].getAbsolutePath());
    bookmarkList.add(new File(children[i].getAbsolutePath()));
    //System.err.println(children[i].getAbsolutePath());
    //Connect and get results
    public void LinkHTTPConnect(String s) {
    try {
    URL url = new URL(s);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("HEAD");
    conn.connect();
    // GET seems to do a better job of locating it
    if (conn.getResponseCode() != 200) {
    conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("GET");
    conn.connect();
    if (conn.getResponseCode() == 200) {
    System.out.println("ok");
    //System.out.println(desktopDir);
    } else
    System.out.println("not found");
    } catch (MalformedURLException e) {
    System.out.println(e);
    } catch (IOException e) {
    System.out.println(e);
    //Print Results in some format
    It loops through the first file it finds x number of times (x being the total number of files you have)
    Thx,
    Usul

  • How to pass a form value  as a url parameter??

    I have following form and I want to pass the selected value of the drop down choice in as one of the parameter in the URL. How can I do that ??
    something like proposalid that I have done in the url, I want to pass the selected value of the variable doc_id, when I click the Link button
    <form name = "link" method="POST" enctype="multipart/form-data" action="<%= request.getScheme() %>://<%= request.getServerName() %>/webAppCore/common/add_doc.jsp">
    <table>
         <tr> <td class="tableContent"> Doc Identifier: </td>
    <td class="tableContent"> <SELECT name="doc_id">
    <%
         Vector v = iddata.getDocumentIdList(tabName);
         //out.println(v);
         if (v != null && v.size() > 0) {
              for (int i = 0; i < v.size(); i++) {
              Hashtable hash = (Hashtable) v.elementAt(i);
    %>
    <OPTION selected name="id " value="<%=(String)hash.get("DOCUMENT_ID")%>"> <%=(String)hash.get("DOCUMENT_NAME")%></OPTION>
    <% } } else {%>
         <OPTION selected name="id " value="test"> No DocIDs</OPTION>
    <%}%>
    <tr> <td colspan = "2">
         <table border="1" width="200">
              <tr> <td> <input type="text" name="link_file" size="30" value=""/></td><td> <INPUT TYPE=button VALUE="Link..." onClick="window.open('<%= request.getScheme() %>://<%= request.getServerName() %>/webAppCore/common/link.jsp?proposalid=<%=proposalID>','mywindow','toolbar=no,location=no,directories=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=400,height=300,left=20,top=20');"></td> </tr>
              <tr> <td colspan = "2">
                   To Create Links: <br>
                   * Select Doc Identifier
                   * Click on Link...to select file within eFile. <br>
                   * Click Add to create the Link <br>
              </td> </tr>
         </table>
         </tr>

    if - in your form declaration - you change your method to GET from POST, it will append the form data onto the URL string instead of putting it in the request header. For instance, if you have a form with an input called THE_INPUT, and you submit to a servlet (or script of some kind or whatever) when the value of that text box is "foo", the URL will be:
    http://www.yourdomain.com/yourservlet?THE_INPUT=foo
    But, if you use the POST method, the URL will just be:
    http://www.yourdomain.com/yourservlet
    Is that what you meant?

Maybe you are looking for

  • Add a hyperlink to another document? CS4

    Hi, How would one add a hyperlink to a document that refers to another document? The basic is: myDoc.hyperlinks.add(myHyperlinkTextSource, myHyperlinkTextDestination); How do I get "myHyperlinkTextDestination" if it exists in another, unopened InDesi

  • Hard coded values in ADF 11g

    i want to insert hard coded values through ADF form.. kindly help me in this Thanks in Advance VL Naidu

  • Log for Table changes

    Hi Experts, Is there any standard table in XI  that maintains the log  if I Changes some enttries in my custom table? Thanks Sugata B

  • Swf-fla question

    i made a fla a while back with a little animated navigational aid, which because my scripting skills are so poor, was quite tedious to program. now i need to edit it but i've lost the fla. can flash convert the swf back into a fla? any suggestions? t

  • How to transfer Iphoto library to ipad

    How can I transfer selected albums from my Macbook Pro to my ipad?  I had someone do this for me on my iphone and I have 2000 duplicates... I purchased the IPHoto Library Manager and have tried to put all the duplicates into a duplicate file.  Now I