Class for F4 Help
Hi All,
I need a class that shows the F4 Help For Fieldname of a Particular Table.
Thanks
Ravi
Hi,
use not only this method, but also the many more available in class CL_GUI_FRONTEND_SERVICES:
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Datei hochladen'
default_filename = ''
file_filter = '*.XLS'
* initial_directory = 'C:\TEMP\'
multiselection = ' '
CHANGING
file_table = file_table
rc = subrc
user_action = action
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3.
The validation must be done by YOU, depending on what you pretend.
Similar Messages
-
Unable to compile class for JSP--- help me plz!!!!!
hi friends;
Pease suggest me where i am wrong, i think javabean is not instantiated in jsp file.may be it is related to the classpath of javabean. i have not set any variable for javabean classpath. and i put javabean class file in
TOMCAT_HOME/webapps/test3/WEB-INF/UseDta.class
and all the jsp and html in /test3. my jsp an javabeans are--
1. GetName.html
<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
2. SaveName.jsp
<jsp:useBean id="user" class="UserData" scope="session">
<jsp:setProperty name="user" property="*"/>
</jsp:useBean>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
3. UserData.java
public class UserData {
String username;
String email;
int age;
public UserData(){}
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
4. NextPage.jsp
<jsp:useBean id="user" class="UserData" scope="session"/>
<HTML>
<BODY>
You entered<BR>
Name: <%= user.getUsername() %><BR>
Email: <%= user.getEmail() %><BR>
Age: <%= user.getAge() %><BR>
</BODY>
</HTML>
url: http://localhost:8080/test3/GetName.html
is it related to context path??
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:44: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
UserData user = null;
^
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:46: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = (UserData) jspxpage_context.getAttribute("user", PageContext.SESSION_SCOPE);
^
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:48: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = new UserData();
^
3 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:437)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
Apache Tomcat/5.0.30
please Reply me ASAP
i'll be glad if you reply. pleaseI am using Tomcat 6.0.
I have put my UserData class in user package and
used in below jsp(SaveName.jsp)
<%@ page import="user.UserData" %>
<jsp:useBean id="user" class="user.UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
I have already set my classpath as C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes;
UserData class is in C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes\user
My UserData class is
package user;
public class UserData {
String username;
String email;
int age;
public UserData(){
this("","",0);
System.out.println("najn thanne puli");
public UserData(String username,String email,int age){
this.username=username;
this.email=email;
this.age=age;
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
But running SaveName.jsp shows exception
org.apache.jasper.JasperException: /SaveName.jsp(2,0) The value for the useBean class attribute user.UserData is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1160)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Generator.generate(Generator.java:3372)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Please help me.thanks in advance. -
JasperException: Unable to compile class for JSP HELP
I added couple of extra class files into the jar file.. and now its not able to find it! I am running JBoss latest version and using eclipse... any help wud be nice
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
Only a type can be imported. org.jfree.chart.servlet.WebHitChart resolves to a package
Generated servlet error:
Only a type can be imported. org.jfree.chart.servlet.WebHitDataSet resolves to a package
An error occurred at line: 10 in the jsp file: /bar_chart.jsp
Generated servlet error:
WebHitChart cannot be resolved
An error occurred at line: 10 in the jsp file: /bar_chart.jsp
Generated servlet error:
WebHitDataSet cannot be resolved
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)just a random guess...
I had a ton of issues with JBoss and jfreechart. JBoss uses a different classloader, and its internal versions of the jfreechart classes will be loaded before yours, causing all sorts of issues. Dig through the jboss directories and you'll find a different, older version of jfreechart of one of its classes. Remove them and you'll be in better shape.
Alternatively, look around the JBoss docs for how to disable/turn off the unified classloader for your app (its a directive in jboss-web.xml IIRC). This should make the classloader for your webapp perform to spec, getting rid of the class colission issues. -
Extending the oracle java classes for PJCs - Help!
In developer6 (forms) - I am trying to create my own version of
certain forms components, without much look.
I have created an item in forms, ie. Checkbox, in the
'Implementation Class' field I called my java class.
My code 'extends VCheckbox' and I have created my own paint()
mthoed.
Whilst it does call and run my code there are several problems.
Mainly being that I cannot change the size the component - I have
seen the demo source code - and the examples of what I am trying
to do are less than simple (read: less than useless).
I dont not want a java bean. The forms help says I should be able
to extend the above class okay - but doesnt say what limitations
there are or what functionality there is in the oracle.forms.ui
classes.
Has anyone else actually achieved anything other than JavaBean
components?
null: Have you seen the RolloverButton example ?
: It is under Forms documentation in TechNet
: and is quite advanced.
No, have search Dev6 manuals, can not find this by searching
Technet either - can you specify (provide URL)?
I am trying to re-implement the VCheckbox using Smoking/No
Smoking images. I can create the images, but the toggling action
does not work when the component size is greater than the
original subclassed component.
None of the examples show creating components of sizes that
differ from the subclass.
Surely I only need to override paint() method?
Code fragment:
import ....
public class ImageToggler extends VCheckbox {
// ... does initialisation of images ....
// ... Images are 32x32 ...
public void paint( Graphics g ) {
if ( getState() == true ) {
g.drawImage( ysSmoke.getImage(), 0, 0,
ysSmoke.getIconWidth(),
ysSmoke.getIconHeight(), this );
} else {
g.drawImage( noSmoke.getImage(), 0, 0,
noSmoke.getIconWidth(),
noSmoke.getIconHeight(), this );
null -
Can't find "Delegate Class Name" for JDBC Helper Service
Hi,
I downloaded WLServer 6.1 with sp1 and WLPortal 4.0, installed them on Solaris 7 using default DB cloudscape -- everything was fine. Now, I'm trying to configure database to Oracle 8.1.7.
In "Configure the JDBC Helper Service" section of document "Configuring WebLogic Portal for Oracle Databases" (http://e-docs.bea.com/wlp/docs40/deploygd/oraclnew.htm), step 2 requires to enter value of "com.bea.p13n.util.jdbc.internal.OracleJDriverJdbcHelperDelegate" to "Delegate Class Name". But, I can't find this "Delegate Class Name" variable. The available varialbles on the Configuration tab on my screen are: Maximum Number of Retries, Maximum Wait Time (milliseconds), Use CLOBs for Read?, Use CLOBs for Write?. And the Configuration tab is the only available tag for JDBC Helper Service. Did I download a different version from other people? I downloaded it within 3 months.
Can anyone help?
Thanks in advance,
JaneThanks Steve.
I had my own jndi.properties file that's why it was working with ejb bean I created in the AM and not with the sdo web service.
I didn't know I had to add the jndi properties to the connection.xml maybe you can update the documentation.
<?xml version = '1.0' encoding = 'UTF-8'?>
<ns2:References xmlns:ns2="http://xmlns.oracle.com/adf/jndi">
<Reference className="oracle.jbo.client.svc.Service"
name="{/test/model/common/}DepartmentModuleService">
<Factory className="oracle.jbo.client.svc.ServiceFactory"/>
<RefAddresses>
<StringRefAddr addrType="serviceInterfaceName">
<Contents>test.model.common.serviceinterface.DepartmentModuleService</Contents>
</StringRefAddr>
<StringRefAddr addrType="serviceEndpointProvider">
<Contents>ADFBC</Contents>
</StringRefAddr>
<StringRefAddr addrType="jndiName">
<Contents>test.model.common.DepartmentModuleServiceBean</Contents>
</StringRefAddr>
<StringRefAddr addrType="serviceSchemaName">
<Contents>DepartmentModuleService.xsd</Contents>
</StringRefAddr>
<StringRefAddr addrType="serviceSchemaLocation">
<Contents>test/model/common/serviceinterface/</Contents>
</StringRefAddr>
<StringRefAddr addrType="jndiFactoryInitial">
<Contents>oracle.j2ee.rmi.RMIInitialContextFactory</Contents>
</StringRefAddr>
<StringRefAddr addrType="jndiProviderURL">
<Contents>ormi://localhost:23791/SvcInterfaceDeploy_MiddleTier</Contents>
</StringRefAddr>
<StringRefAddr addrType="jndiSecurityPrincipal">
<Contents>fmwadmin</Contents>
</StringRefAddr>
<StringRefAddr addrType="jndiSecurityCredentials">
<Contents>welcome</Contents>
</StringRefAddr>
<StringRefAddr addrType="serviceSchemaName">
<Contents>HRAppService.xsd</Contents>
</StringRefAddr>
</RefAddresses>
</Reference>
</ns2:References>
thanks edwin -
My iPad 4 tried to open application but repeatedly iCloud asked for login with apple id password. I put my apple id password correctly,even i reset it again but still it does not accepted in iPad .i am bored with this class application.please help.After every 1 second icloud logoin asked.
Find Apple ID
https://iforgot.apple.com/applied
iPad: Unable to update or restore
http://support.apple.com/kb/ht4097
iTunes: Specific update-and-restore error messages and advanced troubleshooting
http://support.apple.com/kb/TS3694
If you can’t update or restore your iOS device
http://support.apple.com/kb/ht1808
Cheers, Tom -
Hi,
Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
I have created a dynamic web project and added javax RS jars:
When im trying to run this, i'm getting the below mentioned error:
FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType. Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
Please help as im stuck with this from long.
Thanks in advance.
Below is the code for my service class:
package com.rest.assignment;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/restService")
public class RestService extends Application {
@GET
@Path("/getEmpDetails")
@Produces(MediaType.APPLICATION_JSON)
public Response getStringResponse()
EmpBean empBean = new EmpBean();
String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
Properties properties = new Properties();
try {
properties.load(new FileInputStream(filePath));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
Enumeration e = properties.propertyNames();
String result="";
String[] empDetailsArr;
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String empDetails = properties.getProperty(key);
empDetailsArr=empDetails.split(",");
empBean.setFirstName(empDetailsArr[0]);
empBean.setLastName(empDetailsArr[1]);
empBean.setEmpId(empDetailsArr[2]);
empBean.setDesignation(empDetailsArr[3]);
empBean.setSkillSet(empDetailsArr[4]);
result = empDetailsArr[1];
//return empBean;
return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(RestService.class);
classes.add(EmpBean.class);
return classes;
and my empBean goes like this:
package com.rest.assignment;
public class EmpBean {
private String firstName;
private String lastName;
private String empId;
private String designation;
private String skillSet;
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getEmpId() {
return empId;
public void setEmpId(String empId) {
this.empId = empId;
public String getDesignation() {
return designation;
public void setDesignation(String designation) {
this.designation = designation;
public String getSkillSet() {
return skillSet;
public void setSkillSet(String skillSet) {
this.skillSet = skillSet;
Web.xml goes like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>restWS</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>REST</servlet-name>
<servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.rest.assignment.RestService</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>REST</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.Hi,
Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
I have created a dynamic web project and added javax RS jars:
When im trying to run this, i'm getting the below mentioned error:
FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType. Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
Please help as im stuck with this from long.
Thanks in advance.
Below is the code for my service class:
package com.rest.assignment;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/restService")
public class RestService extends Application {
@GET
@Path("/getEmpDetails")
@Produces(MediaType.APPLICATION_JSON)
public Response getStringResponse()
EmpBean empBean = new EmpBean();
String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
Properties properties = new Properties();
try {
properties.load(new FileInputStream(filePath));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
Enumeration e = properties.propertyNames();
String result="";
String[] empDetailsArr;
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String empDetails = properties.getProperty(key);
empDetailsArr=empDetails.split(",");
empBean.setFirstName(empDetailsArr[0]);
empBean.setLastName(empDetailsArr[1]);
empBean.setEmpId(empDetailsArr[2]);
empBean.setDesignation(empDetailsArr[3]);
empBean.setSkillSet(empDetailsArr[4]);
result = empDetailsArr[1];
//return empBean;
return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(RestService.class);
classes.add(EmpBean.class);
return classes;
and my empBean goes like this:
package com.rest.assignment;
public class EmpBean {
private String firstName;
private String lastName;
private String empId;
private String designation;
private String skillSet;
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
public String getEmpId() {
return empId;
public void setEmpId(String empId) {
this.empId = empId;
public String getDesignation() {
return designation;
public void setDesignation(String designation) {
this.designation = designation;
public String getSkillSet() {
return skillSet;
public void setSkillSet(String skillSet) {
this.skillSet = skillSet;
Web.xml goes like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>restWS</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>REST</servlet-name>
<servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.rest.assignment.RestService</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>REST</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response. -
Unable to compile class for JSP
Please can anyone help me to solve this.
Actually,this is the condition.
In my db,there is a table called UserPassword, which has 4
fields(empNo,UserName,password,level). Now I want to do these things:
When the user submits the data to create a new account via HTML form, it submits the data to the file called CreateAcc.jsp. In this file it perform some logic,here are they.
1)To check the empNo,if it is already exist in the DB,
if empNo =exist then display error.(record already exist)
if empNo =notexist then do task 2).
2)check the UserName,if it is already exist in the db,
if UserName=exist then display error.(because it's a primary key)
if UserName=notexist then do task 3).
3)Create a new user account and save it to the db.
To do these tasks,I never create a new objects for the tasks 1) and 2).
only for task 3)create an object.
Is it the right way?
Here is the file CreateAcc.jsp
<%@ page language="java" %>
<%@ page import="core.UserAccManager" %>
<%@ page import="data.UserPassword" %>
<jsp:useBean id="UserAccManager" class="core.UserAccManager" scope="session"/>
<jsp:setProperty name="UserAccManager" property="*"/>
<jsp:useBean id="UserPassword" class="data.UserPassword" scope="session"/>
<jsp:setProperty name="UserPassword" property="*"/>
<%
String nextPage ="MainForm.jsp";
if(UserPassword.verifyEmpno()){
if(UserPassword.verifyUsername()){
if(UserPassword.createAcc()) nextPage ="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>The directory structure:
UserPassword.java- F:/Project/core/data/UserPassword.java
UserAccManager.java - F:/Project/core/UserAccManager.java
Now both are compiling.I put the class files into the TOMCAT,as follows.
UserAccManager.class - webapps/mySystemName/WEB-INF/classes/core/
UserPassword.class - webapps/mySystemName/WEB-INF/classes/core/data/
Here is the full code of the file UserAccManager.java.
package core; //Is this right?
import data.UserPassword; //Is this right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public final class UserAccManager{
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager(){
// Initializes the connection and statements
public static void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
// Prepare the statements
sql = "SELECT * FROM UserPassword where empNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql = "SELECT UserName FROM UserPassword where UserName= ?";
pstmt2 = connection.prepareStatement(sql);
sql ="INSERT INTO UserPassword VALUES(?,?,?,?)";
pstmt3 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
// Closes the connection and statements
// Method to be called by main class when finished with DB
public void closeConnection() {
//same as previous
public static boolean verifyEmpno(int empno) {
boolean emp_no_select_ok = false;
int emp = -1;
initConnection();
try {
pstmt1.setInt(1, empno);
ResultSet rs1 = pstmt1.executeQuery();
while(rs1.next()){
emp=rs1.getInt("empNo");
if(emp>0)
emp_no_select_ok = false;
} else{
emp_no_select_ok = true;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return emp_no_select_ok;
public static boolean verifyUsername(String username) {
boolean user_name_select_ok = false;
String user = "xxxx";
initConnection();
try {
pstmt2.setString(1, username);
ResultSet rs2 = pstmt2.executeQuery();
while(rs2.next()){
user=rs2.getString("UserName");
if(!user.equals("xxxx"))
user_name_select_ok = false;
} else{
user_name_select_ok = true;
rs2.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return user_name_select_ok;
public static boolean createAcc(int empno, String username, String password, int
level){
boolean create_acc_ok = false;
initConnection();
try{
//create a new object,from the UserPassword table.
UserPassword useraccount = new UserPassword();
useraccount.setEmpno(empno);
useraccount.setUsername(username);
useraccount.setPassword(password);
useraccount.setLevel(level);
//assign value for ???
pstmt3.setInt(1, useraccount.getEmpno());
pstmt3.setString(2, useraccount.getUsername());
pstmt3.setString(3, useraccount.getPassword());
pstmt3.setInt(4, useraccount.getLevel());
if(pstmt3.executeUpdate()==1) create_acc_ok=true;
pstmt3.close();
//con.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return create_acc_ok;
}here is the bean (part of it)
package data; //is it right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class UserPassword
private int empno;
private String username;
private String password;
private int level;
// Constructor
public UserPassword()
this.empno = empno;
this.username = username;
this.password = password;
this.level = level;
// setters and getters are here.
// public boolean verifyEmpno() {
// return UserAccManager.verifyEmpno(empno);
// public boolean verifyUsername(String username) {
// return UserAccManager.verifyUsername(username);
// These 2 methods not compile with or without para's.So I leave that job for the
//controll class UserAccManager.java.
Now my problem is this: When I submit data, there is an error;org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:8:
cannot access core.data.UserPassword
bad class file: C:\Program Files\Apache Group\Tomcat
4.1\webapps\HRM\WEB-INF\classes\core\data\UserPassword.class
class file contains wrong class: data.UserPassword
Please remove or make sure it appears in the correct subdirectory of the classpath.
import core.data.UserPassword;
^
1 error
Are there any mistakes? If so tell me where is it and how to change them.Please help.I try it that way, but it don't compile.
Error:core\data\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
core\data\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Then it compile well.I goto the directory to get the .class files.
But there is only UserPassword.class inside the data folder. There is not
UserAccManager.class in the core folder.
Then I try this way,I put my 2 java files in to a new folder,
F:\SystemName\com
When I try it that way, but it don't compile.
javac -classpath . -d . com\*.javaError:com\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
com\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Now both are compiling well.There was 2 class files.
I put them in to the WEB-INF/classes/com directory.
Start the server.But it gave errors:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserPassword.verifyEmpno(empno)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: non-static method
verifyUsername(java.lang.String) cannot be referenced from a static context
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: non-static method
createAcc(int,java.lang.String,java.lang.String,int) cannot be referenced from a static
context
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
8 errorsTo solve the problem non-static method,I goto the UserAccManager.java file and do these
things.
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*; //otherwise it tells an error.(package
//javax.servlet does not exist)
//import javax.servlet.http.*;
public class UserAccManager {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager() {
// Initializes the connection and statements
private static void initConnection() {
//same
// Closes the connection and statements
// Method to be called by main class when finished with DB
public static void closeConnection() {
//same
public static boolean verifyEmpno(int empno) {
// same.
public static boolean verifyUsername(String username) {
//same.
public static boolean createAcc(int empno, String username, String password, int
level){
//same
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*;
//import javax.servlet.http.*;
public class UserPassword {
// same
Again compile those files and put .class filses into the WEB-INF/classes/com directory.
When i submits the data via the form it generates an error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyEmpno(empno)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
6 errorshere is the CreateAcc.jsp file
<%@ page language="java" %>
<%@ page import="com.UserAccManager" %>
<%@ page import="com.UserPassword" %>
<jsp:useBean id="userPassword" class="com.UserPassword" scope="request"/>
<jsp:setProperty name="userPassword" property="*" />
<%
String nextPage ="MainForm.jsp";
if(UserAccManager.verifyEmpno(empno)){
if(UserAccManager.verifyUsername(username)){
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>Please, anyone know how to send these parameters to the java file.
Thanks. -
How to use inbound exit class for more than one workflow step
Hi All,
In Offline Workflow Approval Scenarios where the work items are sent to outlook of non sap users inbox through workitem exit of the respective workflow item. Based on the user reply from outlook email(either approve or reject) which sends an auto reply to Offline user . We configure an inbound exit class and assign the same in the SMICM transaction. Based on the code written using SAP_WAPI function modules in inbound class exit offline user gets the user approval result and performs the action in SAP.
My question now Is how can we use this inbound exit class for all the steps of a workflow.
For ex: In a workflow I have a decision step followed by an activity step. First I will write the work item exit for the user decision step and inbound exit code for the user decision step and offline user executed the user decision step with approve action.
followed by that I have an activity step for that I will code a work item exit for that activity level but how can I user the same inbound exit class for the activity step as well .
Quick reply would be of great help for me.
With Best Regards,
VeniFor the outbound processing you have the option of replacing the workflow exit by chancing the bsp application of the extended notification (see note 1448241 solution as an example of how to do the change) and replacing the standard links with a "mailto:...".
As far as the inbound processing, that depends on what should be done in the activity step, if for example you have a bapi which executes what the user does you can call it in the inbound class instead of the user and then the relevant wapi (complete the workitem/raise event etc.). -
How to specify a base class for Remote Interface in Workshop 9.2? -- URGENT
Hi,
I am trying to create a UUP EJB in WebLogic 9.2 workshop. I am using @FileGeneration to create my home & remote interfaces. And the generated remote interface is extending javax.ejb.EJBObject;I want my remote interface to extend com.bea.p13n.property.EntityPropertyManager which in turn implements javax.ejb.EJBObject. Can someone tell how i can do it in Workshop?.
I came across Predefined Variable: remote.baseClass and as per docume
ntation..."If specified, the value of this variable will be used as the base class for all generated remote classes. Where i should specify it?. @FileGeneration does nt have any option for it. Any help is grtly appreciated.
Following are my code snippets:
IMPL Class
@FileGeneration(remoteClass = Constants.Bool.TRUE,remoteHome = Constants.Bool.TRUE, localClass = Constants.Bool.FALSE, localHome = Constants.Bool.FALSE,remoteClassName = "MyEntityPropertyManager",remoteHomeName = "MyEntityPropertyManagerHome")
public class MyEntityPropertyManagerImpl extends GenericSessionBean implements
SessionBean {
//code
}This question was posted to both the bea.workshop.developer.general and weblogic.developer.interest.workshop (I had replied to the later on 10/19); after seeing an identical question today on this list want to include a reference to that reply here:
http://forums.bea.com/bea/message.jspa?messageID=600044925&tstart=0
-Rob -
A Potential Convert Looking for Some Help with Boot Camp
I posted this in the Macbook Pro forums, and somebody directed me here. Hopefully you can help me with my questions.
Hello,
I have been a PC user ever since I can remember. I have loved the operating system and have had a Dell Laptop for 4 years now without any problems at all. I have no qualms with the Windows Operating Systems. But, it is time for me to get a new laptop, as I will soon be heading off to college. I was thinking about getting another PC, as they are significantly cheaper than the lower-end MBP that I would get, but I was also thinking about trying out a Mac. I plan on using this laptop for most of my undergraduate education though, so I don't want to buy something and find out it isn't what I want or I can't use it. So, if you would help me, I would like to ask some questions about the lower-end Macbook Pro, and I may just end up getting one.
First things first, I am going to be going into engineering, likely mechanical or systems, at either WPI, Northeastern, or Tufts. Ah the experience of choosing colleged. I know Tufts uses AutoCAD, WPI uses SolidWorks, but I am not sure which Northeastern uses. Either way, I most certainly will be using a CAD program. I know that most CAD programs do not work on Macs, so I will likely be using Boot Camp. I have though seen on these boards that the AutoCAD licensing does not work with Boot Camp, or that some users have faced major problems with it. If this is so, then it is highly likely that I will be unable to get a Mac as that program is going to be an absolute necessity. Even if this is just a small percentage of the population, I do not want to find mine being of major issue. For those of you who have gotten it to work, how difficult was the installation, and have you had any issues with AutoCAD or the like? With this in mind, would you even suggest that I get a MBP?
Another Boot Camp question. I have read many posts on these boards discussing different partitioning options, yet I still am unsure what they all mean. I expect to use the Windows side for more than just AutoCAD. I likely will install some games on it for when I am bored, and Microsoft Office, as I do not wish to spend the extra money buying Office for Mac and I need to have the versatility of Excel that I have heard is not found in the Mac version. What is the difference between these two partitioning types, which would you recommend, and how much storage should I partition if I get a 200GB hard drive?
Yet another Boot Camp question, sorry for so many of these. My friend who has a Mac lauds it for its security, nobody makes viruses for Macs. As I will most definitively be using Windows in Boot Camp, would this compromise this security? I know it will be Windows, but I still imagine that it would be encoded somewhat differently then normal, but I could be wrong. Also, if it is possible for the Windows portion to get a virus, could that affect the Mac portion?
Also, I don't use an iPod. I suppose I always thought they were overpriced for what they do. Instead I use an Iriver Clix 2, and I love it. The only thing is, I use Windows Media Player to sync it with my library. I know many have qualms with WMP, but I personally favor it more than iTunes, but that is just me. I do not believe that you can download it for a Mac. If I were to download it for the Windows portion, I am assuming that I would have to switch to Windows in order to listen to my music then, correct? I can also add music to it via Windows Explorer. Can I do so through the "Finder"?
Finally, is the battery life any different when using Windows than when using Leopard? I will likely be using the Windows portion in the class room.
Sorry for the long-winded post, but I am certainly hoping that I can get some solid answers to make an educated decision before getting my next laptop. I would like to thank you very much for any help that you are able to give me. I do hope you can help me quickly. Thank you.
Message was edited by: PyrojoeI can't answer all your questions, especially not anything having to do with CAD.
I still imagine that [Windows] would be encoded somewhat differently then normal,
No. Windows is Windows. You will need a good Windows antivirus, firewall and antispyware program. It is unlikely that a Windows virus will infect the Mac partition because, ordinarily, Windows doesn't know how to do anything with the HFS+ formatted Mac partition. However, the existence of products like MacDrive means that it is possible to teach Windows how to write to the Mac partition, so I see no reason why a virus could not be programmed to.
If I were to download it for the Windows portion, I am assuming that I would have to switch to Windows in order to listen to my music then, correct? I can also add music to it via Windows Explorer. Can I do so through the "Finder"?
Yes. Probably/yes.
Finally, is the battery life any different when using Windows than when using Leopard?
Yes. Windows does not have the battery management that Leopard has. The battery runs down much quicker in Windows.
You didn't ask, but depending on what kind of engineering you want to study, you may be interested in, or even need to, use some flavour of Unix/Linux. On the one hand, you could always create a partition on a PC--or wipe Windows--and install Linux on the PC. That could even be a good learning experience. On the other hand, Mac OS is Unix, but preinstalled. So with a Mac, you would already have a platform for writing shell scripts, you would have Perl and Python built-in, you would have an IDE (XCode Tools) for C/C++/Objective C/Java as well as gcc and make tools already on the disks which come with the computer, and so on.
Message was edited by: Mr.Lobotomy -
Need to create a driver class for a program i have made...
hey guys im new to these forums and someone told me that i could get help on here if i get in a bind...my problem is that i need help creating a driver class for a program that i have created and i dont know what to do. i need to know how to do this is because my professor told us after i was 2/3 done my project that we need at least 2 class files for our project, so i need at least 2 class files for it to run... my program is as follows:
p.s might be kinda messy, might need to put it into a text editor
Cipher.java
This program encodes and decodes text strings using a cipher that
can be specified by the user.
import java.io.*;
public class Cipher
public static void printID()
// output program ID
System.out.println ("*********************");
System.out.println ("* Cipher *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* CS 181-03 *");
System.out.println ("*********************");
public static void printMenu()
// output menu
System.out.println("\n\n****************************" +
"\n* 1. Set cipher code. *" +
"\n* 2. Encode text. *" +
"\n* 3. Decode coded text. *" +
"\n* 4. Exit the program *" +
"\n****************************");
public static String getText(BufferedReader input, String prompt)
throws IOException
// prompt the user and get their response
System.out.print(prompt);
return input.readLine();
public static int getInteger(BufferedReader input, String prompt)
throws IOException
// prompt and get response from user
String text = getText(input, prompt);
// convert it to an integer
return (new Integer(text).intValue());
public static String encode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String encoded = ""; // base for string to return
char letter; // letter being processed
// convert message to upper case
original = original.toUpperCase();
// process each character of the message
for (int index = 0; index < original.length(); index++)
// get the letter and determine whether or not to
// add the cipher value
letter = original.charAt(index);
if (letter >='A' && letter <= 'Z')
// is A-Z, so add offset
// determine whether result will be out of A-Z range
if ((letter + offset) > 'Z') // need to wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE + offset);
else
if ((letter + offset) < 'A') // need to wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE + offset);
else
letter = (char) (letter + offset);
// build encoded message string
encoded = encoded + letter;
return encoded;
public static String decode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String decoded = ""; // base for string to return
char letter; // letter being processed
// make original message upper case
original = original.toUpperCase();
// process each letter of message
for (int index = 0; index < original.length(); index++)
// get letter and determine whether to subtract cipher value
letter = original.charAt(index);
if (letter >= 'A' && letter <= 'Z')
// is A-Z, so subtract cipher value
// determine whether result will be out of A-Z range
if ((letter - offset) < 'A') // wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE - offset);
else
if ((letter - offset) > 'Z') // wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE - offset);
else
letter = (char) (letter - offset);
// build decoded message
decoded = decoded + letter;
return decoded;
// main controls flow throughout the program, presenting a
// menu of options the user.
public static void main (String[] args) throws IOException
// declare constants
final String PROMPT_CHOICE = "Enter your choice: ";
final String PROMPT_VALID = "\nYou must enter a number between 1" +
" and 4 to indicate your selection.\n";
final String PROMPT_CIPHER = "\nEnter the offset value for a caesar " +
"cipher: ";
final String PROMPT_ENCODE = "\nEnter the text to encode: ";
final String PROMPT_DECODE = "\nEnter the text to decode: ";
final String SET_STR = "1"; // selection of 1 at main menu
final String ENCODE_STR = "2"; // selection of 2 at main menu
final String DECODE_STR = "3"; // selection of 3 at main menu
final String EXIT_STR = "4"; // selection of 4 at main menu
final int SET = 1; // menu choice 1
final int ENCODE = 2; // menu choice 2
final int DECODE =3; // menu choice 4
final int EXIT = 4; // menu choice 3
final int ALPHABET_SIZE = 26; // number of elements in alphabet
// declare variables
boolean finished = false; // whether or not to exit program
String text; // input string read from keyboard
int choice; // menu choice selected
int offset = 0; // caesar cipher offset
// declare and instantiate input objects
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
// Display program identification
printID();
// until the user selects the exit option, display the menu
// and respond to the choice
do
// Display menu of options
printMenu();
// Prompt user for an option and read input
text = getText(input, PROMPT_CHOICE);
// While selection is not valid, prompt for correct info
while (!text.equals(SET_STR) && !text.equals(ENCODE_STR) &&
!text.equals(EXIT_STR) && !text.equals(DECODE_STR))
text = getText(input, PROMPT_VALID + PROMPT_CHOICE);
// convert choice to an integer
choice = new Integer(text).intValue();
// respond to the choice selected
switch(choice)
case SET:
// get the cipher value from the user and constrain to
// -25..0..25
offset = getInteger(input, PROMPT_CIPHER);
offset %= ALPHABET_SIZE;
break;
case ENCODE:
// get message to encode from user, and encode it using
// the current cipher value
text = getText(input, PROMPT_ENCODE);
text = encode(text, offset);
System.out.println("Encoded text is: " + text);
break;
case DECODE:
// get message to decode from user, and decode it using
// the current cipher value
text = getText(input, PROMPT_DECODE);
text = decode(text, offset);
System.out.println("Decoded text is: " + text);
break;
case EXIT:
// set exit flag to true
finished = true ;
break;
} // end of switch on choice
} while (!finished); // end of outer do loop
// Thank user
System.out.println("Thank you for using Cipher for all your" +
" code breaking and code making needs.");
}My source in code format...sorry guys :)
Cipher.java
This program encodes and decodes text strings using a cipher that
can be specified by the user.
import java.io.*;
public class Cipher
public static void printID()
// output program ID
System.out.println ("*********************");
System.out.println ("* Cipher *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* *");
System.out.println ("* CS 181-03 *");
System.out.println ("*********************");
public static void printMenu()
// output menu
System.out.println("\n\n****************************" +
"\n* 1. Set cipher code. *" +
"\n* 2. Encode text. *" +
"\n* 3. Decode coded text. *" +
"\n* 4. Exit the program *" +
"\n****************************");
public static String getText(BufferedReader input, String prompt)
throws IOException
// prompt the user and get their response
System.out.print(prompt);
return input.readLine();
public static int getInteger(BufferedReader input, String prompt)
throws IOException
// prompt and get response from user
String text = getText(input, prompt);
// convert it to an integer
return (new Integer(text).intValue());
public static String encode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String encoded = ""; // base for string to return
char letter; // letter being processed
// convert message to upper case
original = original.toUpperCase();
// process each character of the message
for (int index = 0; index < original.length(); index++)
// get the letter and determine whether or not to
// add the cipher value
letter = original.charAt(index);
if (letter >='A' && letter <= 'Z')
// is A-Z, so add offset
// determine whether result will be out of A-Z range
if ((letter + offset) > 'Z') // need to wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE + offset);
else
if ((letter + offset) < 'A') // need to wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE + offset);
else
letter = (char) (letter + offset);
// build encoded message string
encoded = encoded + letter;
return encoded;
public static String decode(String original, int offset)
// declare constants
final int ALPHABET_SIZE = 26; // used to wrap around A-Z
String decoded = ""; // base for string to return
char letter; // letter being processed
// make original message upper case
original = original.toUpperCase();
// process each letter of message
for (int index = 0; index < original.length(); index++)
// get letter and determine whether to subtract cipher value
letter = original.charAt(index);
if (letter >= 'A' && letter <= 'Z')
// is A-Z, so subtract cipher value
// determine whether result will be out of A-Z range
if ((letter - offset) < 'A') // wrap around to 'Z'
letter = (char)(letter + ALPHABET_SIZE - offset);
else
if ((letter - offset) > 'Z') // wrap around to 'A'
letter = (char)(letter - ALPHABET_SIZE - offset);
else
letter = (char) (letter - offset);
// build decoded message
decoded = decoded + letter;
return decoded;
// main controls flow throughout the program, presenting a
// menu of options the user.
public static void main (String[] args) throws IOException
// declare constants
final String PROMPT_CHOICE = "Enter your choice: ";
final String PROMPT_VALID = "\nYou must enter a number between 1" +
" and 4 to indicate your selection.\n";
final String PROMPT_CIPHER = "\nEnter the offset value for a caesar " +
"cipher: ";
final String PROMPT_ENCODE = "\nEnter the text to encode: ";
final String PROMPT_DECODE = "\nEnter the text to decode: ";
final String SET_STR = "1"; // selection of 1 at main menu
final String ENCODE_STR = "2"; // selection of 2 at main menu
final String DECODE_STR = "3"; // selection of 3 at main menu
final String EXIT_STR = "4"; // selection of 4 at main menu
final int SET = 1; // menu choice 1
final int ENCODE = 2; // menu choice 2
final int DECODE =3; // menu choice 4
final int EXIT = 4; // menu choice 3
final int ALPHABET_SIZE = 26; // number of elements in alphabet
// declare variables
boolean finished = false; // whether or not to exit program
String text; // input string read from keyboard
int choice; // menu choice selected
int offset = 0; // caesar cipher offset
// declare and instantiate input objects
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
// Display program identification
printID();
// until the user selects the exit option, display the menu
// and respond to the choice
do
// Display menu of options
printMenu();
// Prompt user for an option and read input
text = getText(input, PROMPT_CHOICE);
// While selection is not valid, prompt for correct info
while (!text.equals(SET_STR) && !text.equals(ENCODE_STR) &&
!text.equals(EXIT_STR) && !text.equals(DECODE_STR))
text = getText(input, PROMPT_VALID + PROMPT_CHOICE);
// convert choice to an integer
choice = new Integer(text).intValue();
// respond to the choice selected
switch(choice)
case SET:
// get the cipher value from the user and constrain to
// -25..0..25
offset = getInteger(input, PROMPT_CIPHER);
offset %= ALPHABET_SIZE;
break;
case ENCODE:
// get message to encode from user, and encode it using
// the current cipher value
text = getText(input, PROMPT_ENCODE);
text = encode(text, offset);
System.out.println("Encoded text is: " + text);
break;
case DECODE:
// get message to decode from user, and decode it using
// the current cipher value
text = getText(input, PROMPT_DECODE);
text = decode(text, offset);
System.out.println("Decoded text is: " + text);
break;
case EXIT:
// set exit flag to true
finished = true ;
break;
} // end of switch on choice
} while (!finished); // end of outer do loop
// Thank user
System.out.println("Thank you for using Cipher for all your" +
" code breaking and code making needs.");
} -
Error while mapping a Java class for a Search Dialog Box component
Hi,
Scenario : There is PAR which I have developed for the sorting options for a Search Component set to be used in Km Search Iview.
I have copied this PAR from a similiar search functionality and customised the same.
Problem: When I deploy the PAR and then map this class for the sort options while creating a New Search Dialog box :
I get the following "Class not found error" ... Please can you let me know what could be the problem.
Any help would be appreciated here as I have tried all the possibilities to solve the problem.
Regards,
Vaishali.I modified the xml file as described in the forum.But the error persists.
One interesting thing is:
When I create model after restarting the NDS,I get the following error:
org.eclipse.swt.SWTException: Failed to execute runnable <i>(java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
JCO.nativeInit(): Could not initialize dynamic link library librfc. Found version "620.0.1237" but required at least version "620.0.1374".)</i>
I get the NoClassDef found error next time onwards,
Where do I get the 620.0.1374 version of librfc?
thanx.
Bhupesh -
Error while saving Prod order - "Class for order classification"
Hi all
I am getting the following error while saving the Production Order -
"Class for order classification has not been generated".
I went into the custiomization settings and tried to generate the class. But I get another error "No batch input data for screen SAPMSSY3 0131". The line items are also all in red and green.
Any help would be highly appreciated.
Thanks in advance.
HrishiSolved
-
Best Practice for WSDL Generate Proxy Class for Web Service with Two Versions
Dear All
Thank you in advance for you help.
I would like to generate proxy classes for same function but with two versions.
Old version web service (v23.2) is used for stable modules in a project which is not going to modify.
However, enhancement is added in new version web service (v24) and is going to use in any future modules.
For example,
wsdl.exe -o="TestProxy.cs" -l:CS -n:Test -sharetypes https://community.workday.com/custom/developer/API/Notification/v23.2/Notification.wsdl https://community.workday.com/custom/developer/API/Notification/v24.0/Notification.wsdl
It generates similar classes with an '1' added at the end of the class name.
ublic partial class Event_TargetObjectType {
private Event_TargetObjectIDType[] idField;
public partial class Event_TargetObjectType1 {
private Event_TargetObjectIDType1[] idField; ...}
Since the function inside some class is the same, is it possible for WSDL.exe to generate proxy classes automatically that if the class is the same, then generate one class only (sameFunction()) but if it detects the class is different, then add '1'
to the end of class name (differentFunction() and differentFunction1())
i.e.
public class sameFunction()
public class differentFunction()
private int a;}
public class differentFunction1()
{ private int b;
Best Regards
mintssoulHi mintssoul,
As per this case, I have shared corresponding details below :
1.As far as I know, WCF doesn’t support method overloading directly
2.Because WSDL doesn’t support method overloading (not OOPs).
3.WCF generates WSDL which specifies the location of the service and the operation or methods the service exposes.
4.WCF use Document/Literal WSDL Style : Microsoft proposed this standard where the soap body element will contain the web method name.
5.By default all the WCF services conform to the document literal standard where the soap body should include the method name.
6.but you can differ the method in the same manually by using Name attribute like below
For example:
[OperationContract(Name="Integers")]
int Display(int a,int b)
[OperationContract(Name="Doubles")]
double Display(double a,double b)
7. Or I suggest you that can use svcutil to map multiple namespaces for generating wcf service proxies .
for more information about this, refer here :
http://stackoverflow.com/questions/1103686/use-svcutil-to-map-multiple-namespaces-for-generating-wcf-service-proxies
Maybe you are looking for
-
hi friends In MCSI report, we select S907 info structure in the combination of Dist channel, Divi, Sales office,Sold to party and period I Hav given dc-10,div-10, soldtoparty-50301and period 1.9.08 to 30.9.08 then screen displays with following detai
-
Error in simple(File-XI-File)scenario
Hi, Using this blog i was doing simple(File-XI-File)scenario. /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1 But i am getting the error Runtime error com.sap.aii.utilxi.mis
-
Export and Import of BI Objects
Hello. I am trying to move existing BI objects (defined in RSA1) from an internal SAP IDES demo system to an offline, standalone NW 2004s BI system that is on a laptop. Essentially I want to export the objects that already exist in the IDES system
-
How i can print the Stacktrace
hii.. i want to print the stacktrace for my program below.. package Langpack; import java.io.*; import java.sql.*; import java.util.*; public class LanguageFunctions extends Databaseclass public LanguageFunctions() super(); LanguageDet
-
ill be glad for answers.