Issue in Replacing Presentation Layer with SmartClient

Hi,
I would like to replace my existing presentation layer only, which is developed in JSP/Servlets to SmartClient.

The existing application ,I am uses <form method=post action=ReportsContrllerServlet> for every action of JSP controls(hyperlink, button).

But If I use SmartClient then Form controls and List control values are not coming to Servlet class, because it uses its own way(RPCManager and DMI) of retrieving values inside Java class.

Would you please reply, if I replace SmartClient as presentation layer should I modify the other layer as well as to get the form values?.

In our existing application, used one of the column as hyperlink, selecting it calls Servlet and process and navigates from there.

Is it possible to have hyperlink inside Grid control with action same as JSP code having?

Requesting you to clarify above doubts without re-directing to somewhere.

Thanks in Advance
Arul

Generally you want to connect SmartClient to your data & services tier via DataSources. RPC DMI in one way of doing this; the QuickStart Guide chapter on Data Integration covers all of the available approaches.

A DynamicForm can be made to behave identically to a native HTML form by setting canSubmit:true and calling submit() (as opposed to calling saveData() to save via a DataSource). This is sometimes appropriate for incrementally upgrading a legacy application.

Similarly, you can create grid cells that contain hyperlink that will go any given URL by using listGridField.formatCellValue() to return the HTML for a link (<a href=“…”). This likewise can be appropriate for incrementally upgrading legacy applications.

(also: if you prefer not to read our free, professionally prepared documentation, paid training is available)

Not able to refer JSP variable inside SmartClient tag

Hi,
I thank you for your earlier replies.
I am trying to replace only presentation layer with SmartClient tool.
Here one of the column is anchor tag in my existing app. Since I am mapping POJO’s to ListGrit, I cannot use formatCell syntax in List Grid as you mentioned.

Please find below code I am getting the results by using below ListGrid format.

Here in my existing code, the query strings are passed to some utility method for constructing value,

Issue here is, I cannot refer any JSP varaibale or method inside the tag?

Would you please have a look below code,one of the Query String I am having like Util.validateInput(…)?

Could you please clarify how I can refer java variable or method(Which was exists conventional coing)?

<ListGrid ID=“dataGrid” left=“100” top=“100” width=“600” height=“300” dataSource=“openAccountsDS”>
<data>
<c:forEach var=“accountObj” items=“${accountsProcessedSessionData}”>
<openAccounts>
<accountName><c:out value=“${accountObj.accountName}”/></accountName>
<numberOfTests><c:out value=“${accountObj.numberOfTests}”/></numberOfTests>
</openAccounts>
</c:forEach>
</data>
</ListGrid>

Thanks
Arul

Hello Arulman,

It’s not clear what validateInput is supposed to be doing, but SmartClient has no impact on how .jsps are interpreted. If you’re not sure, try the same code elsewhere and it will fail in the same way.

We still recommend doing this via formatCellValue() if what you are trying to do is format data.

formatCellValue is used only in other format of ListGird

Hi,
Thanks for your reply.
The existing application uses Utility class(User defined class) method in querystring to construct values.

Also in some places in the query string uses JSP variable defined as,
I am just giving exmaple
<%
String command=“getFormatAccount”;
%>

I want use this variable inside <c:out value=“${command}”>

There is no syntax formatCell value in ListGrid in the below format

<ListGrid ID=“dataGrid” left=“100” top=“100” width=“600” height=“300” dataSource=“openAccountsDS”>
<data>
<c:forEach var=“accountObj” items=“${accountsProcessedSessionData}”>
<openAccounts>
<accountID><c:out value=“${accountObj.accountID}”/></accountID>
</openAccounts>
</c:forEach>
</data>
</ListGrid>

In the above format, is the one suits mapping POJO value in presentation layer.

Hi arulman,

SmartClient doesn’t affect how those JSP tags render. Your not providing an error message or a description of what’s not working as you expect, so it’s not really possible to comment further..

Hi,
Thanks for your reply.

Please see the line below in JSP has decklared one string variable.
<%
String checkStr=“getSummaeyContentbyID”;
%>

After that I am populating session variable in ListGrid by below.
here ‘sessionData’ is set in Servlet like

session.setAttribute(“sessionData”,“accountData”); Anything which is in session scope it works.
But if I refer checkStr which is declared above not able to use inside the tag below, it is returning empty value.

<ListGrid ID=“dataGrid” left=“100” top=“100” width=“600” height=“300” dataSource=“openAccountsDS”>
<data>
<c:forEach var=“accountObj” items=“${sessionData}”>
<numberOfTests><c:out value=“${accountObj.numberOfTests}”/></numberOfTests>

Thanks
Arul

if you still not get my clarification

Hi,
if you still not able to get my clarification, I put it simple way
Assume that I declared one varaible in JSP as below
<%
String checkStr=“Testing JSP value”;
%>

Below I am using ListGrid(Mapping POJO format for displaying values in JSP)
using session variable which is set in servlet.

My clarification is,
The ${checkStr} which is declared in JSP in the ListGrid NOT working returning empty values.

<ListGrid ID=“dataGrid” left=“100” top=“100” width=“600” height=“300” dataSource=“openAccountsDS”>
<data>
<c:forEach var=“accountObj” items=“${sessionData}”>
<openAccounts>
<accountID><c:out value=“${accountObj.accountID}”/></accountID>

   &lt;view&gt;&lt;c:out  value="${checkStr}"/&gt;&lt;/view&gt;

      &lt;/openAccounts&gt;
    &lt;/c:forEach&gt;
&lt;/data&gt;

</ListGrid>

Thanks
Arul

