??xml version="1.0" encoding="utf-8" standalone="yes"?>视频一区在线免费看,国产一级成人av,国产精品一区二区久久精品http://www.aygfsteel.com/wuxufeng8080/category/18789.html弱水三千Q只取一瓢,便能解Q佛法无边,奉行一法,便能得益?/description>zh-cnTue, 24 Nov 2009 08:47:57 GMTTue, 24 Nov 2009 08:47:57 GMT60struts2 表单属性映的问题http://www.aygfsteel.com/wuxufeng8080/archive/2009/08/04/289788.html风h?/dc:creator>风h?/author>Tue, 04 Aug 2009 07:52:00 GMThttp://www.aygfsteel.com/wuxufeng8080/archive/2009/08/04/289788.htmlhttp://www.aygfsteel.com/wuxufeng8080/comments/289788.htmlhttp://www.aygfsteel.com/wuxufeng8080/archive/2009/08/04/289788.html#Feedback0http://www.aygfsteel.com/wuxufeng8080/comments/commentRss/289788.htmlhttp://www.aygfsteel.com/wuxufeng8080/services/trackbacks/289788.html
使用C西的时候或多或会出现q样那样的问题,q导致很多h不愿意更换原来的框架Q一换又要学一个大堆东西,处理一大堆异常。但是我们这些做开发的Q不学习使用新的 东西Q就会被淘汰。这个行业的悲哀啊,当初也不知道怎么选择了这个行业?br />
以上是题外话?br />
表单映射Q在2里面有两U方式,一个事modelDriverQ直接映到model里面?br /> 另一U方式就是通过属性来影射Q通过getter和setterҎ来获取和讄倹{?br />
现在出现问题的在W二U情况,讑ր后Q传到页面,面没有得到|q个不知道什么缘故,感觉有可能是面转发的问题。这个还要好好看看资料研I一下?br />
Q)

//==========================================================================
2009-11-17
好久以前的问题了Q今天终于有了答案,原来都是ValueStack惹的。其实也怪自己,一直没有空把struts2的原理好好的看看Q还以ؓ跟以前的东西一样呢?br />
问题是这LQ在action里定义了属性之后,数据都是存在ValueStack里面的。如果你直接使用tag取的话就没有问题。但是你想通过java代码Q用request取的话,q样是取不出来的?br />
今天l于发现了这个问题的原因?br /> q些属性可以通过request取,但是首先要去的ValueStackQ然后从ValueStack里面把这个值取出来?br /> 如:
ValueStack vs = request.getAttribute(struts.valueStack);
然后Ҏ属性名Uͼ从vs中获取这个对象倹{?br /> vs.find("value");

q样可以把数据取出来通过java代码来操作了。否则只能用struts2自带的tag来运行?br />
q个是今天的一大收莗?

]]>
struts2 -- Action Configuration (译)http://www.aygfsteel.com/wuxufeng8080/archive/2007/07/06/128496.html风h?/dc:creator>风h?/author>Fri, 06 Jul 2007 01:51:00 GMThttp://www.aygfsteel.com/wuxufeng8080/archive/2007/07/06/128496.htmlhttp://www.aygfsteel.com/wuxufeng8080/comments/128496.htmlhttp://www.aygfsteel.com/wuxufeng8080/archive/2007/07/06/128496.html#Feedback0http://www.aygfsteel.com/wuxufeng8080/comments/commentRss/128496.htmlhttp://www.aygfsteel.com/wuxufeng8080/services/trackbacks/128496.htmlAction Mappings
   Action映射可以指定一lresultcdQ一l异常处理,一个拦截器堆。但是只有name属性是必须的。其他的属性都可以通过package范围提供?br>一个登录action
<action name="Logon" class="tutorial.Logon">
  
<result type="redirect-action">Menu</result>
  
<result name="input">/tutorial/Logon.jsp</result>
</action>
Action Names
       在web应用中,name属性是用以匚w览器请求\径的一部分Q或其他HTTP客户端)。framework会丢掉主机名、应用名和扩展名Qƈ匚w中间部分。所以,一?tt>http://www.planetstruts.org/struts2-mailreader/Welcome.do 会map?Welcome action?br>

在应用中Q这个到action的链接一般是由struts tag来自动生的。这个tag通过名字来指定actionQƈ且这个framework会加上默认扩展名和其他一些必?的东ѝ?/p>

<s:form action="Hello">
    
<s:textfield label="Please enter your name" name="name"/>
    
<s:submit/>
</s:form>
Wildcard Method
      多数情况Q一laction mapping会有一个共享模式。比如,你所有的 edit actions都一?#8220;edit”打头Q?q调用这个action cȝeditҎ。delete actions也是q个模式Q但是调用的是deleteҎ?br>

