本文整理汇总了Java中org.apache.struts2.convention.annotation.Result类的典型用法代码示例。如果您正苦于以下问题:Java Result类的具体用法?Java Result怎么用?Java Result使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Result类属于org.apache.struts2.convention.annotation包,在下文中一共展示了Result类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toFifth
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value = "toFifth", results = { @Result(name = "stepFifthUI", location = ViewLocation.View_ROOT
+ "orderstep4.jsp") })
public String toFifth() throws Exception{
//未支付押金订单生成
Mrcodeorder order = null;
if((order=createOrder())!=null){
for(Password p : order.getPasswords()){
String msg = "【码团网】"+p.getContactors().getName()+"您好!您已下单成功,日期:"+p.getEstimatedTime().toString().substring(0,10)+
",房间:"+p.getRoom().getRoomNumber()+"。酒店正为您办理入住手续,至酒店确认本人身份后,凭房间密码"+p.getPassword()+"即可入住。";
System.out.println("message:"+msg);
JSONObject o = JSONObject.fromObject(MessageSend.sendSms(msg, p.getContactors().getPhoneNumber()));
System.out.println("result:"+o);
}
request.setAttribute("msg", "已完成房间入住手续,请至酒店前台核对身份证,并支付押金,即可入住,谢谢!");
}
return "stepFifthUI";
}
示例2: update
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value = "department.update",
results = {@Result(name = "detail", location="department-detail.jsp")}
)
public String update() {
//ok, it might sound a bit redundant, but if we change the
//persistence mechanism to a database, all these
//lines would be necessary.
Department old = CompanyService.instance().findDepartment(department.getId());
old.setName(department.getName());
old.setManager(department.getManager());
department = old;
message = "The department data was updated.";
return "detail";
}
示例3: toRoomManage
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value = "toRoomManage", results = { @Result(name = "toRoomManage", location = ViewLocation.View_ROOT
+ "management.jsp") })
public String toRoomManage() throws Exception{
if(ActionContext.getContext().get("msg")!=null)
request.setAttribute("msg", ActionContext.getContext().get("msg"));
Customer cus = (Customer) session.get("customer");
String phoneNumber = cus.getPhoneNumber();
System.out.println("phoneNumber--" + phoneNumber );
//1、先根据该用户电话号码得到,password对象
Password passwd = passwordService.getPasswordByPhone (phoneNumber);
// if(passwd == null) {
//
// writeStringToResponse("1");
// }
System.out.println("输出Password id--" + passwd.getId());
//2、根据该password对象,得到roomId
Room room = passwd.getRoom();
System.out.println(room.getId());
// 懒加载:System.out.println("获取hotel--" + room.getRoomtype().getHotel().getName());
//3、根据roomId 获取房间类型
//RoomType roomtype = roomService.getRoomTypeByRoomId();
request.setAttribute("customer", cus);
request.setAttribute("roomid", room.getId());
request.setAttribute("roomnumber", room.getRoomNumber());
return "toRoomManage";
}
示例4: toFirst
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value = "toFirst", results = { @Result(name = "stepFirstUI", location = ViewLocation.View_ROOT
+ "orderstep0.jsp") })
public String toFirst() throws Exception{
//跳转至入住第一步,选择日期页面
Customer customer = (Customer)session.get(Const.CUSTOMER);
//获得房间类型
Integer typeId = getIntParameter("typeId", -1);
Integer validCount = grouppurchasevoucherService.getTypeCount(customer, typeId);
dataMap.put("id", typeId);
Roomtype roomtype = roomtypeService.findUniqueByHql("from Roomtype r left join fetch r.hotel where r.id=:id", dataMap);
session.put("roomtype", roomtype); //选择的房间类型
session.put("validCount", validCount); //团购券数量
return "stepFirstUI";
}
示例5: toThird
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value = "toThird", results = { @Result(name = "stepThirdUI", location = ViewLocation.View_ROOT
+ "orderstep2.jsp") })
public String toThird() throws Exception{
//TODO 跳转至第三步,订单展示及确认页面
Customer customer = (Customer)session.get(Const.CUSTOMER);
String ids = getParameter("ids");
List<Room> rooms = roomService.getByIds(ids);
List<Contactors> contactors = contactorsService.getContactorsByCustomerId(customer);
Integer days = (Integer)session.get("days");
Roomtype roomtype = (Roomtype)session.get("roomtype");
//需要使用的团购券,放入session
Integer needVouchers = days*rooms.size();
pageBean.setPageSize(needVouchers);
List<Grouppurchasevoucher> vouchers = grouppurchasevoucherService.getByType(customer, roomtype, pageBean);
session.put("vouchers", vouchers);
request.setAttribute("total", needVouchers*vouchers.get(0).getPrice());
session.put("rooms", rooms);
request.setAttribute("contactors", contactors);
return "stepThirdUI";
}
示例6: toOrder
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value="toOrder", results={@Result(name="orderUI", location=ViewLocation.View_ROOT+
"hotel.jsp")})
public String toOrder() throws Exception{
//TODO 跳转到选择团购券的页面
Customer customer = (Customer)session.get(Const.CUSTOMER);
List<Grouppurchasevoucher> gps = grouppurchasevoucherService.getByCust(customer);
//把数据封装成Map
Map<Roomtype, List<Grouppurchasevoucher>> rgMap = new LinkedHashMap<Roomtype, List<Grouppurchasevoucher>>();
for(Grouppurchasevoucher gp : gps){
if(!rgMap.containsKey(gp.getRoomtype())){
List<Grouppurchasevoucher> grps = new LinkedList<Grouppurchasevoucher>();
rgMap.put(gp.getRoomtype(), grps);
}
rgMap.get(gp.getRoomtype()).add(gp);
}
request.setAttribute("rgMap", rgMap);
return "orderUI";
}
示例7: anno4
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value = "anno4", interceptorRefs = @InterceptorRef("auth"), results = {
@Result(type = "stream", params = { "inputName", "inputStream", "contentDisposition",
"attachment;filename=\"${downloadFileName}\"", "bufferSize", "512" }) }, params = {})
// @Action(value = "anno4")
public void anno4() throws IOException {
ServletActionContext.getResponse().setContentType("text/html;charset=utf-8");
PrintWriter out = ServletActionContext.getResponse().getWriter();
try {
out.print("TestStruts2ActionAnno4 anno4()");
out.flush();
out.close();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
示例8: list
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value="bindlist",results={@Result(location="bindlist.jsp")})
public String list()
{
if(!CommonUtil.isEmpty(uisid))
{
Object openid=getSession().get("openid");
if(!CommonUtil.isEmpty(openid))
{
DBCollection c=MongoUtil.getInstance().getDB().getCollection("Bindings");
DBCollection w=MongoUtil.getInstance().getDB().getCollection("weixinuser");
DBCursor bd=c.find(new BasicDBObject("binds",new BasicDBObject("$elemMatch",new BasicDBObject("uisid",uisid))));
list=new ArrayList<DBObject> ();
while(bd.hasNext())
{
list.add(w.findOne(new BasicDBObject("openid",bd.next().get("openid"))));
}
}else
{
addActionError(OperateResult.NOPRG.getErrdesc());
}
}else
{
addActionError(OperateResult.BADREQ.getErrdesc());
}
return SUCCESS;
}
示例9: search
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value = "search", results = { @Result(type = "stream") })
public String search() throws Exception {
String query = ServletActionContext.getRequest().getParameter("search");
//query = new String(query.getBytes("ISO-8859-1"),"UTF-8");
String targetUrl = "http://baishitong.fudan.edu.cn/index.php?title=%E7%89%B9%E6%AE%8A:%E6%90%9C%E7%B4%A2&search=" + URLEncoder.encode(query, "utf-8") + "&fulltext=search&mobileaction=toggle_view_mobile";
StringBuffer retstr = fetch(targetUrl);
// 内链处理
String html = retstr.toString();
String html2 = retstr.toString();
Pattern p = Pattern.compile("(?<=href=\").*?(?=\")");
Matcher m = p.matcher(html);
while (m.find()) {
String link = m.group();
if (link.startsWith("/wiki")) {
html2 = html2.replace(link, Config.getInstance().get("bstProxy.baseUrl") + URLEncoder.encode(link.substring(6), "UTF-8"));
}
}
inputStream = new ByteArrayInputStream(html2.getBytes("UTF-8"));
System.gc();
return SUCCESS;
}
示例10: excluir
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action( value = "excluirCategorias", results = { @Result( location = "cadastroCategorias.jsp", name = "ok" ) } )
public String excluir( )
{
CategoriaBusiness business = CategoriaBusiness.getInstance( ) ;
boolean success = business.excluirCategoria( categoria.getId( ) ) ;
if( !success )
{
errorMessage = "N�o foi poss�vel excluir a categoria." ;
}
else
{
errorMessage = "";
}
categoria.setNome( "" ) ;
carregarListaCategorias( );
return "ok" ;
}
示例11: downloadAllSchools
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value = "downloadAllSchools", results = { @Result(name = "success", type = "stream", params = { "inputName",
"inputStream", "contentType", "${contentType}", "contentDisposition",
"attachment;filename=\"${fileName}.${fileType}\"", "bufferSize", "1024" }) })
public String downloadAllSchools() throws Exception {
// check input types for validity
try {
switch (ExportType.valueOf(fileType)) {
case csv:
contentType = "text/csv";
break;
default:
break;
}
} catch (Exception e) {
throw new Exception("File Type not implemented.");
}
ReportExport export = getAllSchoolsReportExport(ExportType.valueOf(fileType));
inputStream = new ByteArrayInputStream(export.getReport());
return SUCCESS;
}
示例12: execute
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Override
@CoreSecured({ CorePermissionCodes.READY_CUSTOMER_SNAPSHOT_DELETE })
@Action(results = { @Result(name = "success", location = "/net/techreadiness/plugin/action/snapshot/remove.jsp"),
@Result(name = "nosnapshots", location = "/net/techreadiness/plugin/action/snapshot/nosnapshots.jsp") })
public String execute() {
if (getTaskFlowData().getSnapshots() == null || getTaskFlowData().getSnapshots().isEmpty()) {
return "nosnapshots";
}
setDataGridViewDef(configService.getViewDefinition(getServiceContext(), ViewDefTypeCode.SNAPSHOT_DATAGRID));
snapshotWindowsByIdItemProvider.setSnapshotWindows(getTaskFlowData().getSnapshots());
return SUCCESS;
}
示例13: download
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Action(value = "download", results = { @Result(name = "success", type = "stream", params = { "contentType",
"application/octet-stream", "inputName", "fileInputStream", "contentDisposition",
"attachment;filename=\"%{fileName}\"", "bufferSize", "1024" }) })
public String download() throws Exception {
File file = fileService.getById(getServiceContext(), Long.valueOf(fileId));
// determine which file requested based on fileType:
// f = filename
// m = error messages
// d = error data
if ("m".equals(fileType)) {
fileName = file.getErrorMessageFilename();
} else if ("d".equals(fileType)) {
fileName = file.getErrorDataFilename();
} else {
fileName = file.getFilename();
}
fileInputStream = FileUtils
.openInputStream(new java.io.File(fileService.getUploadDir(getServiceContext()), fileName));
return SUCCESS;
}
示例14: execute
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@Override
@Action(results = { @Result(name = "success", location = "/changeScope.jsp") })
public String execute() {
List<OrgPart> orgParts = orgPartService.findOrgPartsForOrg(getServiceContext(), getServiceContext().getOrgId());
scopes = Lists.transform(orgParts, new Function<OrgPart, Scope>() {
@Override
public Scope apply(OrgPart input) {
return input.getScope();
}
});
scopeId = getServiceContext().getScopeId();
scopeTypeName = Iterables.getFirst(scopeService.findSelectableScopes(getServiceContext()), null).getScopeTypeName();
return SUCCESS;
}
示例15: overallAssessment
import org.apache.struts2.convention.annotation.Result; //导入依赖的package包/类
@CoreSecured({ CorePermissionCodes.READY_CUSTOMER_OVERALL_ASSESSMENT_RPT })
@Action(value = "overallAssessment", results = {
@Result(name = "map", location = "/net/techreadiness/plugin/action/reports/overall/map.jsp"),
@Result(name = "table", location = "/net/techreadiness/plugin/action/reports/overall/table.jsp"),
@Result(name = "org", location = "/net/techreadiness/plugin/action/reports/overall/org.jsp"),
@Result(name = "school", location = "/net/techreadiness/plugin/action/reports/overall/school.jsp") })
public String overallAssessment() throws Exception {
getData();
if (!currentOrg.getOrgTypeName().equals("Readiness")) {
buildBreadcrumbs(currentOrg, consortium, "overallAssessment");
}
if (snapshotName != null && !"".equals(snapshotName)) {
// addProgressReportLink(ProgressReportLink.testTakerProgress);
}
networkSpeed = configService.getOptionList(getServiceContext(), "internalNetworkSpeed", getServiceContext()
.getScopeId());
internetSpeed = configService.getOptionList(getServiceContext(), "internetBandwidth", getServiceContext()
.getScopeId());
return getReturn();
}