Modify the source code for the <s:a> tag

Source: Internet
Author: User
Tags tld

let the page call this tag is not struts2, but the system of their own copy. Label with the same name as the package.

A direct click will enter the corresponding TLD file.

or how to find the TLD file from inside the jar package.

finding TLD files is useless, the key is to change the corresponding Java source code.

ctrl+shift+t Find the corresponding source code.

Find Source

Create a new package name and class name with the same source code

so the sub-classpath there will be exactly the same two classes, and finally the system calls which class is to see who was loaded first, because the class bytecode loaded only once , so who first loaded after the fixed unchanged. So first find who to use WHO. And classpath below is the priority loading code, can not find out to go to Lib to find the jar package to see if there is no class, that is, after creating a new class, the system will automatically use their own new this.

class source to find not doendtag this class, then in the parent class, my new class to rewrite Doendtag to implement their own functions.

@Overridepublic int Doendtag () throws Jspexception {//Gets the user who is currently logged on, username = (user) pagecontext.getsession (). getattribute ("User"), if (user = = null) {throw new RuntimeException ("No login user! ");} Gets the required permission URL (in the Action property value but needs to be processed) String Privurl = "/" + action;//determines whether to display the hyperlink if (User.hasprivilegebyurl (Privurl)) { return Super.doendtag (); Output <a> label, and continue executing the JSP code after this label} else {return bodytagsupport.eval_page;//No output <a> tags, continue executing the JSP code following this label}}




Modify the source code for the <s:a> tag

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.