liferay 采用URL方式传值
来源:互联网 发布:手机淘宝怎么搜关键词 编辑:程序博客网 时间:2024/06/05 14:24
0 我的目录如下
1 首先是view.jsp代码
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %><%@ page import="java.util.*" contentType="text/html; charset=utf-8" %><portlet:defineObjects />This is the <b>Url Sendparameter</b> portlet in View mode.<!-- 跳转页面举例 增加图书 --><% String idnumber = new Random().nextInt(10) + ""; //随机产生一个idnumber%><portlet:actionURL var="addBook" name="add"> <portlet:param name="mvcPath" value="/html/urlsendparameter/getInfo.jsp"/> <!--mvcPath为固定写法,value为全路径 ,这里从view.jsp跳转到<pre name="code" class="html">getInfo.jsp--> <portlet:param name="idnumber" value="<%= idnumber%>"/> <!-- 传一个参数idnumber --></portlet:actionURL> <a href="${addBook }">增加图书</a>
2 ,后台Java代码
package com.test;import java.io.IOException;import java.util.Random;import javax.portlet.ActionRequest;import javax.portlet.ActionResponse;import javax.portlet.PortletException;import javax.portlet.ProcessAction;import javax.portlet.RenderRequest;import javax.portlet.RenderResponse;import javax.servlet.http.HttpServletRequest;import com.liferay.portal.kernel.util.ParamUtil;import com.liferay.portal.service.persistence.PortletUtil;import com.liferay.portal.util.PortalUtil;import com.liferay.util.bridges.mvc.MVCPortlet;/** * Portlet implementation class UrlSendparameter */public class UrlSendparameter extends MVCPortlet { @ProcessAction(name="add") public void saveUserInfo( ActionRequest actionRequest,ActionResponse actionResponse){String idnumber = (String) actionRequest.getParameter("idnumber");System.out.println("saveUserInfo idnumber = " + idnumber); System.out.println("运行到这里了...");} }
3 当点击下图 增加图书 时候
4 会在后面控制台随机输出一个数
0 0
- liferay 采用URL方式传值
- Liferay中通过URL传参数
- Struts2采用注解方式配置url和Action的映射
- Liferay Url 中的参数说明
- Liferay+Spring Friendly URL mapping
- thinkPHP a标签URL传值方式
- 采用bitly压缩url
- liferay-portlet.xml for Friendly URL mapping in Liferay
- Liferay Portal(四)jsp中URL传参给portlet
- Liferay应用开发中构造render url
- Liferay应用开发中构造render url
- Liferay如何去掉url中的国际化信息
- Liferay中,MySQL的自动发番采用的方法。
- 采用URL读取网络文件
- 头像采用url的处理
- 处理get方式的URL传值问题
- js页面传值乱码以及url获取方式
- 页面之间的url传值获取方式
- JUnit4 详解
- 循环-10. 求序列前N项和(15)
- 戏侃马克思主义
- Tomcat7 配置数据源
- 循环-11. 水仙花数(20)
- liferay 采用URL方式传值
- 访学有感------------南京访学一周小记
- 第十四周项目一(4)——折腾二维数组
- 循环-12. 打印九九口诀表(15)
- Spring 框架的设计理念与设计模式分析
- OAEPWithSHA-512AndMGF1Padding
- spring junit完美解决方案
- nyoj33蛇形填数
- 黑马程序员——private, public,protected,friendly的区别