Fórumok
Forward to JSP page from processAction()
Dean Grobler, módosítva 12 év-val korábban
Hi Sandeep if i am using serveResource then how can redirect to jsp.As there is no setrenderParameter in Resourceresponse, Any idea??
--Shankar
Forward to JSP page from processAction()
Oliver Bayer, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Liferay Master Bejegyzések: 894 Csatlakozás dátuma: 2009.02.18. Legújabb bejegyzések
Hi Dean,
if you extend your portlet from GenericPortlet you should be able to use the following code snippet:
HTH Oli
if you extend your portlet from GenericPortlet you should be able to use the following code snippet:
...
private String newJSP;
public void init() throws PortletException
{
...
// read the path to the new jsp from the init-params of the portlet.xml
newJSP = getInitParameter("new-jsp");
...
}
...
public void yourProcessAction(ActionRequest actionRequest, ActionResponse actionResponse)
{
...
actionResponse.setRenderParameter("jspPage", destGroupsSelectJSP);
}
HTH Oli
Sandeep Nair, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Liferay Legend Bejegyzések: 1744 Csatlakozás dátuma: 2008.11.06. Legújabb bejegyzések
If you are using MVCPortlet you can use actionResponse.setRenderParameter("jspPage",pathToJSP); inside your processAction
Regards,
Sandeep
Regards,
Sandeep
Shankar Baba, módosítva 10 év-val korábban
RE: Forward to JSP page from processAction()
Regular Member Bejegyzések: 143 Csatlakozás dátuma: 2012.10.18. Legújabb bejegyzésekSandeep Nair:
If you are using MVCPortlet you can use actionResponse.setRenderParameter("jspPage",pathToJSP); inside your processAction
Regards,
Sandeep
Hi Sandeep if i am using serveResource then how can redirect to jsp.As there is no setrenderParameter in Resourceresponse, Any idea??
--Shankar
Sandeep Nair, módosítva 10 év-val korábban
RE: Forward to JSP page from processAction()
Liferay Legend Bejegyzések: 1744 Csatlakozás dátuma: 2008.11.06. Legújabb bejegyzések
Resource phase of portlet lifecycle should only be use to serve binary content or make ajax calls. If you want to forward to a jsp after performing your business logic please use the Action phase and then redirect to a view.
asif aftab, módosítva 10 év-val korábban
RE: Forward to JSP page from processAction()
Regular Member Bejegyzések: 123 Csatlakozás dátuma: 2013.09.02. Legújabb bejegyzések
I am using mvcportlet and to redirect to another jsp I am using setrenderparameter, each and every thing is working and path is looks like path/to/my/view.jsp
but at the time of execution I am getting an error that pat/to/my/view.jsp" not found
from where """ is this one is coming. I searched alot in net but no satisfactory answer that resolve my problem.
please help me
I want to navigate from second.jsp to view.jsp but by using button, I have remedy but by using anchor tag but the problem is I have to use button to navigate
my second.jsp code is
my action class code is
but at the time of execution I am getting an error that pat/to/my/view.jsp" not found
from where """ is this one is coming. I searched alot in net but no satisfactory answer that resolve my problem.
please help me
I want to navigate from second.jsp to view.jsp but by using button, I have remedy but by using anchor tag but the problem is I have to use button to navigate
my second.jsp code is
<portlet:actionurl var="viewCall" name="returnView">
<portlet:param name="jspPage" value="/html/shop_searc/view.jsp" />
</portlet:actionurl>
<aui:script>
function viewFun() //redirect to insert action class
{
document.getElementById("<portlet:namespace />viewDisplayd").action='<%=viewCall.toString()%>';
document.getElementById('<portlet:namespace />viewDisplayd').submit();
}
</aui:script>
<aui:form name="viewDisplayd" method="post">
<aui:input type="button" value="back" name="hello" onclick="viewFun();"></aui:input>
</aui:form>
my action class code is
@ProcessAction(name="returnView")
public void returnView(ActionRequest req, ActionResponse res)
throws PortletException, SystemException, RemoteException
{
res.setRenderParameter("jspPage","/Shop_Search/html/shop_searc/view.jsp");
}
Muhammad Taha, módosítva 10 év-val korábban
RE: Forward to JSP page from processAction()
Junior Member Bejegyzések: 63 Csatlakozás dátuma: 2012.05.01. Legújabb bejegyzések
Hi Asif, I you just want to navigate to another jsp file you don't have to use action url. u can simply navigate using renderURL.
<portlet:renderurl var="viewCall">
<portlet:param name="jspPage" value="/html/shop_searc/view.jsp" />
</portlet:renderurl>
asif aftab, módosítva 10 év-val korábban
RE: Forward to JSP page from processAction()
Regular Member Bejegyzések: 123 Csatlakozás dátuma: 2013.09.02. Legújabb bejegyzések
thanks for your quick reply
Prabodhini Tare, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
New Member Bejegyzések: 6 Csatlakozás dátuma: 2010.09.29. Legújabb bejegyzések
try using actionResponse.sendRedirect(<<url>>);
Dean Grobler, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Puneet Upadhyay, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Regular Member Bejegyzések: 234 Csatlakozás dátuma: 2011.10.22. Legújabb bejegyzések
Make any folder in docroot and place your jsp's there.
and then put this below code into your class....
"response.setRenderParameter("jspPage", "/Any_Folder/view.jsp"); "
and then put this below code into your class....
"response.setRenderParameter("jspPage", "/Any_Folder/view.jsp"); "
Puneet Upadhyay, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Regular Member Bejegyzések: 234 Csatlakozás dátuma: 2011.10.22. Legújabb bejegyzések
MVC Portlet
Sandeep Nair, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Liferay Legend Bejegyzések: 1744 Csatlakozás dátuma: 2008.11.06. Legújabb bejegyzések
Hi
Is it possible to attach the portlet. Which portlet are you using? Is it Generic, MVC or Struts portlet
Regards,
Sandeep
Is it possible to attach the portlet. Which portlet are you using? Is it Generic, MVC or Struts portlet
Regards,
Sandeep
Dean Grobler, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Dean Grobler, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Dean Grobler, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Dean Grobler, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction()
Sandeep Nair, módosítva 12 év-val korábban
RE: Forward to JSP page from processAction() (Válasz)
Liferay Legend Bejegyzések: 1744 Csatlakozás dátuma: 2008.11.06. Legújabb bejegyzések
Try this
}
public class MedelogGetAdmin extends GenericPortlet {
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException {
//from variables
String formType = request.getParameter("formType");
String buttonClicked = request.getParameter("button");
//check what page to forward to
String jsp = Action.forwardTo(formType, buttonClicked); //jsp = consumers.jsp
actionResponse.setRenderParameter("jsp",jsp);
//forward to "/WEB-INF/jsp/"+jsp;
//but how?
}
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
//get current tab value
String currentTab = ParamUtil.getString(request, "currentTab", "Consumers");
//gets data only for requested table
ResultSet rs = queryDb.queryDb(currentTab.replace(" ",""));
String javaScript = Tablerize.create(rs);
request.setAttribute("generatedScript", javaScript);
//prints out javascript in console for reference
System.out.println("----------------------------------------------");
System.out.println(javaScript);
System.out.println("----------------------------------------------");
response.setContentType("text/html");
String jsp = ParamUtil.getString(request,"jsp","MedelogGetAdmin_view.jsp");
PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/WEB-INF/jsp/"+jsp);
dispatcher.include(request, response);
}
Dean Grobler, módosítva 12 év-val korábban