Web基礎知識ノート

7095 ワード


    web        
webapps            hello
         WEB-INF     html  
WEB-INF             class          lib     web.xml
  tomcat   


tomcat      
tomcat confg    server.xml


     //              host    
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

       <Host/>

tomcat web.xml listing   true    webapps        

servlet     :

servlet    
          
         web.xml          servletname 
  servlet-name    servlet-class
  servlet
  init   init     init(servletConfig config)  config.getInitParams("") web.xml         
-  service   service         doget doPost  
  doxx  
    destroy  

web.xml load-on-startup   0                servlet


    
html    utf-8
tomcat config/server.xml  <Connector URIEncoding="UTF-8"/>(get             )
servlet      request.setCharacterEncoding("UTF-8")(post         )







   String str = "hello";
     out.println(str+"
"
); %> str%> out jsp tomcat servlet tomcat work java jsp java import jsp response.sendRedirct(" ") response retrun( ) :<jsp:forward page="03.jsp"> <jsp:value:="gac" name="user"/> </jsp> ( ) ,req.getContextPath();// ( )@include file="/inc/top.jsp"%> , , ( )<jsp:include page="/inc/top.jsp"></jsp:include> html , request.setAttribute(String,Object) request.getAttribute(String name) jsp servlet Atrribute pageContext(Servlet ) request(HttpRequest) session(HttpSession) .application(ServletContext) pageContext( , ) request , session session application : pageContext request session session application filter // post public class CharEncodingFilter implements Filter { String encoding; @Override public void init(FilterConfig filterConfig) throws ServletException { encoding = filterConfig.getInitParameter("encoding");//filter servlet } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { System.out.println("before fileter"); servletRequest.setCharacterEncoding(encoding); filterChain.doFilter(servletRequest,servletResponse);// request response System.out.println("end filter"); } @Override public void destroy() { } }
el     ${username}      pageContext  username,    
   request   ,       session   username,session       application