JSP/JS Read the properties file Method __js

Source: Internet
Author: User

Read the properties file in the JSP and set the value to the JS variable:

Web_stderr.properties file contents: [XHTML] view plain copy common.username.error.null = username can is not null.   Common.username.error.invalid = Username is invalid.   Common.password.error.null = password can not bu null.   Common.password.error.invalid = password is invalid.   Common.login.error.user = The user can not been stored or password is wrong.   Common.request.parameter.error = Request parameter error.   Common.function.title.null = the tilte of function or is null. Common.session.timeout = The session has already expired. Please login again.

1. The JS variable for storing the content of the properties file (common-checkmessage.jsp):[XHTML] View plain copy <%@ page language= "java"  contenttype= "Text/html; charset=utf-8"         pageencoding= "UTF-8"  import= "Java.util.ResourceBundle"%>   < ! doctype html public  "-//w3c//dtd html 4.01 transitional//en"   "http:// Www.w3.org/TR/html4/loose.dtd ">  

You can use these variables in your JSP and JS files as long as you include the JSP file in other JSPs.

Related Article

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.