六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 34|回复: 0

未定题目

[复制链接]

升级  50%

5

主题

5

主题

5

主题

童生

Rank: 1

积分
25
 楼主| 发表于 2013-1-23 01:47:20 | 显示全部楼层 |阅读模式
I am developing the JSP portlet using plugin sdk.

I want to implement AJAX in this portlet.

I am facing the problem while sending the URL in

jQuery.ajax({
type: "GET",
url: "/changemode.jsp",
data: "modeVal=rahul",
success: function(msg){
alert( "Data Saved: " + msg );
}});


the changemode.jsp is @ same location as the calling JSP.

It doest show any error msg, but the changemode.jsp is not get called.

Please advice.

Thanks in advance.
------------------------------------------------------------------------------------
you need to pass url like that

var url = '<portlet:renderURL windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>"><portlet:param name="struts_action" value="/ext/search/changemode" /></portlet:renderURL>';

and struts action entry should be in struts-config.xml and tiles-defs.xml

-------------------------------------------------------------------------------------
Use the serveResource() method (javax.portlet.GenericPortlet):

<div class="code"> 1    public void serveResource(ResourceRequest request, ResourceResponse response)
 2            throws PortletException, IOException {
 3       
 4        // Make the parameter "modeVal" available in changeMode.jsp
 5        String modeVal = ParamUtil.getString(request, "modeVal");
 6        request.setAttribute("modeVal", modeVal);
 7       
 8        // Dispatch to changeMode.jsp
 9        PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(
10                "/WEB-INF/jsp/changeMode.jsp");
11        dispatcher.include(request, response);
12    }
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表