2017년 10월 27일 금요일

[jQuery] How to add and remove 'disabled' attribute.


$('#btn').attr('disabled', '');
$('#btn').attr('disabled', 'true');
$('#btn').attr('disabled', 'false');
$('#btn').attr('disabled', 'disabled');

Those are the same.

$('#btn').removeAttr('disabled');

This is how you remove the attribute.

[jsp]How to include 'header.jsp' and 'footer.jsp' in all the jsp files in easy way using web.xml

It might be wrong... But It is like this way.
Go to WebContent > WEB-INF and source like this.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>NeverIn</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>

  <jsp-config>
  <jsp-property-group>
  <url-pattern>/board/*</url-pattern>
  <include-prelude>/board/header.jsp</include-prelude>
  <include-coda></include-coda>
  </jsp-property-group>
  </jsp-config>
</web-app>

2017년 10월 19일 목요일

[Servlet] How servlet looks like, what it contains its inside.

Servlet has Context Path(ex. @WebServlet("/file.do")) above class name and it consists of two parts - doGet(), doPost()

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    if( ){
    } else if( ){
    } else if( ){
    } else ...
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    if( ){
    } else if( ){
    } else if( ){
    } else ...
}

2017년 10월 17일 화요일

Servlet - > Ajax 한글 깨짐 해결 방법

Servlet에
response.setContentType("text/text;charset=euc-kr");

Ajax에
dataType: 'Text'

추가