So again, SmartClient does not affect how your .jsp executes…

Try the same expression elsewhere (outside of the SmartClient component definition) to verify this.

Also, it’s not clear how you’re actually checking whether something was output. The correct way would be to look at the generated JavaScript code and see if the expected value is there.

Attached Complete JSP code for your reference

Hi,
Please find below the complete sample code.

<%@ taglib uri=“/WEB-INF/iscTaglib.xml” prefix=“isomorphic” %>

<!-- include core JSTL taglibs –>
<%@ taglib uri=“/WEB-INF/c.tld” prefix=“c” %>

<!-- make sure EL is enabled for this page –>
<%@ page isELIgnored=“false” %>
<%@ page import=“java.util." %>
<%@ page import="com.jpmorgan.corea.cow.bean.
” %>
<%
String baseURL = “http://localhost:8080/test”;
%>
<html>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=ISO-8859-1”>
</head><isomorphic:loadISC skin=“SmartClient”/>
<body>

<Script>
<isomorphic:loadDS name=“arul”/>
<isomorphic:XML>
<ListGrid ID=“dataGrid” left=“100” top=“100” width=“600” height=“300” dataSource=“arul”>
<data>
<c:forEach var=“test” items=“${TestAccounts}”>
<openAccounts>
<accountID><c:out value=“${test.accountID}”/></accountID>
<accountName><c:out value=“${test.accountName}”/></accountName>
</openAccounts>
</c:forEach>
</data>
</ListGrid>

</isomorphic:XML>
</Script>

</body>
</html>


Here the Java varibale baseURL value is not getting parsed but ‘TestAccounts’ which is stored in session in servlet works.

I just gave an example. There are lot of places in exting code used java varibale inside querystring.

Will you please clarify how I can overcome this?

The View Source of the List Grid is below, note the baseUrl value is empty there

isc.ListGrid.create({
data:[
{accountID:“100”, accountName:“One”},
{accountID:“200”, accountName:“Two”}
],
width:600,
dataSource:“arul”,
top:100,
height:300,
ID:“dataGrid”,
left:100
})

Thanks
Arul

OK, here’s how to convince yourself that this has nothing to do with SmartClient. Remove everything in your example that has anything to do with SmartClient, leaving a completely plain JSP/JSTL example - it now looks like this, right?

<!-- include core JSTL taglibs -->
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>

<!-- make sure EL is enabled for this page -->
<%@ page isELIgnored="false" %> 
<%@ page import="java.util.*" %>
<%@ page import="com.jpmorgan.corea.cow.bean.*" %>
<%
String baseURL = "http://localhost:8080/test";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<body>
    <c:forEach var="test" items="${TestAccounts}">
        <c:out value="${test.accountID}"/>
        <c:out value="<a href=${baseURL}/TestControllerServlet?command=${test.accountName}>${test.accountName}</a>"/>
    </c:forEach>
</body>
</html>

Run this JSP. Note how it still isn’t displaying the value of “baseURL”. SmartClient does not affect how your JSP executes - honest!

Hello Arulman,

Just wanted to check in that you’ve found your way past your JSP issue, also, make sure you review the capabilities of SmartClient DMI and the RPCManager, which will allow you to connect to the Java Beans you are currently trying to output via JSTL, in a simpler matter that will also enable data paging for large datasets, adaptive filtering and sorting, and many other sophisticated SmartClient features.

Hi,
Thanks for your reply.
I do understand there was no issues in SmrtClinet in the JSP.

I had been asked to change only presentation layer, If I use RPCManager and DMI then I have to modify other layer as well to get the values JSP to DAO pattern and vice versa which definitely not allowed.

Below is my Sample DataSource for earlier communicated JSP. In existing application , servlet will have the data in session to display it in presentation layer.

So I have to use ListGrid with the one I mentioned in JSP right for this scenarion right?

In this case, Would you please reply your feedback, How I can rectify this issue?(Getting java varibale inside tld and list grid)

<DataSource
ID=“arul”
>
<fields>
<field name=“accountID” type=“sequence” hidden=“true” primaryKey=“true”/>
<field name=“accountName” type=“text” title=“Item” length=“128” required=“true”/>
</fields>
</DataSource>


Thanks
Arul

Using RPC DMI does not mean changing something other than the “presentation layer”. You can use the same pattern of arranging for some set of beans to be in the session and accessing that data from the “view”. In this case the view is a Java method instead of some .jsp code, but it’s still the presentation layer.

If you are somehow restricted to writing .jsp files only, you can still use the RPCManager without using DMI - see the samples accessible from the SDK Start page in Examples -> Java Integration.

Using RPCManager involves changes req in other layer

Hi,
You are absolutlely right, it is JSP tab library change.

But please confirm if I use RPCManager/DMI as suggested by you then, Will it be changig requires in back-end layer as well correct?
For exaple, I need to process the data from fron-end to back-end code by

RPCManager rpc = new RPCManager(request, response, out);
Object data = rpc.getData();
System.out.println("client sent: " + data.toString());
rpc.send(“here’s a response”);

Thanks
Arul

We’re having terminology difficulties here.

If you what you mean by “changing the back-end layer” is writing any Java code whatsoever, even if in a JSP, then yes, you do need to write Java code to use the RPCManager.

From an architectural standpoint, this is normally not considered to be “changing the back-end layer”. Architectural layers are conceptual and should not be defined in terms of what kind of code is being written.

However if you have bizarre coding standards that you are dealing with that prevent you from using the RPCManager, your best option is to use the RestDataSource on the client side and output XML responses using JSP tags as you started with. But using the RPCManager as designed is going to be much simpler and produce a much better result.