Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to call DWR in login.jsp EXT
shrikanth k shrikanth, modified 10 Years ago.
Regular Member
Posts: 118
Join Date: 12/11/13
Recent Posts
Dear frds,
I have one requirement ,iam new at liferay ,I have one doubt , can u please help me.
i want to call dwr in login.jsp using Hook , so that i have followed below steps ,Iam unable to call dwr in login.jsp the DWR is not working,
I am new @liferay Iam trying to call DWR in Login.jsp using Ext portlet.
1) I Have created EXT as LogAct-ext ,In that i have copied dwr.jar in this path /ext-lib/portal/dwr.jar
2) i have added dwr servlet code in web.xml path is /ext-web/dockroot/WEB_INF/web.xml
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<display-name>DWR Servlet</display-name>
<servlet-class>
org.directwebremoting.servlet.DwrServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
3) I have created dwr.xml in /ext-web/dockroot/WEB_INF/dwr.xml in this path
<dwr>
<allow>
<create creator="new" javascript="Person" scope="script">
<param name="class" value="com.practice.Person"/>
</create>
</allow>
</dwr>
4) I have created my own class in docroot/WEB_INF/ext-impl/src/com/practice/Person.java
public class Person {
public String getData(int index) {
String name=new String("meera");
return name;
}
}
5) lastly i have called this dwr in login.jsp Path is /ext-web/dockroot/html/portlet/login/login.jsp
<script type='text/javascript' src='/dwr/interface/Person.js'> </script>
<script type='text/javascript' src='/dwr/engine.js'> </script>
<script type='text/javascript' src='/dwr/util.js'></script>
<button id="checkDwr">click1</button>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#checkDwr").click(function(){
alert("hello");
Person.getData(42, {
callback:function(str) {
alert(str);
}
});
});
});
</script>
My problem is that i have not able to get the values from DWR .Iam getting "NOT FOUND " alert when iam calling dwr.
So please help me were iam going wrong in DWR using EXT
Regards
Shrikanth K Domala
I have one requirement ,iam new at liferay ,I have one doubt , can u please help me.
i want to call dwr in login.jsp using Hook , so that i have followed below steps ,Iam unable to call dwr in login.jsp the DWR is not working,
I am new @liferay Iam trying to call DWR in Login.jsp using Ext portlet.
1) I Have created EXT as LogAct-ext ,In that i have copied dwr.jar in this path /ext-lib/portal/dwr.jar
2) i have added dwr servlet code in web.xml path is /ext-web/dockroot/WEB_INF/web.xml
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<display-name>DWR Servlet</display-name>
<servlet-class>
org.directwebremoting.servlet.DwrServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
3) I have created dwr.xml in /ext-web/dockroot/WEB_INF/dwr.xml in this path
<dwr>
<allow>
<create creator="new" javascript="Person" scope="script">
<param name="class" value="com.practice.Person"/>
</create>
</allow>
</dwr>
4) I have created my own class in docroot/WEB_INF/ext-impl/src/com/practice/Person.java
public class Person {
public String getData(int index) {
String name=new String("meera");
return name;
}
}
5) lastly i have called this dwr in login.jsp Path is /ext-web/dockroot/html/portlet/login/login.jsp
<script type='text/javascript' src='/dwr/interface/Person.js'> </script>
<script type='text/javascript' src='/dwr/engine.js'> </script>
<script type='text/javascript' src='/dwr/util.js'></script>
<button id="checkDwr">click1</button>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#checkDwr").click(function(){
alert("hello");
Person.getData(42, {
callback:function(str) {
alert(str);
}
});
});
});
</script>
My problem is that i have not able to get the values from DWR .Iam getting "NOT FOUND " alert when iam calling dwr.
So please help me were iam going wrong in DWR using EXT
Regards
Shrikanth K Domala
Community
Company
Feedback