Tips on how to write efficient java code for java mapping
hi
I do not have much knowledge in Java
Can anybody tell me some tips on how to write efficient and optimised java code to be used in java mapping
Thanks,
Loveena
hi D'za,
JAVA in xi
A very important place where you will use JAVA in XI is while doing your Mapping. There will be cases when JAVA MAPPING is the best solution to go for. There are 2 types of Parsers available for JAVA Mapping. DOM Parser and SAX parser. Just got through the following links to understand more on Java Mapping and the APIs available.http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
JAVA mapping -
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
sample code for java mapping
Re: Example code DOM PARSER API -
http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html DOM --- /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs tutorial sax and dom
For a tutorial on the methods of SAX and DOM http://java.sun.com/webservices/docs/1.1/tutorial/doc/
SAX AND dom PARSER ( BY thorsten) -
example /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs java mapping example ( testing and debugging) /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
regards
biplab
Use a Good Subject Line, One Question Per Posting - Award Points
Similar Messages
-
How do I rewrite current code for java 1.3
I'm using the code below that is written for java 1.4. I have been told that the company can not push JRE 1.4 to the company, and that I need to write my code for java 1.3. I'm using org.w3c.dom for my create xml, etc.
Is there a java 1.3 option to the 1.4? Any help would be very appreciated.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.List;
import java.io.*;
import java.util.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
public class Sametime extends JFrame implements ActionListener {
private int indentation = -1;
JPanel panel = new JPanel();
JTextArea jta = new JTextArea(
//Instructions for user
"For a successful buddy list migration do the following:\n"
+ "1. Save your current Sametime Buddy List to your PC.\n "
+ "The default location should be: C:/Program Files/Lotus/Sametime Client.\n"
+ " A. Open the Sametime Client.\n"
+ " B. Click on People\n"
+ " C. Click on Save List.\n"
+ " D. Save as your first.last.dat\n"
+ " Ex. john.doe.dat\n"
+ "NOTE: If you have AOL contacts in your Sametime buddy list they will not be migrated.\n");
JButton browse = new JButton("Continue");
JButton exit = new JButton("Exit");
public Sametime() {
super("Sametime Buddy List Migration");
setSize(610, 245);
Container c = this.getContentPane();
c.add(panel);
browse.addActionListener(this);
exit.addActionListener(this);
panel.add(jta);
panel.add(browse);
panel.add(exit);
jta.setEditable(false);
setLookAndFeel();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} //end Sametime
public class DATFilter extends javax.swing.filechooser.FileFilter {
public boolean accept(File f) {
//if it is a directory -- we want to show it so return true.
if (f.isDirectory())
return true;
String extension = getExtension(f);//get the extension of the file
//check to see if the extension is equal to "dat"
if ((extension.equals("dat")))
return true;
//default -- fall through. False is return on all
//occasions except:
//a) the file is a directory
//b) the file's extension is what we are looking for.
return false;
}//end accept
public String getDescription() {
return "dat files";
}//end getDescription
* Method to get the extension of the file, in lowercase
private String getExtension(File f) {
String s = f.getName();
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1)
return s.substring(i+1).toLowerCase();
return "";
}//end getExtension
}//end class DATFilter
public void actionPerformed(ActionEvent e) {
//Default Location for JFileChooser search
String error = "The file selected is not a .dat file!\n"
+ "Please select your recently saved .dat file and try again.";
JFileChooser fc = new JFileChooser("/Program Files/Lotus/Sametime Client");
fc.setFileFilter(new DATFilter());
fc.setFileSelectionMode( JFileChooser.FILES_ONLY);
String user = System.getProperty("user.name");// finds who the current user is
if (e.getSource() == browse) {
int returnVal = fc.showSaveDialog(Sametime.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
//if (fc.getSelectedFile().getName().equals(".dat")){
if (fc.getSelectedFile().getName().endsWith(".dat")){ // checks to see if selected file is .dat
}else{
JOptionPane.showMessageDialog(null, error, "Wrong File", JOptionPane.ERROR_MESSAGE);
return;
}//end else
try {
String[] contactArray = parseDatFile(fc.getSelectedFile());
Document document = createXMLDocument(contactArray);
saveToXMLFile(
document,
new File(
"C:/Documents and Settings/" + user +"/My Documents/OLCS/",// looks for directory for list
"contacts-list_migration.ctt"));
} catch (Exception exc) {
File f = new File("C:/Documents and Settings/" + user +"/My Documents/OLCS/");// setting directory for list if not there
boolean yes = true;
yes = f.mkdir();// creating directory
try {
String[] contactArray = parseDatFile(fc.getSelectedFile());
Document document = createXMLDocument(contactArray);
saveToXMLFile(
document,
new File(
"C:/Documents and Settings/" + user +"/My Documents/OLCS/",// used only if the directory didn't exist
"contacts-list_migration.ctt"));
//exc.printStackTrace();// not sure if this is needed?
} catch (Exception exc1) {
exc1.printStackTrace();
}//end inner catch
}// end catch
}// end if
if(returnVal==JFileChooser.CANCEL_OPTION){
String Warning = "You did not migrate your Sametime buddy list at this time.";
JOptionPane.showMessageDialog(null, Warning, "Migration Canceled", JOptionPane.WARNING_MESSAGE);
return;
}else{
String thankyou = "Thank You for Migrating your Sametime buddy list to OLCS"
+ "\nYour new OLCS buddy list has been saved to:"
+ "\nC:/Documents and Settings/" + user +"/My Documents/OLCS"
+ "\n as: Contact-List_migration.ctt"
+ "\n\n To be able to use Contact-List_migration.ctt for Windows Messenger:"
+ "\n1. Log into Windows Messenger."
+ "\n2. Click on File"
+ "\n3. Click on 'Import Contacts from a Saved File...'"
+ "\n4. Open OLCS in My Documents"
+ "\n5. Click on 'Contact-list_migration.ctt'"
+ "\n6. Click Open to import the list."
+ "\n A window will pop up confirming that you want to add all of the contacts"
+ "\n Click 'yes'"
+ "\n Your buddy list is ready to be used.";
JOptionPane.showMessageDialog(null, thankyou, "Migration Completed", JOptionPane.INFORMATION_MESSAGE);//Change this when defualt directory is known.
}//end if else statement
} //end if
System.exit( 0 );
if (e.getSource() == exit) {
System.exit( 0 );
} //end if
} //end actionPerformed
String[] parseDatFile(File datFile)
throws Exception {
List list = new ArrayList();
BufferedReader br = new BufferedReader(new FileReader(datFile));
String line;
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.indexOf("U") != 0)
continue;
int p = line.indexOf("::");
if (p == -1)
continue;
line = line.substring(p + 2).trim();
if (line.indexOf("AOL") == 0)
continue;
p = line.indexOf(",");
if (p != -1)
line = line.substring(0, p);
line = line.trim() + "@mci.com";
if (list.indexOf(line) == -1)
list.add(line);
}//end while
br.close();
String[] contactArray = new String[list.size()];
list.toArray(contactArray);
return contactArray;
}// end String
// setting up the XML file
Document createXMLDocument(String[] contactArray) throws Exception {
DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dBF.newDocumentBuilder();
DOMImplementation domImpl = builder.getDOMImplementation();
Document document = domImpl.createDocument(null, "messenger", null);
Element root = document.getDocumentElement();
Element svcElm = document.createElement("service");
Element clElm = document.createElement("contactlist");
svcElm.setAttribute("name", "Microsoft RTC Instant Messaging");
svcElm.appendChild(clElm);
root.appendChild(svcElm);
for (int i = 0; i < contactArray.length; i++) {
Element conElm = document.createElement("contact");
Text conTxt = document.createTextNode(contactArray);
conElm.appendChild(conTxt);
clElm.appendChild(conElm);
}//end for
return document;
}// end Document
void saveToXMLFile(Document document, File xmlFile) throws Exception {
OutputStream os =
new BufferedOutputStream(new FileOutputStream(xmlFile));
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");//puts information on seperate lines
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");//gives the XML file indentation
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(os);
transformer.transform(source, result);
os.close();
}//end saveToXMLFile
public static void main(String[] args) {
Sametime st = new Sametime();
ImageIcon picIcon = new ImageIcon(st.getClass().getResource("/images/mci.gif"));//Change when default is known!
st.setIconImage(picIcon.getImage());
} //end main
private void setLookAndFeel() {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(this);
} catch (Exception e) {
System.err.println("Could not use Look and Feel: " + e);
} //end catch
} //end void setLookAndFeel
} //end public class SametimeAre there features of Java 1.4 that you specifically took advantage and are there any particular lines you are having problems with or did you just freak and post it here?
Basically compile it under Java 1.3 and see what complains. I've done several projects that compile under 1.2, 1.3, and 1.4. -
How to write the dynamic code for RadioGroupByKey and Check Boxes?
Hi,
Experts,
I have created a WD ABAP application in that i have used RadioGroupByKey and CheckBox Ui elements but i want how to write the dynamic code to that i want to display male and female to RadioGroupByKey and 10 lables to check boxs.
Please pass me some idea on it and send any documents on it .
Thanks in advance ,
Shabeer ahmed.Refer this for check box:
Do check :
bind_checked property is bind to a node with cardinality of 1:1
CHECK_BOX_NODE <---node name
-CHECK_BOX_VALUE <--attribute name of type wdy_boolean
put this code under your WDDOMODIFYVIEW:
DATA:
lr_container TYPE REF TO cl_wd_uielement_container,
lr_checkbox TYPE REF TO cl_wd_checkbox.
get a pointer to the RootUIElementContainer
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_checkbox = cl_wd_checkbox=>new_checkbox(
text = 'WD_Processor'
bind_checked = 'CHECK_BOX_NODE.CHECK_BOX_VALUE'
view = view ).
cl_wd_matrix_data=>new_matrix_data( element = lr_checkbox ).
lr_container->add_child( lr_checkbox ).
Refer this for Radiobutton :
dynamic radio button in web dynpro abao
Edited by: Saurav Mago on Jul 17, 2009 10:43 PM -
How to write the ABAP code for Datasource Enhancment
Hi Team,
Can you please help me how to write the code for the enhancement i have made to the standard datasource
i have added the fields ZZPayer and ZZPayer_access.
I just wanted to know how to write the ABAP code to populate the data for these fields.
Regards,
Pradeep P.Hi
From a performance point of view would like to suggest a few changes :
WHEN '<DS name>'.
select zzfields from <table> into itab
for all entries in c_t_data where <condition>.
If sy_subrc = 0.
loop at c_t_data assiging f_c_t_data.
read itab into wa_itab where key = f_c_t_data-key.
f_c_t_data-zzfield = wa-itab-zzfield.
endloop.
refresh itab.
regards,
aparna
endif. -
Java code for Graphical Mapping
Hi,
I am new to the XI world.I read that when we do graphical mapping a java code is generated in the background.
Can any one tell me how to access that code ?
Any help would be appreciated.
Thnx.hi,
you can find it in the XI server folders
have a look at my previous response:
Re: Access to Java mapping code?
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
How to get the source code of Java Concurrent Program?
Hi,
How to get the source code of Java Concurrent Program?
Example
Programe Name:Format Payment Instructions
Executable:Format Payment Instructions
Execution File Name:FDExtractAndFormatting
Execution File Path:oracle.apps.iby.scheduler
Thanks in advance,
SenthilGo on Unix box at $JAVA_TOP/oracle/apps/iby/scheduler
You will get class file FDExtractAndFormatting.
Decompile it to get source code.
Thanks, Avaneesh -
How to write a messenger with using java?
May I know how to write a messenger with using java? The messenger need included two functions which are file transfer and add users to join the conversation.
Thank you.Ok, so you need to start from the beginning, the requirements, is it a swing (i.e. GUI) app, web app, console, etc...?
As stated by sprizor making an IM client is no easy task, you need to both implement the server side and the client side, which both communicate with each other, file transfers are also quite complex, and even maintaining a multi-user chat can be quite difficult.
If you are after a Web Based app, then you will need to look into Push technologies, like Grizzly Comet which is a nice wrapper for the NIO java stuff:
https://grizzly.dev.java.net/
Good luck... -
How can i merge javafx code and java fxml code in a single project
how can i merge javafx code and java fxml code in a single project.
Please let me Know as soon as possible.Everything that it is possible to retrieve from a class file can be deduced from the class file definition.
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html
Sylvia. -
Hi All,
Not sure if this is the correct forum, so if i'm in the wrong place apologies and if possible could you point me in the right direction. If I am in the right place, here it goes......
we're using R/3 4.7, MSS 6.1.20. We're just beginning to implement MSS. I'm wondering if anyone could give me a couple of examples of which MSS options are based on java iviews, where is the code for these java ivews stored on the system and do i have to do anything special to extract this code.
the reason i want the code is that i want to copy it and see how difficult it is to make changes to the code in netweaver developer studio.
Also, as i'm new to all this, if anyone knows of a good source of info for java iview creation/manipulation, please let me know.
Kind regards,
Liz.Hi,
This is how we access java code for ESS applications. I hope it is the same for MSS as well.
Open your NWDS -> Window -> Preferences -> Java Development Infrastructure -> Development Configurations.
Provide the Landscape directory server in URL field. something like http://<server name>:<port number>. Ping and confirm the connections. Save the settings.
Now select Window -> Open Perspective -> Development Configurations.
Right click on the Offline and select Import configurations. Select remote option and import the respective items from the server. Create a project for the required inactive DC and you will be able to edit the code in webdynpro perspective.
Hope this helps.
Thanks,
Preetham -
How to convert these java codes (for a feedback) to javabean?
Can anyone please help me to convert these java codes (for feedback) to javabean using the MVC Model-View-Controller pattern design?
<%
//instantiate variables
Connection con = null;
Statement stmt = null;
Statement stmt2 = null;
ResultSet rs = null;
String queryString;
int newInBoxMsg = 0;
int newSentMsg = 0;
int newSavedMsg = 0;
int newTrashCanMsg = 0;
String currentUserID = 1+"";
String adminID = 1+""; //change this ID to your adminID in the db
try
//Load the JDBC driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
//Get the connection getConnection("access driver", "userID", "password")
con = DriverManager.getConnection("jdbc:odbc:FREN_DB","","");
stmt = con.createStatement();
//sql statements: create, update, query
Calendar cl = Calendar.getInstance();
%>
<%
if(request.getMethod()=="POST"){
int y = stmt.executeUpdate("INSERT into Feedback(`whom`, `msg`, `date`)"
+" values ('"+currentUserID+"', '"+request.getParameter("date")+"', '"
request.getParameter("msg")"')");
int x = stmt.executeUpdate("INSERT into MailBox(`whom`, `who`, `mailheader`, `mailbody`, `date`)"
+" values ('"+adminID+"', '"+currentUserID+"', 'Feedback', 'We have received your feedback and we will respond to you as soon as possible', '"+request.getParameter("date")+"')");
out.println("Feedback Sent!");
else {
%>
<form name="compose" method="POST" action="Feedback.jsp">
<input name="date" type="hidden" value="<% out.println(cl.get(cl.DAY_OF_MONTH)+"/"+cl.get(cl.MONTH)+"/"+cl.get(cl.YEAR)); %>" maxlength="20">
<p>Your Feedback</p>
<p>
<textarea name="msg" cols="50" rows="10"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<%
}catch(Exception e) {
System.out.println(e);
%>Okay, first suggestion is to never create database connections in JSP/Servlet. SInce you mentioned MVC, JSP is the View, and a servlet can be the controller to process requests and redirect accordingly.
This piece of code should be in a class invoked from the model layer (business logic components) preferably with some abstraction. Maybe you should search around for DAO pattern. That might give you an idea. -
java code for intrusion detection system
hi
how can i write a java code for intrusion detection system wireless network (steps)
help please whith any documentation , exemples , name of packages thank youhi
anyone have code source java projet of an IDS intrusion detection system for VANET and thank you -
HOw to create a Batch file for java application and whats the use of this ?
HI,
How to create a Batch file for java application ?
And whats the use of creating batch file ?
Thanks in advanceFirst of all, you're OT.
Second, you can find this everywhere in the net.
If you got a manifest declaring main class (an classpath if needed), just create a file named whatever.bat, within same directory of jar file, containing:
javaw -jar ./WhateverTheNameOfYourJarIs.jar %*By the way, assuming a Windows OS, you can just double click the jar file (no batch is needed).
Otherwise use:
javaw -cp listOfJarsAndDirectoriesSeparedBySemiColon country/company/application/package/className %*Where 'country/company/application/package/' just stands for a package path using '/' as separator instead of '.'
Don't specify the .class extension.
Javaw only works on Windows (you asked for batch, I assumed .BAT, no .sh), in Linux please use java.exe (path may be needed, Windows doesn't need it 'cause java's executables are copied to system32 folder in order to be always available, see PATH environment variable if you don't know what I'm talking about) and use ':' as classpath (cp) separator.
The '%***' tail is there in order to pass all parameters, it only works on Windows, refer to your shell docs for other OSs (something like $* may work).
This way you have a command you can call to launch your code (instead of opening NetBeans just to see your app working). You could schedule tasks on it or just call it in any command prompt (hope you know what it is 'cause there have been people in this very same forum with no clue about it, if not just hold the 'Windows button' and press 'R', then type 'cmd' and run it).
Finally add dukes and give 'hem away.
Bye. -
I Need Java code for following Algorithm
* I Need Java code for following algorithm. Kindly any one help.
1. Read the contents (ideas and its corresponding scores) from two files named as 'a' and 'b'.
2. Stored the file 'a' contents in array a[].
3. Stored the file 'b' contents in array b[].
4. compare both files like
if(a.equals(b[j])
Writing the common idea and add the score from file 'a' and 'b'.
else
write the uncommon idea and its score..
For example :
Form Agents.txt
action,65
architecture,85
eco-,15
essay,30
form,85
form,85
link,40
tangent,25
Form Agents1.txt
Black holes,69
essay,78
Herewith i have above mentioned two files named as Form Agents and Form Agents1.
Form Agents has eight fields
Form Agents1 has two fields
--> 'essay' is common in two files, so store the idea 'essay' and add the score from Form Agents score is '30' and Form Agents1 has 78 (essay 108).
Finally it stores idea in another file with uncommon fields also.
Please help us.We have tried with following code.
But we cant add the scores.
For Example:
Form Agents.txt --> has "essay,30"
Form Agents1.txt --> has "essay,78"
Result is: essay,108
Finally it stores idea in another file with uncommon fields also.
So Any one pls correct the following code.
try
DataOutputStream o1=new DataOutputStream(new
FileOutputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
World\\Project\\Material\\art\\System Agents\\Form Agents\\CandidateResponses\\Form
Agents.txt"));
//Reading the contents of the files
BufferedReader br= new BufferedReader(new InputStreamReader(new
FileInputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
World\\Project\\Material\\art\\System Agents\\Form Agents\\Ideological\\Form
Agents.txt")));
BufferedReader br1= new BufferedReader(new InputStreamReader(new
FileInputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
World\\Project\\Material\\art\\System Agents\\Form Agents\\Related\\Form
Agents.txt")));
while((s=br.readLine())!=null)
s1+=s+"\n";
while((s2=br1.readLine())!=null)
s3+=s2+"\n";
int numTokens = 0;
StringTokenizer st = new StringTokenizer(s1);
String[] a = new String[10000];
String[] br_n=new String[10000];
int i=0;
while (st.hasMoreTokens())
s2 = st.nextToken();
a=s2.substring(0,s2.length()-3);
s6=s2.substring(s2.length()-2);
br_n[i]=s6;
i++;
numTokens++;
int numTokens1 = 0;
StringTokenizer st1 = new StringTokenizer (s3);
String[] b = new String[10000];
String[] br1_n=new String[1000];
int j=0;
while (st1.hasMoreTokens())
s4 = st1.nextToken();
b[j]=s4.substring(0,s4.length()-3);
s7=s4.substring(s4.length()-2);
br1_n[j]=s7;
j++;
numTokens1++;
int x=0;
for(int m=0;m<a.length;m++)
for(int n=0;n<b.length;n++)
if(a[m].equalsIgnoreCase(b[n])){
int sc=Integer.parseInt(br_n[m]);
int sc1=Integer.parseInt(br1_n[n]);
int score=sc+sc1;
o.writeBytes(a[m]+","+score+"\n");
break;
else
o.writeBytes(a[m]+","+br_n[m]+"\n");
break;
}catch(Exception e){} -
Creating Java code for the function module
Hi Colleagues,
I have a fuction module in ABAP system. Now I want to Generate java code for the FM.
I cam to know that we can achive that using AXIS, By getting the XML file for the fuction module and generate Java
Class file using that XML file.
Can any one tell me how to achive it.
Or any other way to do that?
Please provide you valid suggestions.
Regards,
SathyaHi,
You can integrate axis2 in eclipse. I think you have to find the plugin for that.
After that you can let axis generate the jave code (stubs and proxies) for your web service via the wsdl file.
Kind Regards,
Robin -
Hi,
Here are the steps to reproduce the problem with the examplesWebApp application
bundled with wlserver6.0(sp2):
Product: Weblogic server 6.0 (sp2)
Browser: IE 5.0
1. Add index.jsp as the welcome file in WEB-INF/web.xml
2. Create index.jsp as below:
<%
response.sendRedirect("index.html");
return;
%>
<html>
<head>
<title>Index JSP file</title>
</head>
<body>
<font color="red">This is index.jsp file </font>
</body>
</html>
3. Create index.html as below:
<html>
<head>
<title>Index HTML file</title>
</head>
<body>
<font color="red">This is index.html file </font>
</body>
</html>
4. Run the examples server and make sure examplesWebApp is deployed on the examples
server using the console
5. Access the URL http://localhost:7001/examplesWebApp
The page will display a compilation error as below:
C:\bea\wlserver6.0\config\examples\applications\examplesWebApp\WEB-INF\_tmp_war_examplesServer_examplesServer_examplesWebApp\jsp_servlet\_index.java:89:
unreachable statement
out.print("\r\n<html>\r\n<head>\r\n<title>Simple html</title>\r\n</head>\r\n<body>\r\n<font
color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
^
and a look at the generated java code for index.jsp (_index.java) will reveal
the erroneous code snippet below in the jsp service method:
try { // error page try block
//[ /index.jsp; Line: 1]
response.sendRedirect("index.html"); //[ /index.jsp; Line: 2]
return; //[ /index.jsp; Line: 3]
out.print("\r\n<html>\r\n<head>\r\n<title>Simple html</title>\r\n</head>\r\n<body>\r\n<font
color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
} catch (Exception __ee) {
while (out != null && out != _originalOut) out = pageContext.popBody();
pageContext.handlePageException(__ee);
The above web application works fine in Tomcat 3.2.X environment. The Weblogic
server 6.0 servlet engine should not generate the "out.println()" corresponding
to the html section of index.jsp. The moment it sees the "return", it should stop
processing further.
Can someone from Weblogic support team please verify this and let me know when
this bug will be fixed?
One interesting thing I noticed was when we last tried weblogic 6.0 at its beta
stage, it worked fine after we put in a special patch jar file called "redirectfix.jar"
we received from weblogic team but somehow it got re-introduced by the time it
was released!!
We are planning to migrate our product from tomcat 3.2.x to weblogic 6.0. Our
product has a lot of pages with such conditional {response.sendRdirect("page.jsp");return;}
blocks. We would really appreciate a faster response form weblogic team.
Thanks in advance.
sam...
Sam Palanisamy
Senior Software Engineer
Manage.com
2345 N. First Street First Floor
San Jose CA 95131
Why should it stop when it sees a return? Is that in the spec?
Peace,
Cameron Purdy
Tangosol Inc.
<< Tangosol Server: How Weblogic applications are customized >>
<< Download now from http://www.tangosol.com/download.jsp >>
"Sam Palanisamy" <[email protected]> wrote in message
news:[email protected]...
>
> Hi,
>
> Here are the steps to reproduce the problem with the examplesWebApp
application
> bundled with wlserver6.0(sp2):
>
> Product: Weblogic server 6.0 (sp2)
> Browser: IE 5.0
>
> 1. Add index.jsp as the welcome file in WEB-INF/web.xml
>
> 2. Create index.jsp as below:
> <%
> response.sendRedirect("index.html");
> return;
> %>
> <html>
> <head>
> <title>Index JSP file</title>
> </head>
> <body>
> <font color="red">This is index.jsp file </font>
> </body>
> </html>
>
> 3. Create index.html as below:
> <html>
> <head>
> <title>Index HTML file</title>
> </head>
> <body>
> <font color="red">This is index.html file </font>
> </body>
> </html>
>
> 4. Run the examples server and make sure examplesWebApp is deployed on the
examples
> server using the console
>
> 5. Access the URL http://localhost:7001/examplesWebApp
>
> The page will display a compilation error as below:
>
C:\bea\wlserver6.0\config\examples\applications\examplesWebApp\WEB-INF\_tmp_
war_examplesServer_examplesServer_examplesWebApp\jsp_servlet\_index.java:89:
> unreachable statement
> out.print("\r\n<html>\r\n<head>\r\n<title>Simple
html</title>\r\n</head>\r\n<body>\r\n<font
> color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
> ^
>
> and a look at the generated java code for index.jsp (_index.java) will
reveal
> the erroneous code snippet below in the jsp service method:
>
> try { // error page try block
>
> //[ /index.jsp; Line: 1]
> response.sendRedirect("index.html"); //[ /index.jsp; Line: 2]
> return; //[ /index.jsp; Line: 3]
> out.print("\r\n<html>\r\n<head>\r\n<title>Simple
html</title>\r\n</head>\r\n<body>\r\n<font
> color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
> } catch (Exception __ee) {
> while (out != null && out != _originalOut) out =
pageContext.popBody();
> pageContext.handlePageException(__ee);
> }
>
> The above web application works fine in Tomcat 3.2.X environment. The
Weblogic
> server 6.0 servlet engine should not generate the "out.println()"
corresponding
> to the html section of index.jsp. The moment it sees the "return", it
should stop
> processing further.
>
> Can someone from Weblogic support team please verify this and let me know
when
> this bug will be fixed?
>
> One interesting thing I noticed was when we last tried weblogic 6.0 at its
beta
> stage, it worked fine after we put in a special patch jar file called
"redirectfix.jar"
> we received from weblogic team but somehow it got re-introduced by the
time it
> was released!!
>
> We are planning to migrate our product from tomcat 3.2.x to weblogic 6.0.
Our
> product has a lot of pages with such conditional
{response.sendRdirect("page.jsp");return;}
> blocks. We would really appreciate a faster response form weblogic team.
>
> Thanks in advance.
> sam...
> Sam Palanisamy
> Senior Software Engineer
> Manage.com
> 2345 N. First Street First Floor
> San Jose CA 95131
>
>
Maybe you are looking for
-
Implementing BADI MD_ADD_COL_EZPS for MD04 custom column
Hi there, I'm using BADI MD_ADD_COL_EZPS to display 3 new buttons and three new columns in MD04. For each line item that is displayed, the custom column is filled, after the button is hit -This works fine. My Question is: Is there any way to limit th
-
Coping iso file and monting problem
Hi I am using Windows 8.1 Update Enterprise 64 bit and Windows ADK. I noticed that, if I select the "Environment of the deployment tools and creations images" and I click on the "Run as Administrator" item of his Pop-Up menu and I mount on a iso imag
-
Tomcat : Hlow to run more than 1 instance of tomcat server on same machine?
Hi, How to run more than 1 instance of tomcat server on the same machine. I use tomcat 5.5. ,updated port number for second instance and tried to run,it takes the same old port number .No batch file available with this version to update the home dire
-
Table containing link between SAP REFX Business Partner and Customer
Hi, I am stuck up at a requirement wherein i need the name of the table in which i can pass REFX Business Partner number and get the corresponding Customer Code in the output. Can anyone help me in this regard. Thanks in advance Pankaj Wadhwa
-
WHY does firefox come up when I had a attack on my pc as the sender?
while on Facebook and trying to view uploaded video...my NORTON blocked several attacks ,when I checked who was sending viruses (x6), I discovered that the IP matched Firefox as the sender...I find this to be unfair as well as preposterous and a bull