q种情况Q你可以通过通配W的方式来定义一ơaction mappingQ远胜于定义每一个action mapping.

<action name="*Crud" class="example.Crud" method="{1}">

q里Q一?editCrud"的action会调用Crud Actioncd例的editҎ。同P一?deleteCrud"的action会调用deleteҎ?br>另一U常用的Ҏ是后缀Ҏ名,通过讄"!", "_", 或者其他一些特D字W?br>

  • "action=Crud_input"
  • "action=Crud_delete"

To use a postfix wildcard, just move the asterisk and add an underscore.

<action name="Crud_*" class="example.Crud" method="{1}">



]]>
struts2--Result Configurationhttp://www.aygfsteel.com/wuxufeng8080/archive/2007/06/27/126530.html风h?/dc:creator>风h?/author>Wed, 27 Jun 2007 03:29:00 GMThttp://www.aygfsteel.com/wuxufeng8080/archive/2007/06/27/126530.htmlhttp://www.aygfsteel.com/wuxufeng8080/comments/126530.htmlhttp://www.aygfsteel.com/wuxufeng8080/archive/2007/06/27/126530.html#Feedback0http://www.aygfsteel.com/wuxufeng8080/comments/commentRss/126530.htmlhttp://www.aygfsteel.com/wuxufeng8080/services/trackbacks/126530.html 

当ActioncL法完成,会返回一个字W串Q这个字W串值用来选择result元素。一个action可以映射Cl不同描q的l果。标准的result是在ActionSupport q个基类中定义的?/p>

String SUCCESS = "success";
String NONE    
= "none";
String ERROR   
= "error";
String INPUT   
= "input";
String LOGIN   
= "login";

当然Qap可以自定义其他的result标记来match特定的情c?/p>

Result Elements
result有默认D定,如果不指定属性,则用success和dispatch来执行这个result

<action name="Hello">
  
<result>/hello/Result.jsp</result>
  
<result name="error">/hello/Error.jsp</result>
  
<result name="input">/hello/Input.jsp</result>
</action>


如上昄Q默认情况下Q如果返回值是successQ则执行W一个resultQ其他的情况执行下面的匹配的result

Global Results

大部分时候,results都是嵌套在antion元素中。但是很多results会应用到不同的action。在一个安全的应用中,一个client试图讉K一个没有认证的面Q那么很多action可能都需要去讉K logon result?br>如果action需要共享resultQ?一lglobal result可以为每一个package定义。框枉先查询嵌套在action中的本地resultQ如果本地result没有W合的,则在global result中查询?/p>

<global-results>
  
<result name="error">/Error.jsp</result>
  
<result name="invalid.token">/Error.jsp</result>
  
<result name="login" type="redirect-action">Logon!input</result>
</global-results>

 

Dynamic Results
A result may not be known until execution time. Consider the implementation of a state-machine-based execution flow; the next state might depend on any combination of form input elements, session attributes, user roles, moon phase, etc. In other words, determining the next action, input page, etc. may not be known at configuration time.

Result values may be retrieved from its corresponding Action implementation by using EL expressions that access the Action's properties, just like the Struts 2 tag libraries. So given the following Action fragment:
一个action有时候不可能在执行前q道它的actionQ这U情况就需要通过动态result来实现?/p>

 首先定义一个属性,来存放这个|然后在流E定义中通过EL表达式来取得q个属性倹{这样就可以通过E序动态指定需要{发的倹{?/p>

private String nextAction;

   public String getNextAction() {
       
return nextAction;
   }

you might define a result like this:
<action name="fragment" class="FragmentAction">
        
<result name="next" type="redirect-action">${nextAction}</result>
</action>
If a FragmentAction method returns "next" the actual value of that result will be whatever is in FragmentAction's nextAction property. So nextAction may be computed based on whatever state information necessary then passed at runtime to "next"'s redirect-action.

ȝQstruts2对于result提供了很多很灉|的设|方法,用户可以使用相应的方法处理特定的逻辑。对于各U情况,总能扑և相应的方法来出来?br>


]]>
Struts2 flow 配置http://www.aygfsteel.com/wuxufeng8080/archive/2007/05/10/116455.html风h?/dc:creator>风h?/author>Thu, 10 May 2007 05:12:00 GMThttp://www.aygfsteel.com/wuxufeng8080/archive/2007/05/10/116455.htmlhttp://www.aygfsteel.com/wuxufeng8080/comments/116455.htmlhttp://www.aygfsteel.com/wuxufeng8080/archive/2007/05/10/116455.html#Feedback0http://www.aygfsteel.com/wuxufeng8080/comments/commentRss/116455.htmlhttp://www.aygfsteel.com/wuxufeng8080/services/trackbacks/116455.html1、默认配|?br>2、别?br>3、返回结?

]]>
Struts2--form设计http://www.aygfsteel.com/wuxufeng8080/archive/2007/05/09/116132.html风h?/dc:creator>风h?/author>Wed, 09 May 2007 03:13:00 GMThttp://www.aygfsteel.com/wuxufeng8080/archive/2007/05/09/116132.htmlhttp://www.aygfsteel.com/wuxufeng8080/comments/116132.htmlhttp://www.aygfsteel.com/wuxufeng8080/archive/2007/05/09/116132.html#Feedback0http://www.aygfsteel.com/wuxufeng8080/comments/commentRss/116132.htmlhttp://www.aygfsteel.com/wuxufeng8080/services/trackbacks/116132.html1、form?theme属?/strong>

