Exposing webwork objects to JSTL, with a JSTL and

WebWork - WebWork - Exposing webwork objects to JSTL, with a JSTL and DisplayTag Example
<ww:set name="jobz" value="jobs" scope="request" />
The full example below shows a webwork variable "jobs" being exposed as "jobz" to the request scope and being used with jstl and the display tag.

<%@ taglib uri="/WEB-INF/tlds/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tlds/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tlds/displaytag-el-12.tld" prefix="display" %>
<%@ taglib uri="/WEB-INF/tlds/webwork.tld" prefix="ww" %>

<ww:set name="jobz" value="jobs" scope="request" />

<h1><fmt:message key="title.listAllJobs"/></h1>
<display:table name="jobz" class="simple" id="row" >
<display:column titleKey="label.global.actions" >
<c:url var="viewurl" value="/viewJobDetail.action">
<c:param name="name" value="${row.name}"/>
<c:param name="groupName" value="${row.group}"/>
</c:url>
<c:url var="exeurl" value="/viewJobDetail.action">
<c:param name="name" value="${row.name}"/>
<c:param name="groupName" value="${row.group}"/>
<c:param name="executeJobAction" value="execute"/>
</c:url>
<c:url var="editurl" value="/viewJobDetail.action">
<c:param name="name" value="${row.name}"/>
<c:param name="groupName" value="${row.group}"/>
<c:param name="editAction" value="edit"/>
</c:url>
<a href='<c:out value="${viewurl}"/>'><fmt:message key="label.global.view"/></a> |
<a href='<c:out value="${editurl}"/>'><fmt:message key="label.global.edit"/></a> |
<a href='<c:out value="${exeurl}"/>'><fmt:message key="label.global.execute"/></a>  
</display:column>

<display:column property="group" titleKey="label.job.group" sortable="true" />
<display:column property="name" titleKey="label.job.name" sortable="true" />
<display:column property="description" titleKey="label.job.description" />
<display:column property="jobClass" titleKey="label.job.jobClass" sortable="true" />

</display:table>
In Android development, encapsulating a website typically refers to creating an interface that allows you to interact with the website's content without exposing its underlying implementation details or hosting the entire site within your app. This is often done using webviews and APIs. Here's a basic explanation: 1. **WebView**: WebView is a built-in component that lets you display HTML, CSS, and JavaScript content inside an Android app. You can load websites by setting the WebView's `loadUrl()` method with the desired URL. ```java WebView webView = findViewById(R.id.web_view); webView.loadUrl("https://example.com"); ``` 2. **Content Providers (optional)**: If you need to access specific data from the website, you might consider using a Content Provider to fetch that information. For instance, if the website offers JSON data, you can create a custom content provider for your app to consume. 3. **API Integration**: If the website has an API, use Android's HTTP clients like `HttpClient` or later `OkHttp`, or even better, with Retrofit for a more structured approach. This allows you to make calls to the server programmatically. 4. **Separation of Concerns**: To maintain encapsulation, separate the code responsible for interacting with the website (the "adapter" layer) from your app's core logic. This helps keep your app clean and maintainable. ```java // Using Retrofit for API integration Retrofit retrofit = new Retrofit.Builder() .baseUrl("https://api.example.com/") .addConverterFactory(GsonConverterFactory.create()) .build(); ApiService service = retrofit.create(ApiService.class); Call<ApiResponse> call = service.getData(); call.enqueue(new Callback<ApiResponse>() { @Override public void onResponse(Call<ApiResponse> call, Response<ApiResponse> response) { // Handle API response } @Override public void onFailure(Call<ApiResponse> call, Throwable t) { // Handle errors } }); ``` **
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值