@WebServlet配置initParams属性

  • Post author:
  • Post category:其他


@WebServlet(urlPatterns = { "/hello.view" }, loadOnStartup = 1, initParams = { @WebInitParam(name = "Site :", value = "http://roseindia.net"),
	@WebInitParam(name = "Rose", value = "India", description = "detail-info") })
public class ITSMServiceServlet extends HttpServlet {

	private static final long serialVersionUID = -5767625680763237936L;

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		String roseFrom = this.getInitParameter("Rose");
		PrintWriter out = resp.getWriter();
		// out.println("<a href=\"javascript:void(0)\" οnclick=\"if(true){alert(true)}else{alert(\"dont know\")}\">" + roseFrom + "</a>");

	}

}





initParams = { @WebInitParam(name = “Site :”, value = “http://roseindia.net”),@WebInitParam(name = “Rose”, value = “India”, description = “detail-info”) }