你可以在<s:form>加上theme="simple"属性,然后自已布局form的输出。如:
<s:form action="Login" method="POST" theme="simple">
<table>
<tr>
<td>
User name: <s:textfield name="name" label="User name"/>
</td>
<td>
Password: <s:password name="password" label="Password"/>
</td>
</tr>
</table>
</s:form>

]]>
Struts 2.0 hhttp://www.aygfsteel.com/wuxufeng8080/archive/2006/12/29/90656.html风h?/dc:creator>风h?/author>Fri, 29 Dec 2006 02:09:00 GMThttp://www.aygfsteel.com/wuxufeng8080/archive/2006/12/29/90656.htmlhttp://www.aygfsteel.com/wuxufeng8080/comments/90656.htmlhttp://www.aygfsteel.com/wuxufeng8080/archive/2006/12/29/90656.html#Feedback0http://www.aygfsteel.com/wuxufeng8080/comments/commentRss/90656.htmlhttp://www.aygfsteel.com/wuxufeng8080/services/trackbacks/90656.html参?http://www.aygfsteel.com/max/category/16130.html

1、添加struts2的jar包,struts2-core-2.x.x.jar, struts2-api-2.x.x.jar (struts2-all-2.x.x.jar卛_Q其他的struts2的插件包已经包含在里??br>   如添加其他的插g包,可能会出现文仉复,具体可以看异怿息?br>   或者不要加all包,而用插件包Q可以减包的大?br>2、修改web.xml

 1 <? xml version="1.0" encoding="UTF-8" ?>
 2 < web-app  version ="2.4"  
 3  xmlns ="http://java.sun.com/xml/ns/j2ee"  
 4  xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"  
 5  xsi:schemaLocation ="http://java.sun.com/xml/ns/j2ee 
 6  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
 7   < display-name > Struts2 Hello World! </ display-name >   
 8
 9     < filter >
10          < filter-name > Struts2 </ filter-name >
11          < filter-class >
12             org.apache.struts2.dispatcher.FilterDispatcher
13          </ filter-class >
14      </ filter >
15      < filter-mapping >   
16          < filter-name > Struts2 </ filter-name >   
17          < url-pattern > /* </ url-pattern >   
18      </ filter-mapping >   
19 </ web-app >
20


3、在classpath下添加struts.properties文gQ内容如?br>struts.devMode = true
struts.enable.DynamicMethodInvocation = false

4、在classpath下添加struts.xmlQ这个是对应struts1.x里面的struts-config.xml

 1 <! DOCTYPE struts PUBLIC
 2         "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
 3         "http://struts.apache.org/dtds/struts-2.0.dtd" >
 4 < struts >
 5      < package  name ="example"  extends ="struts-default" >
 6          < action  name ="hello"  class ="com.ivo.struts2.HelloWorld"  method ="aliasAction" >
 7              < result > /hello.jsp </ result >
 8          </ action >
 9          < action  name ="Login"  class ="com.ivo.struts2.Login" >
10        < result > /hello.jsp </ result >
11    </ action >
12    < action  name ="LoginX"  class ="com.ivo.struts2.LoginX" >
13        < result > /hello.jsp </ result >
14    </ action >
15      </ package >
16 </ struts >


注意Qstruts2的两个相x仉要放在classpath?/p>

]]>
վ֩ģ壺 | »Ȱ| ̫| ݶ| ƽ| | Ƹ| ɽ| Ǩ| | Ͽ| | | | ǰ| | | | | Ͳ| | μ| | | | ɽ| ̨| ¡| | Ͽ| | ذ| ³ɽ| | żҿ| п| | ؼ| ʩ| | |