<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC

   "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"

   "http://struts.apache.org/dtds/struts-2.3.dtd">

 

<struts>

 

   <constant name="struts.devMode" value="true" />

 

   <package name="myPackage" namespace="/myNamespace" extends="struts-default">

 

      <action name="myAction1" class="servletApi.action.ServletApi_ActionContext">

          <result name="success">/ognl_EL_ServletAPI.jsp</result>

          <!-- 如果action沒有問題,就導往ognl_EL_ServletAPI.jsp -->

      </action>

     

      <action name="myAction2" class="servletApi.action.ServletApi_IoC1_XxxAware">

          <result name="success">/ognl_EL_ServletAPI.jsp</result>

      </action>

     

      <action name="myAction3" class="servletApi.action.ServletApi_IoC2_XxxAware">

          <result name="success">/ognl_EL_ServletAPI.jsp</result>

      </action>

     

      <action name="myAction4" class="servletApi.action.ServletApi_ServletActionContext">

          <result name="success">/ognl_EL_ServletAPI.jsp</result>

      </action>

 

   </package>

 

</struts>




<%@ page contentType="text/html; charset=UTF-8" pageEncoding="Big5"%>

<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>index.jsp</title>

</head>

<body>

   <H2>Struts2Servlet API</H2><OL>

 

 

             <LI><a href="<%=request.getContextPath()%>/myNamespace/myAction1!setValue.action" >ActionContext測試  </a></LI>

             <LI><a href="<%=request.getContextPath()%>/myNamespace/myAction2!setValue.action" >IoC1_XxxAware測試</a></LI>

             <LI><a href="<%=request.getContextPath()%>/myNamespace/myAction3!setValue.action" >IoC2_XxxAware測試</a></LI>

             <LI><a href="<%=request.getContextPath()%>/myNamespace/myAction4!setValue.action" >ServletActionContext</a></LI>

           

</OL>

</body>

</html>




<%@ page contentType="text/html; charset=UTF-8" pageEncoding="Big5"%>

<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>ognl_EL_ServletAPI.jsp</title>

</head>

<body>

   <H2>Struts 2 Servlet API</H2>

   <OL>

 

      <LI><b><font color="blue" size="4">取值測試:(EL)</font></b><br>

          <b>request.userName</b>:        ${requestScope.userName} <br>

          <b>session.userName</b>:        ${sessionScope.userName} <br>

          <b>application.userName</b>: ${applicationScope.userName}<br><br></LI>

 

        

      <LI><b><font color="blue" size="4">取值測試:(OGNL)</font></b><br>

          <b>request.userName</b>: <s:property value="#request.userName" /><br>

          <b>session.userName</b>: <s:property value="#session.userName" /><br>

          <b>application.userName</b>: <s:property   value="#application.userName" /><br></LI>

 

   </OL>

</body>

</html>

 

創作者介紹

學習筆記專區

乙方 發表在 痞客邦 PIXNET 留言(0) 人氣()