on 07-02-2007 3:36 PM
I want to enter user information to ume database,gui is defined in a jsp page and the logic for data entry is done in a java component.How do i connect to that java component using jsp page through coding.so that i can enter the user details in portal ume.
plz reply as soon as possible..
Hi,
Check the below thread.
<a href="https://www.sdn.sap.com/irj/sdn/thread?messageID=3349822#3349822">portal registration</a>
Thanks
R.Murali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ths is the code m using.. how to call this java component on button click.. through jsp code.. this java code is working wid simple html code.....
PortalUser.jsp
-
<%-- @ taglib uri="tagLib" prefix="hbj" --%>
<%@ taglib uri="prt:taglib:tlhtmlb" prefix="hbj" %>
<hbj:content id="myContext" >
<hbj:page title="PageTitle">
<hbj:form id="myFormId" action="PortalUser.PortalUser">
<hbj:gridLayout>
<hbj:gridLayoutCell rowIndex="1" columnIndex="1">
<hbj:label id="label_UserName" required="True" text="User ID" design="LABEL" labelFor="UserName"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="1" columnIndex="2">
<hbj:inputField id="UserName" type="string" maxlength="100"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="2" columnIndex="1">
<hbj:label id="label_Password" required="True" text="Password" design="LABEL" labelFor="Password"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="2" columnIndex="2">
<hbj:inputField id="Password" type="string" maxlength="100"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="3" columnIndex="1">
<hbj:label id="label_FirstName" required="True" text="First Name" design="LABEL" labelFor="FirstName"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="3" columnIndex="2">
<hbj:inputField id="FirstName" type="string" maxlength="100"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="4" columnIndex="1">
<hbj:label id="label_LastName" required="True" text="Last Name" design="LABEL" labelFor="LastName"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="4" columnIndex="2">
<hbj:inputField id="LastName" type="string" maxlength="100"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="5" columnIndex="1">
<hbj:label id="label_Email" required="True" text="Email" design="LABEL" labelFor="Email"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="5" columnIndex="2">
<hbj:inputField id="Email" type="string" maxlength="100"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="6" columnIndex="1">
<hbj:label id="label_address" required="True" text="address" design="LABEL" labelFor="address"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="6" columnIndex="2">
<hbj:inputField id="address" type="string" maxlength="100"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="7" columnIndex="1">
<hbj:label id="label_passportno" required="True" text="passportno" design="LABEL" labelFor="passportno"/>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="7" columnIndex="2">
<hbj:inputField id="passportno" type="string" maxlength="100"/>
</hbj:gridLayoutCell>
</hbj:gridLayout>
<hbj:button id="Send_Button" text="Send" onClick="sendButtonClicked" tooltip="Submit" width="100" design="EMPHASIZED">
</hbj:button>
</hbj:form>
</hbj:page>
</hbj:content>
<!--/hbj:form>
</hbj:page>
</hbj:content-->
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nidhi,
In the jsp you are calling a method which is written in the button taglib "onClick". The java component that handles servlet response and requests will be checked for the method
public void onSendButtonClicked(Event event) throws PageException
{
//content for action
}
The component used can be a PortalApplicationComponent.
Award points if helpful.
Regards,
Sujana
code for java comp..
PortalUser.java
-
package com.satyam
import com.sapportals.htmlb.page.DynPage;
import com.sapportals.htmlb.page.PageException;
import com.sapportals.portal.htmlb.page.JSPDynPage;
import com.sapportals.portal.htmlb.page.PageProcessorComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sapportals.portal.prt.service.usermanagement.IUserManagementService;
import com.sap.security.api.IGroupFactory;
import com.sap.security.api.IUserAccount;
import com.sap.security.api.IUserFactory;
import com.sap.security.api.IUserMaint;
import com.sap.security.api.IUserSearchFilter;
import com.sap.security.api.UMException;
import com.sap.security.api.UMFactory;
public class PortalUser extends PageProcessorComponent {
public DynPage getPage(){
return new PortalUserDynPage();
}
public static class PortalUserDynPage extends JSPDynPage{
public void doInitialization(){
}
public void doProcessAfterInput() throws PageException {
}
public void doProcessBeforeOutput() throws PageException {
IPortalComponentRequest request = (IPortalComponentRequest)getRequest();
IPortalComponentResponse response = (IPortalComponentResponse)getResponse();
String userName = request.getParameter("userName");
String password = request.getParameter("password");
String fname = request.getParameter("fname");
String lname = request.getParameter("lname");
String address = request.getParameter("address");
IUserFactory userFact = UMFactory.getUserFactory();
IUserMaint epUser = null;
IUserAccount userAcc = null;
if(userName!=null){
try {
epUser = userFact.newUser(userName);
epUser.setFirstName(fname);
epUser.setLastName(lname);
epUser.setLastName(address);
epUser.setEmail("abc@xyz.com");
epUser.save();
epUser.commit();
try {
userAcc = UMFactory.getUserAccountFactory().newUserAccount(userName,epUser.getUniqueID());
userAcc.setPassword(password);
userAcc.save();
userAcc.commit();
} catch (Exception e)
{
response.write("<BR>Exception ::"+e);
return;
}
} catch (Exception exp)
{
response.write("<BR>Exception ::"+exp);
epUser.rollback();
}
}
this.setJspName("PortalUser.jsp");
}
}
}
Message was edited by:
nidhi singh
hi nidhi,
The controller is already linked with the jsp when you created the portal component when u created the portal application.Therefore when u click the button the onClick event gets triggered and move to the controller java file.....And from there u can get the value of the form .....
for input field.... u need to write the following code :
InputField myInputField =
(InputField) getComponentByName("UserName");
if (myInputField != null) {
this.name = myInputField.getValueAsDataType().toString();
}
U can also follow the following link...
http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/e0a341354ca309e10000000a155106/content.htm
If helpfull please reward with points.....
Thanks
ritu
Message was edited by:
Ritushree Saha
Hi,
This might help you
which java component you are using?
Regards
Samir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.