action

第一个Struts1步骤

时光总嘲笑我的痴心妄想 提交于 2020-02-27 04:22:57
一.前端 :登陆页面 index.jsp <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> < %@taglib prefix="html" uri=" http://struts.apache.org/tags-html"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> </head> <body> <html:errors/> <form action="loginAction.do" method="post"> 请您登陆,输入用户名和密码 <br> 用户名:<input type="text" name="username"><html:errors property="user.username.null"/><br/>

C#委托的介绍(delegate、Action、Func、predicate)

ε祈祈猫儿з 提交于 2020-02-26 23:04:15
委托是一个类,它定义了方法的类型,使得可以将方法当作另一个方法的参数来进行传递。事件是一种特殊的委托。   1.委托的声明   (1). delegate delegate我们常用到的一种声明    Delegate至少0个参数,至多32个参数,可以无返回值,也可以指定返回值类型。    例:public delegate int MethodtDelegate(int x, int y);表示有两个参数,并返回int型。   (2). Action Action是无返回值的泛型委托。    Action 表示无参,无返回值的委托    Action<int,string> 表示有传入参数int,string无返回值的委托   Action<int,string,bool> 表示有传入参数int,string,bool无返回值的委托 Action<int,int,int,int> 表示有传入4个int型参数,无返回值的委托    Action至少0个参数,至多16个参数,无返回值。    例: public void Test<T>(Action<T> action,T p) { action(p); }   (3). Func    Func是有返回值的泛型委托    Func<int> 表示无参,返回值为int的委托    Func<object,string,int>

How to pass value from <option><select> to form action

隐身守侯 提交于 2020-02-26 11:17:54
问题 I need to pass a value in option select to action where I have agent_id= Can anyone help? <form method="POST" action="index.php?action=contact_agent&agent_id="> <select> <option value="1">Agent Homer</option> <option value="2">Agent Lenny</option> <option value="3">Agent Carl</option> </select> 回答1: You don't have to use jQuery or Javascript. Use the name tag of the select and let the form do it's job. <select name="agent_id" id="agent_id"> 回答2: Like @Shoaib answered, you dont need any jQuery

How to pass value from <option><select> to form action

不羁岁月 提交于 2020-02-26 11:17:47
问题 I need to pass a value in option select to action where I have agent_id= Can anyone help? <form method="POST" action="index.php?action=contact_agent&agent_id="> <select> <option value="1">Agent Homer</option> <option value="2">Agent Lenny</option> <option value="3">Agent Carl</option> </select> 回答1: You don't have to use jQuery or Javascript. Use the name tag of the select and let the form do it's job. <select name="agent_id" id="agent_id"> 回答2: Like @Shoaib answered, you dont need any jQuery

吴裕雄--天生自然轻量级JAVA EE企业应用开发Struts2Sping4Hibernate整合开发学习笔记:配置Action(2)

こ雲淡風輕ζ 提交于 2020-02-25 22:52:23
<?xml version="1.0" encoding="GBK"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <package name="lee" extends="struts-default"> <!-- 使用模式字符串定义Action的name,指定所有以Action结尾的请求, 都可用LoginRegistAction来处理,method属性使用{1}, 这个{1}代表进行模式匹配时第一个*所代替的字符串 --> <action name="*Action" class="org.crazyit.app.action.LoginRegistAction" method="{1}"> <!-- 定义逻辑视图和物理视图之间的映射关系 --> <result name="error">/WEB-INF/content/error.jsp</result> <result>/WEB-INF/content/welcome.jsp</result> </action> <action name="*"> <result>/WEB

Struts2动态方法调用

与世无争的帅哥 提交于 2020-02-25 11:12:28
  动态方法就是一个Action对应多个请求,减少Action的数量 1、指定method属性 <action name="addAction" method="add" class="com.venn.action.HelloWorldAction"> <result>/jsp/add.jsp</result> </action> 2、感叹号(!)方式 (不推荐使用) <action name="HelloWorld" class="com.venn.action.HelloWorldAction"> <result>/jsp/test.jsp</result>   <result name="add">/jsp/add.jsp</result>   <result name="update">/jsp/update.jsp</result> </action>   需要在struts.xml中加入如下常量:     <constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>(加在package标签外面)     调用不同方法使用:      访问execute方法: http://localhost:8080/TestStruts2/HelloWorld.action     

kendo grid column with conditionally chosen action

不羁岁月 提交于 2020-02-24 05:51:04
问题 Here is what I got: columns.Bound(t => t.Id) .Title("") .Template(@<text></text>) .ClientTemplate("<a class=\"k-button\" href='" + Url.Action("Edit", "Controller") + "/#=Id#'>Edit</a>") .Width(110); What I need is to pick a specific controller action depending on type of object bound. (different form for e.g. CarEdit when lets say Type==1 and PlaneEdit when Type==2 ) I've done similar thing using JS recently (to produce ClientTemplate content) but would greatly appreciate solution without

实现MyRedux(三)

两盒软妹~` 提交于 2020-02-22 12:26:27
实现MyRedux系列 实现MyRedux(一) 实现MyRedux(二) 实现MyRedux(三) 现在通过前边两部分,我们实现了一个通用的 createStore : function createStore ( state , stateChanger ) { const listeners = [ ] const subscribe = ( listener ) => listeners . push ( listener ) const getState = ( ) => state const dispatch = ( action ) => { state = stateChanger ( state , action ) // 覆盖原对象 listeners . forEach ( ( listener ) => listener ( ) ) } return { getState , dispatch , subscribe } } 那他怎么用呢? let appState = { title : { text : 'React.js' , color : 'red' , } , content : { text : 'React.js 内容' , color : 'blue' } } function stateChanger ( state , action

asp.net mvc之Url.Action()用法详解

风格不统一 提交于 2020-02-12 08:28:34
Url.Action()方法在asp.net mvc中也是比较常用的方法,其有8种重载方法,每一种重载方法的用法见下表。 Url.Action重载列表 名称 说明 示例 Action(String) 使用指定的操作名称生成操作方法的完全限定 URL @Url.Action("action1") Action(String, Object) 使用指定的操作名称和路由值生成操作方法的完全限定 URL @Url.Action("action1", new {id=1 }),注:第二个参数为Object类型故可以直接new出一个匿名对象,注意和后面的重载方法对比 Action(String, String) 使用指定的操作名称和控制器名称生成操作方法的完全限定 URL @Url.Action("action1","controller1") Action(String, RouteValueDictionary) 为指定的操作名称和路由值生成操作方法的完全限定 URL @Url.Action("action1", new RouteValueDictionary {{"id",1} }),注:第二个参数类型为RouteValueDictionary类型故不可以只是简单的new一个匿名对象 Action(String, String, Object) 使用指定的操作名称

文件上传和下载

*爱你&永不变心* 提交于 2020-02-12 06:36:28
文件上传 文件上传的两个 jar < dependency > < groupId >commons-fileupload</ groupId > < artifactId >commons-fileupload</ artifactId > < version >1.3.1</ version > </ dependency > < dependency > < groupId >commons-io</ groupId > < artifactId >commons-io</ artifactId > < version >2.4</ version > </ dependency > Upload.jsp <%--文件上传--%> < form action= "user/upload" method= "post" enctype= "multipart/form-data" > < input type= "file" name= "upload" />< br > < button type= "submit" > 上传 </ button > </ form > Struts.xml <!--文件上传--> < action name ="upload" class ="cn.xcq.entity.Action1" method ="upload" > <