Created
October 21, 2015 06:54
-
-
Save lahirue/9409292c342f73ff1dca to your computer and use it in GitHub Desktop.
WSO2 Carbon Component UI JSP Page with Back End Web Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page import="org.apache.axis2.context.ConfigurationContext"%> | |
<%@ page import="org.wso2.carbon.CarbonConstants"%> | |
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil"%> | |
<%@ page import="org.wso2.carbon.utils.ServerConstants"%> | |
<%@ page import="org.wso2.carbon.ui.CarbonUIMessage"%> | |
<%@ page import="org.wso2.carbon.testService.ui.types.*"%> | |
<%@ page import="org.wso2.carbon.testService.ui.types.data.User"%> | |
<%@ page import="org.wso2.carbon.testService.ui.*"%> | |
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> | |
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" | |
prefix="carbon"%> | |
<% | |
String serverURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); | |
ConfigurationContext configContext = | |
(ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); | |
String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); | |
UserClient client; | |
User[] users; | |
try { | |
client = new UserClient(configContext, serverURL, cookie); | |
client.addUser("Lahiru1", 22); | |
client.addUser("Lahiru2", 26); | |
client.addUser("Lahiru2", 29); | |
users = client.displayUsers(); | |
} catch (Exception e) { | |
CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request, e); | |
%> | |
<script type="text/javascript"> | |
location.href = "../admin/error.jsp"; | |
</script> | |
<% | |
return; | |
} | |
%> | |
<div id="middle"> | |
<h2>User List</h2> | |
<div id="workArea"> | |
<table class="styledLeft" id="moduleTable"> | |
<thead> | |
<tr> | |
<th width="20%">User</th> | |
<th width="20%">Age</th> | |
</tr> | |
</thead> | |
<tbody> | |
<% | |
for(User user: users){ | |
%> | |
<tr> | |
<td><%=user.getName()%></td> | |
<td><%=user.getAge()%></td> | |
</tr> | |
<% | |
} | |
%> | |
</tbody> | |
</table> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment