<%--
Document : success
Created on : Dec 15, 2008, 4:08:53 AM
Author : eswar@vaannila.com
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function showImage(value){
var img =document.getElementById("img");
switch(value){
case "t1":
img.src = "1.jpg";
break;
case "t2":
img.src = "2.jpg";
break;
case "t3":
img.src = "3.jpg";
break;
}
//ajax(value)
$.ajax({
url: "http://localhost:8888/discuz_ucenter_api_for_java/Executer.do",
success: function(data){
alert("成功 "+data+" !");
},
data: "timeId="+value,
error:function(){
alert("error");
}
});
}
</script>
</head>
<body>
<h1>Login Success. Welcome <bean:write name="LoginForm" property="userName"></bean:write></h1>
<html:select name="LoginForm" property="timeId" onchange="showImage(this.value)">
<!--mtypelist为request中设置的属性值 labelProperty="label" property="value"固定写法-->
<html:options collection="mtypelist" labelProperty="label" property="value" />
</html:select>
<img width="50" alt="" src="" name="img" height="50">
</body>
</html>
-------------------------------------
package com.vaannila;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class ExecuterAction extends Action{
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
System.out.println("ExecuterAction.execute()");
String timeId = request.getParameter("timeId");
if("".equals(timeId)){
}
response.getWriter().print("sdfsdafdsaf"+timeId);
return super.execute(mapping, form, request, response);
}
private String getC(){
// db operator
return "C";
}
}
---------------------------------
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.vaannila;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.LabelValueBean;
import org.apache.struts.util.MessageResources;
/**
*
* @author eswar@vaannila.com
*/
public class LoginAction extends org.apache.struts.action.Action {
/* forward name="success" path="" */
private final static String SUCCESS = "success";
private final static String FAILURE = "failure";
/**
* This is the action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param form The optional ActionForm bean for this request.
* @param request The HTTP Request we are processing.
* @param response The HTTP Response we are processing.
* @throws java.lang.Exception
* @return
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
LoginForm loginForm = (LoginForm) form;
MessageResources messageResources = getResources(request);
String s1 = messageResources.getMessage("t");
String[] strList = s1.split(",");
List<LabelValueBean> valueBeans = new ArrayList<LabelValueBean>();
for (String key : strList) {
System.out.println("key : "+key+" value : "+messageResources.getMessage(key));
valueBeans.add(new LabelValueBean(messageResources.getMessage(key),key));
}
request.setAttribute("mtypelist", valueBeans);
if (loginForm.getUserName().equals(loginForm.getPassword())) {
return mapping.findForward(SUCCESS);
} else {
return mapping.findForward(FAILURE);
}
}
}
分享到:
相关推荐
而"Success"则直译为成功,可能象征着项目、应用或网页的上线、发布或功能实现。 描述中的"success.html file to all world !"进一步强调了"success.html"文件的重要性。在网页开发中,"success.html"可能是一个...
另外,从“ThinkPHP框架 的success方法_为什么我这么写显示出来的是一串json数据.url”这个文件名来看,你可能在尝试访问某个URL,而这个URL对应的操作导致了`success`方法的调用。在ThinkPHP中,URL路由和控制器...
1.情况描述:ajax发送成功,后台也成功响应请求,并返回了json数据,通过chrome监听请求也可以看到响应的json数据,但是就是不进success方法,反而跑到error方法中了 前端: $.ajax({ type : get, data : {'dbId'...
jquery中ajax请求后台数据成功后既不执行success也不执行error,此外系统报错:Uncaught SyntaxError: Unexpected identifier at Object.success,但后台能够返回数据,原代码如下: var source=[]; $.ajax({ ...
《Q Skills for Success Level 3 Listening and Speaking》是牛津大学出版社出版的一套英语学习教材,专门针对提高学生的听力和口语技能。该教材是“Q Skills”系列的一部分,旨在为中级水平的英语学习者提供全面的...
标题中所提到的“Q Skills for Success Level 2 Listening and Speaking.pdf”指向的是一份专门针对英语学习者设计的教材,主要针对听力和口语技能提升的第二级别。这类教材通常由专业的英语教学机构或出版社出版,...
"This is not just an important but an imperative project: to approach the problem of randomness and success using the state of the art scientific arsenal we have. Barabasi is the person." --Nassim ...
"Laravel开发-success"这个标题暗示了我们讨论的是在使用Laravel进行项目开发时,某个具体操作或功能实现成功的过程。描述中的“打印出包裹的成功”可能是指在Laravel应用中实现了某种消息提示系统,例如当一个操作...
标题中的“向上走势图Success成功象征简洁商务ppt模板.rar”表明这是一个设计用于商务演示的PPT模板,其中包含“向上走势图”这一元素,该元素通常用来表示业务增长、业绩提升或发展趋势的良好态势。"Success"一词...
CheckMemFillTestParams ->pStartAddrStr = ShellCommandLineGetValue( Package, L"-s" ) ->StartAddr = ParseHexDecStr( pStartAddrStr ) ->pLengthStr = ShellCommandLineGetValue( ...->Retcode = SHELL_SUCCESS ;
在本资源中,我们得到了一组以“success”为主题的3D立体球体PowerPoint小插图。这些素材设计独特,能够为你的演示文稿增添专业且引人注目的元素,尤其适用于那些想要强调成功、目标达成或者积极进取的场合。下面...
然而,在实际应用中,开发者可能会遇到一些问题,如回调函数总是进入error或success状态,这通常与错误处理、请求状态、服务器响应以及代码实现有关。 首先,我们来详细了解一下`ajaxFileUpload`。这是一个基于...
标题《Q Skills for Success Level 2 Reading and Writing》所指的是一个英语学习的教材,属于“Q Skills for Success”系列。该系列教材强调的是提升学习者的阅读与写作技能。从标题可以推断出,这份教材是专门针对...
Achieve PMP Exam Success—A Concise Study Guide for the Busy Project Manager, 4th Edition
标题《Q Skills for Success Level 3 Reading and Writing.pdf》和描述中的《Q Skills for Success Level 3 Reading and Writing.pdf!》指的是一本专门针对英语学习者,尤其是希望提高阅读和写作技能的中级学习者的...
10 key academic skills for TOEFL IBT success 10 key academic skills for TOEFL IBT success 10 key academic skills for TOEFL IBT success 10 key academic skills for TOEFL IBT success
IELTS_to_Success文本IELTS_to_Success文本IELTS_to_Success文本