Scenario
The client wants to maintain uniform look and feel across Enterprise Portal, Corporate website and different in-house web applications. Thereby, the client wants the same set of customized UI controls to be used across all the web applications.
Pre-requisites
JDK
PDK
NetWeaver Developer Studio
Step By Step Procedure
1. Create a class which extends Component Class
This class should define the getter and setter methods for all your tag attributes.
Code Sample:
2. Create a tag handler class for the UI element. This class extends TagSupport.
This class helps you to create the tag and make it available for use in HTML or JSPs.
Code Sample:
" +
"
" +
"" +
"" +
"" +
"" +
"" +
"" +
"
" +
"
";
}
else{
htmlControlText = "" +
"
" +
"" +
"" +
"" +
"" +
"" +
"" +
"
" +
"
";
}
out.write(htmlControlText);
}catch(Exception ex){
ex.printStackTrace();
}
return 1;
}
// Define the doEndTag method
public int doEndTag() throws JspException
{
return super.doEndTag();
}
}
3. Create a service
Code Sample:
import com.sapportals.portal.prt.service.IServiceContext;
public class SDNControlService implements ISDNControlService{
private IServiceContext mm_serviceContext;
/**
*/
public void init(IServiceContext serviceContext)
{
mm_serviceContext = serviceContext;
}
/**
*/
public void afterInit()
{
}
/**
*/
public void configure(com.sapportals.portal.prt.service.IServiceConfiguration configuration)
{
}
/**
*/
public void destroy()
{
}
/**
*/
public void release()
{
}
/**
*/
public IServiceContext getContext()
{
return mm_serviceContext;
}
/**
*/
public String getKey()
{
return KEY;
}
}