on 01-06-2006 11:55 AM
Hi all
I want to know whther we can have
<b>
import com.sap.mw.jco.*;</b>
like this inside an JSP ???
This import brings a JAR File....
Thanks
Kay
Hi,
If you can send the proper error, or some sample code that can be anaylyzed , would be of greet help.
May be we can solve ur prob.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check your class and package name. remember it is case-sensitive.
If your class is a bean, then use 'usebean' tag in JSP to creat a object.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kay,
can u b more specific about the error.
Regards,
Uma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
the problem in your code is this, the myExternalTable is local to the scriplet that you have defined. so declare it first externally in your jsp. this can be done by putting the following two lines
<%@ page import= "com.sap.mw.jco.*" %>
<%!JCO.Table myExternalTable= myExt.getLogonClientList();
ZgetClientListForLogonScreen myExt = new ZgetClientListForLogonScreen();
%>
<% myExt.createConnection();
myExt.endConnect();
myExternalTable.firstRow();%>
<select name="zclientList" style="WIDTH: 20ex" size=1>
<% for (int i=0; i<myExternalTable.getNumRows(); i++)
{ %>
<option value="<%=myExternalTable.getField("MANDT").getValue()%>"><%=myExternalTable.getField("MANDT").getValue()%></option>
<%}%>
</select>
try this code.
<%! declare variables that need to be accessed across scriplets %>
regards,
P.Venkataramanan
Venkat
I have modified the code like since the JCO.Table must be declared before the Constructor
<%@ page import= "com.sap.mw.jco.*" %>
<%! <b>JCO.Table myExternalTable = null;</b>
ZgetClientListForLogonScreen myExt = new ZgetClientListForLogonScreen(); %>
.............
<% myExt.createConnection();
<b> myExternalTable= myExt.getLogonClientList();</b> myExt.endConnect();
myExternalTable.firstRow();%>
<select name="zclientList" style="WIDTH: 20ex" size=1>
<% for (int i=0; i<myExternalTable.getNumRows(); i++)
{ %>
<option value="<%=myExternalTable.getField("MANDT").getValue()%>"><%=myExternalTable.getField("MANDT").getValue();%></option>
<% } %>
</select>
But still the problem persists !!!!
Thanks
Kay
Message was edited by: Kay
Hi Kay,
I think your code is correct. But as Venkat said, it is not advisable to include the java code like yours in JSP.
Instead of JCO.Table , you can use com.sap.mw.jco.Table if there is any ambiguity.
In case of any errors, pls let us know.
Regards,
Uma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes we can do this kind of imports in JSP in scriplet or directive tag. But this is not advisable. moreover the required jar should be added to the project.
regards,
P.Venkataramanan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kay,
After adding the jar file in your project, you can import the classes in JSP as
<%@ page import="com.sap.mw.jco.*" %>
For more information, please refer the following link.
http://java.sun.com/products/jsp/tags/11/syntaxref11.fm7.html
Regards,
Uma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Uma/Venkat
Thanks for the help...
Is this follwoing code inside the JSP is valid ??
<% ZgetClientListForLogonScreen myExt = new ZgetClientListForLogonScreen();
myExt.createConnection();
<b>JCO.Table myExternalTable= myExt.getLogonClientList();</b>
myExt.endConnect();
myExternalTable.firstRow();%>
<select name="zclientList" style="WIDTH: 20ex" size=1>
<% for (int i=0; i<myExternalTable.getNumRows(); i++)
{ %>
<option value="<%=myExternalTable.getField("MANDT").getValue()%>"><%=myExternalTable.getField("MANDT").getValue()%></option>
<%}%>
</select>
See the Bold Stmt JCO.Table should come from the imported jar !!
Is this fine ???
Please note that Class ZgetClientListForLogonScreen has already imported the said JAR ??
Is that necessary to have
<%@ page import= "com.sap.mw.jco.*" %>
agian ????
Thanks
Kay
Message was edited by: Kay
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.