フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド数 [ 前へ | 次へ ]
toggle
laxman teja
how can i set the values to db and set values from db using service builder
2012/04/25 2:48
答え

laxman teja

ランク: New Member

投稿数: 20

参加年月日: 2012/04/16

最近の投稿

plz tell me how to insert a value to db and retrieve to a jsp
Jitendra Rajput
RE: how can i set the values to db and set values from db using service bui
2012/04/25 2:54
答え

Jitendra Rajput

ランク: Liferay Master

投稿数: 576

参加年月日: 2011/01/07

最近の投稿

Use classes generated by service builder.
Use XXXXLocalServiceUtil to add and get data from database.
Ravi Kumar Gupta
RE: how can i set the values to db and set values from db using service bui
2012/04/25 3:12
答え

Ravi Kumar Gupta

ランク: Liferay Legend

投稿数: 1041

参加年月日: 2009/06/23

最近の投稿

laxman teja
RE: how can i set the values to db and set values from db using service bui
2012/04/25 23:05
答え

laxman teja

ランク: New Member

投稿数: 20

参加年月日: 2012/04/16

最近の投稿

thanks for your post.....

ya i have done every thing what u explained but my jsp is not displaying with text boxes and submit button ..... and where to retrieve the values from database
Ravi Kumar Gupta
RE: how can i set the values to db and set values from db using service bui
2012/04/26 2:37
答え

Ravi Kumar Gupta

ランク: Liferay Legend

投稿数: 1041

参加年月日: 2009/06/23

最近の投稿

what did you try? can you share your portlet?
laxman teja
RE: how can i set the values to db and set values from db using service bui
2012/04/26 3:07
答え

laxman teja

ランク: New Member

投稿数: 20

参加年月日: 2012/04/16

最近の投稿

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
this is my .jsp


<portlet:defineObjects />

<form action='<portlet:actionURL/>' method="post">
<table>
<tr>
<td>subjectname:</td>
<td><input type="text" name="subjectname" /></td>
</tr>
<tr>
<td>degree:</td>
<td><input type="text" name="degree " /></td>
</tr>

<tr>
<td colspan=2><input type="submit" value="submit" /></td>
</tr>
</table>
</form>

this is my .java code
package com.test;

import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import com.test.model.student;
import com.test.service.studentLocalServiceUtil;

/**
* Portlet implementation class successtruePortlet
*/
public class successtruePortlet extends MVCPortlet {
public void init() {
viewJSP = getInitParameter("view.jsp");

}

public String subjectname;
public Long studentid;
public String degree;





public void processAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {

long studentid=Long.parseLong(actionRequest.getParameter("studentid"));


String subjectname=actionRequest.getParameter("subjectname");
String degree=actionRequest.getParameter("degree");

actionResponse.setRenderParameter("jspPage","html/successtrueportlet/view.jsp");


try {
studentLocalServiceUtil.addstudent(studentid,subjectname,degree);

} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}



this is my XXXXlocalserviceimpl

public class studentLocalServiceImpl extends studentLocalServiceBaseImpl {

public student addstudent( long studentid,String subjectname,String degree) throws SystemException
{
student t = new studentImpl();
t = new studentImpl();
t.setStudentId(studentid);

t.setSubjectName(subjectname);
t.setDegree(degree);

return studentPersistence.update(t,false);

}



}



her is my code
but my portlet is displaying without text box and submit button and also tell me were to code for retriving data from database pls helpme!!
Ravi Kumar Gupta
RE: how can i set the values to db and set values from db using service bui
2012/04/26 3:36
答え

Ravi Kumar Gupta

ランク: Liferay Legend

投稿数: 1041

参加年月日: 2009/06/23

最近の投稿

If you add anything else to jsp.. can you see that?
Hitoshi Ozawa
RE: how can i set the values to db and set values from db using service bui
2012/04/26 3:42
答え

Hitoshi Ozawa

ランク: Liferay Legend

投稿数: 8000

参加年月日: 2010/03/23

最近の投稿

Can you attach your portlet war file?
laxman teja
RE: how can i set the values to db and set values from db using service bui
2012/04/26 4:29
答え

laxman teja

ランク: New Member

投稿数: 20

参加年月日: 2012/04/16

最近の投稿

thanks for reply i have .zip file pls go through it
添付ファイル: successtrue-portlet.rar (915.9k)
Hitoshi Ozawa
RE: how can i set the values to db and set values from db using service bui
2012/04/26 6:36
答え

Hitoshi Ozawa

ランク: Liferay Legend

投稿数: 8000

参加年月日: 2010/03/23

最近の投稿

Tried it. You have an error in your java class.
If you set <portlet-class> value to "com.liferay.util.bridges.mvc.MVCPortlet" jsp will be displayed.
laxman teja
RE: how can i set the values to db and set values from db using service bui
2012/04/26 21:42
答え

laxman teja

ランク: New Member

投稿数: 20

参加年月日: 2012/04/16

最近の投稿

thanks for your reply it worked ,but when i am entering the values into .jsp it is not stored in database,pls tell me were to write the code for retriving values from database
deepthi narendula
RE: how can i set the values to db and set values from db using service bui
2012/04/26 22:48
答え

deepthi narendula

ランク: Junior Member

投稿数: 25

参加年月日: 2012/04/26

最近の投稿

how to retrieve data from database and where to write the code for retriving.....pls send me the code snippet..and when i am submitting the values from jsp it is not storing in to database...
Ravi Kumar Gupta
RE: how can i set the values to db and set values from db using service bui
2012/04/27 0:09
答え

Ravi Kumar Gupta

ランク: Liferay Legend

投稿数: 1041

参加年月日: 2009/06/23

最近の投稿

There are classes created by service builder.. They are XXXLocalServiceUtil.java look at that once, you will find many methods for creating/edit/delete/get etc. Try that once and let us know what is the issue.