SSH Common Permissions Design four: How to get KKK inside the URL

Source: Internet
Author: User

One, as shown:

Second, modify the original code:
Modify the content in the Doendtag function

* * $Id: Anchortag.java 768855 2009-04-27 02:09:35z WESW $ * * Licensed to the Apache Software Foundation (ASF) under  One * or more contributor license agreements.  The NOTICE file * Distributed with this work for additional information * regarding copyright. The ASF licenses this file * to you under the Apache License, Version 2.0 (The * "License");  You are not to use this file, except in compliance * with the License. Obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * unless required by Applica Ble or agreed to in writing, * software distributed under the License's distributed on ' an * ' as is ' basis, without  Warranties or CONDITIONS of any * KIND, either express OR implied.
 The License for the * Specific language governing permissions and limitations * under the License.

* * Package org.apache.struts2.views.jsp.ui;
Import Javax.servlet.http.HttpServletRequest; Import Javax.servlet.http.HttpServletResponSe

Import javax.servlet.jsp.JspException;
Import Org.apache.struts2.components.Anchor;
Import org.apache.struts2.components.Component;
Import Cn.oppo.oa.domain.User;

Import Com.opensymphony.xwork2.util.ValueStack;  /** * @see Anchor */public class Anchortag extends Abstractclosingtag {private static final long Serialversionuid

    = -1034616578492431113l;
    protected String href;
    protected String includeparams;
    protected String Scheme;
    protected String Action;
    protected String namespace;
    protected String method;
    protected String encode;
    protected String Includecontext;
    protected String Escapeamp;
    protected String Portletmode;
    protected String WindowState;
    protected String Portleturltype;
    protected String Anchor;

    protected String Forceaddschemehostandport; @Override public int Doendtag () throws Jspexception {//Current users user = (user) Pagecontext.getsessio

        N (). getattribute ("user"); The current URL,If there is a parameter, remove the trailing parameter string privilegeurl = action;
        int pos = Privilegeurl.indexof ("?");
        if (pos >-1) {Privilegeurl = privilegeurl.substring (0, POS);
        } if (User.hasprivilegebyurl (Privilegeurl)) {return Super.doendtag ()///////////////////////////// Onent Getbean (Valuestack stack, httpservletrequest req, httpservletresponse Res) {return new Anchor (Stack, req, r
    ES);

        } protected void Populateparams () {super.populateparams ();
        Anchor tag = (anchor) component;
        tag.sethref (HREF);
        Tag.setincludeparams (Includeparams);
        Tag.setscheme (scheme);
        Tag.setvalue (value);
        Tag.setmethod (method);
        Tag.setnamespace (namespace);
        Tag.setaction (action);
        Tag.setportletmode (Portletmode); Tag.setportleturltype (Portleturltype);
        Tag.setwindowstate (WindowState);

        Tag.setanchor (anchor);
        if (encode!= null) {Tag.setencode (boolean.valueof (encode). Booleanvalue ()); 
        } if (Includecontext!= null) {Tag.setincludecontext (boolean.valueof (Includecontext). Booleanvalue ());
        } if (Escapeamp!= null) {Tag.setescapeamp (boolean.valueof (Escapeamp). Booleanvalue ()); } if (Forceaddschemehostandport!= null) {Tag.setforceaddschemehostandport (boolean.valueof forcea
        Ddschemehostandport). Booleanvalue ());
    } public void Sethref (String href) {this.href = href;
    } public void Setencode (String encode) {this.encode = encode;
    } public void Setincludecontext (String includecontext) {this.includecontext = Includecontext;
    } public void Setescapeamp (String escapeamp) {this.escapeamp = Escapeamp; public void Setincludeparams (String naMe) {includeparams = name;
    The public void Setaction (String action) {this.action = action;
    } public void Setnamespace (String namespace) {this.namespace = namespace;
    public void Setmethod (String method) {This.method = method;
    public void SetScheme (String scheme) {this.scheme = scheme;
    public void SetValue (String value) {this.value = value;
    } public void Setportletmode (String portletmode) {this.portletmode = Portletmode;
    } public void Setportleturltype (String portleturltype) {this.portleturltype = Portleturltype;
    } public void Setwindowstate (String windowstate) {this.windowstate = WindowState;
    public void Setanchor (String anchor) {this.anchor = anchor;  } public void Setforceaddschemehostandport (String forceaddschemehostandport) {This.forceaddschemehostandport
    = Forceaddschemehostandport; }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.