Urgent: SAX parser bean is not working in JSP page
Hi All,
I have created a bean "ReadAtts" and included into a jsp file using
"useBean", It is not working. I tried all possibilities. But Failed Plz Help me.
Below are the details:
Java Bean: ReadAtts.java
package sax;
import java.io.*;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.util.*;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.ParserConfigurationException;
public class ReadAtts extends DefaultHandler implements java.io.Serializable
private Vector attNames = new Vector(); //Stores all the att names from the XML
private Vector attValues = new Vector();
private Vector att = new Vector();
private Locator locator;
private static String start="",end="",QueryString="",QString1="",QString2="";
private static boolean start_collecting=false;
public ReadAtts()
public Vector parse(String filename,String xpath) throws Exception
QueryString=xpath;
StringTokenizer QueryString_ST = new StringTokenizer(QueryString,"/");
int stLen = QueryString_ST.countTokens();
while(QueryString_ST.hasMoreTokens())
if((QueryString_ST.countTokens())>1)
QString1 = QueryString_ST.nextToken();
else if((QueryString_ST.countTokens())>0)
QString2 = QueryString_ST.nextToken();
SAXParserFactory spf =
SAXParserFactory.newInstance();
spf.setValidating(false);
SAXParser saxParser = spf.newSAXParser();
// create an XML reader
XMLReader reader = saxParser.getXMLReader();
FileReader file = new FileReader(filename);
// set handler
reader.setContentHandler(this);
// call parse on an input source
reader.parse(new InputSource(file));
att.add("This is now added");
//return attNames;
return att;
public void setDocumentLocator(Locator locator)
this.locator = locator;
public void startDocument() { }
public void endDocument() { }
public void startPrefixMapping(String prefix, String uri) { }
public void endPrefixMapping(String prefix) { }
/** The opening tag of an element. */
public void startElement(String namespaceURI, String localName,String qName, Attributes atts)
start=localName;
if(start.equals(QString2))
start_collecting=true; //start collecting nodes
if(start_collecting)
if((atts.getLength())>0)
for(int i=0;i<=(atts.getLength()-1);i++)
attNames.add((String)atts.getLocalName(i));
attValues.add((String)atts.getValue(i));
/** The closing tag of an element. */
public void endElement(String namespaceURI, String localName, String qName)
end = localName;
if(end.equals(QString2))
start_collecting=false; //stop colelcting nodes
/** Character data. */
public void characters(char[] ch, int start, int length) { }
/** Ignorable whitespace character data. */
public void ignorableWhitespace(char[] ch, int start, int length){ }
/** Processing Instruction */
public void processingInstruction(String target, String data) { }
/** A skipped entity. */
public void skippedEntity(String name) { }
public static void main(String[] args)
String fname=args[0];
String Xpath=args[1];
System.out.println("\n from main() "+(new ReadAtts().parse(fname,Xpath)));
//System.out.println("\n from main() "+new ReadAtts().attNames());
//System.out.println("\n from main() "+new ReadAtts().attValues());
JSP File:
<%@ page import="sax.*,java.io.*,java.util.*,java.lang.*,java.text.*;" %>
<jsp:useBean id="p" class="sax.ReadAtts"/>
Data after Parsing is.....
<%=p.parse"E:/Log.xml","/acq/service/metrics/system/stackUsage")%>
Expected Output:
The jsp file should print all the vector objects from the "ReadAtts" bean
Actual Output:
Data after Parsing.......[]
Thanks for your time.....
Newton
Bangalore. INDIA
the problem is not because of java code insdie jsp page
I have removed all things but the form and it is still not working
here is the modified code:
<!-- add news-->
<%
if(request.getParameter("addBTN") != null){
out.print("addBTN");
%>
<!-- end of add news-->
<form action="" method="post" enctype="multipart/form-data" name="upform" >
<table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
</tr>
<tr>
<td width="87%" align="right"><label>
<input name="title" type="text" class="rightText" id="title">
</label></td>
<td width="13%" align="right">9FH'F 'D.(1</td>
</tr>
<tr>
<td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
</textarea></td>
<td align="right">*A'5JD 'D.(1</td>
</tr>
<tr>
<td align="right"><label>
<input type="file" name="filename" id="filename">
</label></td>
<td align="right">5H1)</td>
</tr>
<tr>
<td align="right"><label>
<input name="addBTN" type="submit" class="btn" id="addBTN" value=" '6'A) .(1 ">
</label></td>
<td align="right"> </td>
</tr>
</table>
</form>
<!-- TinyMCE -->
<script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple",
directionality : "rtl"
</script>
<!--end of TinyMCE -->
Similar Messages
-
HTML multipart form is not working in jsp page
Hi
i have jsp page, has a HTML from with file upload field , when i click the send button , nothing happened as if the button did not submit the form. ie the message at line 12 is not printed out.
can any one help please.
<%@ page errorPage="..\error\error.jsp" %>
<%@ page pageEncoding="windows-1256" %>
<%@ page language="java" import="javazoom.upload.*,java.util.*,java.sql.ResultSet" %>
<jsp:useBean id="upBean" scope="page" class="javazoom.upload.UploadBean" >
<jsp:setProperty name="upBean" property="folderstore" value="<%=request.getRealPath("thuraya//uploads")%>" />
</jsp:useBean>
<jsp:useBean id="dbc" class="mypackage.DBConnection" scope="session" />
<!-- add news-->
<%
if(request.getParameter("addBTN") != null){
out.println("addbtn");
//do upload file + insert in database
if (MultipartFormDataRequest.isMultipartFormData(request))
// Uses MultipartFormDataRequest to parse the HTTP request.
MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request);
String todo = null;
if (mrequest != null) todo = mrequest.getParameter("todo");
if ( (todo != null) && (todo.equalsIgnoreCase("upload")) )
Hashtable files = mrequest.getFiles();
if ( (files != null) && (!files.isEmpty()) )
UploadFile file = (UploadFile) files.get("filename");
if (file != null)
out.println("<li>Form field : uploadfile"+"<BR> Uploaded file : "+file.getFileName()+" ("+file.getFileSize()+" bytes)"+"<BR> Content Type : "+file.getContentType());
String fileName=file.getFileName();
String ran=System.currentTimeMillis()+"";
String ext=fileName.substring( ( fileName.length()-4),fileName.length() );
file.setFileName(ran+ext);
// Uses the bean now to store specified by jsp:setProperty at the top.
upBean.store(mrequest, "filename");
String title=request.getParameter("title");
String content=request.getParameter("elm1");
int x=dbc.addNews(title,content,file.getFileName(),2,1);
if(x==1)
out.print("New Vedio has been addedd Successfully");
response.setHeader("Refresh","1;URL=uploadVedio.jsp");
else{
out.print("An Error Occured while adding new Vedio");
response.setHeader("Refresh","1;URL=uploadVedio.jsp");
else
out.println("<li>No uploaded files");
else out.println("<BR> todo="+todo);
%>
<!-- end of add news-->
<form action="" method="post" enctype="multipart/form-data" name="upform" >
<table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
</tr>
<tr>
<td width="87%" align="right"><label>
<input name="title" type="text" class="rightText" id="title">
</label></td>
<td width="13%" align="right">9FH'F 'D.(1</td>
</tr>
<tr>
<td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
</textarea></td>
<td align="right">*A'5JD 'D.(1</td>
</tr>
<tr>
<td align="right"><label>
<input type="file" name="filename" id="filename">
</label></td>
<td align="right">5H1)</td>
</tr>
<tr>
<td align="right"><label>
<input onClick="submit()" name="addBTN" type="button" class="btn" id="addBTN" value=" '6'A) .(1 ">
</label></td>
<td align="right"> </td>
</tr>
</table>
</form>
<!-- TinyMCE -->
<script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple",
directionality : "rtl"
</script>
<!--end of TinyMCE -->the problem is not because of java code insdie jsp page
I have removed all things but the form and it is still not working
here is the modified code:
<!-- add news-->
<%
if(request.getParameter("addBTN") != null){
out.print("addBTN");
%>
<!-- end of add news-->
<form action="" method="post" enctype="multipart/form-data" name="upform" >
<table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
</tr>
<tr>
<td width="87%" align="right"><label>
<input name="title" type="text" class="rightText" id="title">
</label></td>
<td width="13%" align="right">9FH'F 'D.(1</td>
</tr>
<tr>
<td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
</textarea></td>
<td align="right">*A'5JD 'D.(1</td>
</tr>
<tr>
<td align="right"><label>
<input type="file" name="filename" id="filename">
</label></td>
<td align="right">5H1)</td>
</tr>
<tr>
<td align="right"><label>
<input name="addBTN" type="submit" class="btn" id="addBTN" value=" '6'A) .(1 ">
</label></td>
<td align="right"> </td>
</tr>
</table>
</form>
<!-- TinyMCE -->
<script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple",
directionality : "rtl"
</script>
<!--end of TinyMCE --> -
Java code not working in Jsp page....
I like to say to myself "there is no magic" when I come to a perplexing situation, today is one of those times.
The following code when executed from the java class retrieves all the specified objects from the database and displays the requested attributes without issue:
try {
DBBody dbb = new DBBody();
Entity[] allbods = dbb.retrieveAll(true);
for(int k=0;k < allbods.length;k++) {
Body body = (Body)allbods[k];
System.out.println("From the dbase index position: " + k +" : " + "\n" + "Id: " + body.getId() + "\n" + "Type: " + body.getType() + "\n" + "Load: " + body.getLoad() + "\n XML:" + body.toXml() + "\n");
dbb.close();
} catch (Exception adb) {
adb.printStackTrace();
: the **exact same** code as displayed above when run in a Jsp only lists the values for the "body.getId()" and "body.getType()" methods...for a reason I can't discern, "body.getLoad()" and "body.toXml()" return empty strings in the Jsp. Everything else returns as when the code is run from the class. Both "getLoad()" and "toXml()" return strings but behind the scenes use StringBuffer objects that are converted to Strings...getId() returns an int and "getType()" returns a String also, but for whatever reason (to repeat) only those two attributes come through IN THE JSP, in the class ALL attributes are retrieved without a problem...so, what is wrong with Jsp? Java? I get no error message what so ever, just empty strings for the two specified method returns...what am I overlooking. I am running the embedded Jsp engine of the Jetty Http Server that I've incorporated into my application, which uses the latest Jsp version.
Any help on this issue would be greatly appreciated.If you dont want to paste your code, then you will
certainly not get any responses from the so called
Java Engineers rest is left to you. We can get dukes
elsewhere instead.
SwarajSwaraj, I apologize if I was taken to be abrassive with my last comment, I myself am a java engineer so I have no animosity, as for your request to copy the entire code it is no longer needed I have solved the problem and the solution follows just incase anyone else runs into similar issues. It indeed had nothing to do with StringBuffer working improperly but rather it was how I was getting my dbase connection.
As many of you who have developed applications with jdbc support to popular dbase vendors may already know, a connection must be established to the database by specifying various parameters, namely the name of the jdbc connection driver classes for the desired vendor (eg. "com.microsoft.jdbc.sqlserver.SQLServerDriver" for MS Sql Server instances) and the driver specific db connection url. Of course the driver classes must be available on the class path so that they can be accessed. Without these parameters the connection will not be initialized..well it turns out my "bug" was caused by my inadvertently ommitting the connection parameters in my Jsp, you might wonder "but you said it executed fine in the jsp except for the missing "getBody()" and "toXml()" results..how could it even execute at all if you didn't establish a connection?"
The answer is I designed the application to use a default connection driver class (the jdbc odbc bridge driver) and a default connection url (one that is tied to my testing instance of MsSqlServer2000) it turns out that the jdbc odbc bridge is very light weight...it lacks support for certain very useful MsSql datatypes namely "ntext", I use the "ntext" type for fields that can grow to any size (stylesheet code,xml code...etc.) but the bridge driver doesn't support "ntext" BUT rather than throw an exception error like proper error handling would require it silently eats the request (very very bad) ...this exacerbated the problem I had significantly (had it thrown an error I would have known immediately that the connection was using the wrong driver and url and fixed it sooner) as it is ...I was led down blind allies thinking my code was faulty, (which it wasn't strictly speaking ..I was just missing some extra code to account for the possibility that the bridge driver is instantiated by accident) so after adding the following code above the Jsp code shown previously:
//Configure a connection to a Microsoft Sql Database.
DBConfig.setVendorId(DBConfig.MSSQL_VID);
DBConfig.setDBHostId("xiassql");
DBConfig.setDBHostPort("1433");
DBConfig.setDBUrl(DBConfig.buildDBUrl());
:The code worked perfectly. The "DBConfig" class does exactly that..allowing me to pass in connection attributes including the type of vendor "DBConfig.MSSQL_VID", (I have built in support for 5 popular vendors so far), the dbase host name "xiassql" and the port "1433" , then we build the url using the specified attributes and the connection is complete. After adding the code above the Jsp returned all the retrieved values perfectly. So, when testing applications that enable backend dbase connections if you get seemingly identical code behaving differently from class to Jsp, suspect an issue relating to your connection url and classes (assuming you have multiple support and a default value as I do in my app.) also any changes in the execution context from class to Jsp can cause similar errors (like not declaring the same classes at the top of the Jsp file , or less likely using an outdated Jsp engine!)
Regards,
PS I will take off the Duke Dollars on this question since I answered it myself! -
ListIterator not working in JSP page
Hello,
I am using an ArrayList in a JSP as follows:
<%
ArrayList missingFieldsArr = (ArrayList) HeaderBean.getMissingFieldsArr();
ListIterator i = (ListIterator)missingFieldsArr.listIterator();
%>
<hbj:scrollContainer
id="scrContError"
width="320"
height="50"
>
<table width="60%">
<% while(i.hasNext()) {
String str = (String) i.next();
%>
<tr>
<td width="100%">
<hbj:textView
id="txtErrorLst"
wrapping="true"
text="<%=str%>"
/>
</td>
</tr>
<% } %>
</table>
</hbj:scrollContainer>
Iterating through the ArrayList works when I test via portalapp.xml in NDS, but it does not when I test via the iview in the Portal. The error I'm receiving is:
Portal Runtime Error
An exception occurred while processing a request for :
iView : pcd:portal_content/com.nbcuni.sc_portal_Content/com.nbcuni.Roles/com.nbcuni.SAP_SC_Testing_Pre-Bom/com.nbcuni.product_information_prebom_ws/com.nbcuni.pre_bom_pg/com.nbcuni.pre_bom
Component Name : PBS.Inbox
The exception was logged. Inform your system administrator..
Exception id: 06:37_30/12/05_0106_4554750
See the details for the exception ID in the log file
Any thoughts?
Thanks for your help,
-JamieHi Jamie,
for what reason do you think it's the list iterator? All you know from the info you have passed through to us, that it is your component...
> Exception id: 06:37_30/12/05_0106_4554750
> See the details for the exception ID in the log file
==> Please submit the detailed exception / message / stacktrace from the default.X.trc file.
Best regards
Detlev -
Bean is not worked in the jsff page
Hi
JDeveloper Studio Edition Version 11.1.2.2.0
I Have a bean for run a jasperreport
package Reports;
import javax.faces.event.ActionEvent;
import sp11.model.apm.clubImpl;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.JasperViewer;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.binding.BindingContainer;
import oracle.jbo.client.Configuration;
public class CardFrontBean {
public CardFrontBean() {
public String runReportAction(){
DCIteratorBinding rleIter = (DCIteratorBinding)getBindings().get("RealentityIterator");
String RleId = rleIter.getCurrentRow().getAttribute("RleId").toString();
BigDecimal ID = new BigDecimal(RleId);
Map parameter = new HashMap();
parameter.put("ID", ID);// where ID is a jasper report parameter
try
runReport("card_front.jasper", parameter);
catch (Exception e)
return null;
public BindingContainer getBindings(){
return BindingContext.getCurrent().getCurrentBindingsEntry();
public ServletContext getContext(){
return (ServletContext)getFacesContext().getExternalContext().getContext();
public HttpServletResponse getResponse(){
return (HttpServletResponse)getFacesContext().getExternalContext().getResponse();
public static FacesContext getFacesContext(){
return FacesContext.getCurrentInstance();
public void runReport(String repPath, java.util.Map param) throws Exception {
Connection conn = null;
try
HttpServletResponse response = getResponse();
ServletOutputStream out = response.getOutputStream();
response.setHeader("Cache-Control", "attachment;filename=\"CardFront.pdf\"");
response.setContentType("application/pdf");
ServletContext context = getContext();
InputStream fs = context.getResourceAsStream("/ReportsFolder/" + repPath);
JasperReport template = (JasperReport) JRLoader.loadObject(fs);
template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
PreparedStatement statement = null;
String amDef = "sp11.model.apm.club";
String config = "clubLocal";
clubImpl am = (clubImpl)Configuration.createRootApplicationModule(amDef,config);
statement = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0);
conn = statement.getConnection();
JasperPrint print = JasperFillManager.fillReport(template, param, conn);
//JasperViewer.viewReport(print, false);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(print, baos);
out.write(baos.toByteArray());
out.flush();
out.close();
FacesContext.getCurrentInstance().responseComplete();
catch (Exception jex)
jex.printStackTrace();
finally
close(conn);
public void close(Connection con){
if (con != null)
try
con.close();
catch (Exception e)
and a commandButton in the .jsff page
<af:commandButton id="Realentitycardfront"
textAndAccessKey="#{nls['REALENTITY_CARDFRONT']}"
shortDesc="#{nls['REALENTITY_CARDFRONT_HINT']}"
action="#{CardFront.runReportAction}"/>
my .jsff page is in a bounded task flow with Use Page Fragments = true
when i click the button. ........>nothing
what is the matter
i read in a post that it is not work in jsff page with page fragmentation
please help me
thanksOne problem is that you write into the output stream from an action method and don't know what's already in the output stream. Once there is one byte written to hte stream (which you can't know from inside the action method) the pdf stream does not behave as you think it would.
Next thing is that you use createRootApplicationModule but never release it. This will get you out of resources error eventually.
A better approach would be to put this code in a servlet and stream the report from there. In the servlet you have control over the output stream.
Check my blog http://tompeez.wordpress.com/2011/12/16/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-3/ where I show how to serve images from a servlet which can even use the application module pool from the application (no need to use createRootApplicationModule at all). All you have to do is to exchange the part where I get and stream the image data to your needs.
Timo -
UIComponent broadCastAction is not working in mobile page
We are using the broadCastAction in one of our critical flows to submit to an action in Managed bean but we are facing issue in our ADF fusion web app for mobile . When we create a page with mobile render option selected the broadCastAction is not getting triggered . broadCastAction shows null in the getter of BroadCastAction.
<tr:commandButton text="AutoSubmit" id="cb2"
action="processResponse"
binding="#{pageFlowScope.testBean.braodCastAction}"
rendered="false"/>
This is working in normal page without "render in mobile" selected , we need a solution for it to work on mobile compatible page as wellHi Frank
UIComponent braodCastAction is from javax.faces.component.UIComponent . It is used to invoke action of a UI component through Java code
if we have button like
<tr:commandButton text="AutoSubmit" id="testCommandbtn" action="processMobile"
binding="#{pageFlowScope.mobileBean.braodCastAction}"
rendered="true" />
Then through getter method of broadcastAction we can invoke the action of this button using the below code
braodCastAction.broadcast(new ActionEvent(braodCastAction));
This is working in the normal jspx page but not working in a page where we select render in mobile -
Javascript is not working in JSP
Hi everybody,
My javascript is not working in JSP.I m not able to fix this problem.Please tell where the problem in code.
thx in advance.
<%@page import="javax.servlet.http.*" %>
<%@page import="java.sql.*" %>
<html>
<head>
<script type="text/javascript" >
funtion checkentries()
if(document.LForm.uname.value==null || document.LForm.upassword.value==null)
alert("Please fill all entries")
else
document.LForm.submit()
</script>
</head>
<body>
<table width=100% height=100% valign="center" align="center" border=0>
<tr height=10% ><td>
<%@ include file="Header.jsp" %>
<hr>
</td></tr>
<tr height=1% width=100%>
<td align=right>Register
<hr>
</td>
</tr>
<tr height=77% width=100% ><td>
<table>
<tr><td width=65%>
</td>
<td bgcolor="black" width="1" ></td>
<td align="right" valign="top" >
<form method="POST" action="/EIS/Home.do" name="LForm">
User Name: <input type="text" align=right name="uname"><br>
Password:    <input type="password" name="upassword"><br>
<input type="submit" name="submit" value="Submit" onclick="checkentries()">
</td>
</tr>
</table>
</td></tr>
<tr height=10% ><td>
<hr>
<%@ include file="Footer.jsp" %>
</td></tr>
</table>
</body>
</html>in this part:
if(document.LForm.uname.value==null || document.LForm.upassword.value==null)should be:
if(document.LForm.uname.value=="" || document.LForm.upassword.value=="")or
if(document.LForm.uname.value.length==0 || document.LForm.upassword.value.length==0) -
I wanted to send a push notification, unfortunately it does not work. The page will not load. Anyone know why?
Push notifications, I believe, is only for iOS.
If it is for iOS, take a look at Using Apple push notifications with Digital Publishing Suite | Adobe Developer Connection -
When iam using jdownloader for dowload, the firefox did not work at any page, as like`` there in no internet conexion?``
you need to check whether '''jdownloader''' is compatible with the Firefox version you are using.
-> Tap ALT key or press F10 to show the Menu Bar
-> go to Tools Menu -> Add-ons -> Extension section -> check the Status of '''jdownloader''' extension -> if '''an update''' is available for this add-on then install the update -> Restart Firefox and check again check the compatibility -> if it is '''GREYED with Exclamation mark''' then it is incompatible with Firefox
Try using this extension to force compatibility.
https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/
Check and tell if its working. -
ScriptLink tag not working for application page sharepoint 2010
<ScriptLink> tag not working for application page sharepoint 2010 for including javascript in application page, it appends either 1033 or _layout to path specified for javascript.But javascripts are located in custom document library on site and not
in _layouts folder.
Please help and explain in details as I tried lot on this.Hi,
Use the following line of code
<SharePoint:Scriptlink runat="server" Name="~sitecollection/Style Library/[YOUR SITE]/js/functions.js" Language="javascript" />
Thanks,
Vivek
Please vote or mark your question answered, if my reply helps you -
Error in parsing the taglib tag in the JSP page
Hi
We are trying to deploy and run a Web Application in CE 7.1 SP01. We are successful in deploying and running servlet based web pages, but when it comes to JSP's the taglibs are not parsed and we get the following error message
Runtime error in processing of the JSP file E:\usr\sap\CE1\J01\j2ee\cluster\apps\sap.com\TestNWEAR\servlet_jsp\TestNW\root\admin\main.jsp.
The error is: com.sap.engine.services.servlets_jsp.jspparser_api.exception.JspParseException: Error in parsing the taglib tag in the JSP page. Cannot resolve URI: [webwork]. Possible reason - validation failed. Check if your TLD is valid against its scheme.02004C4F4F5000190000004E000013400191D308B45
Processing HTTP request to servlet [jsp] finished with error.
The error is: java.io.FileNotFoundException: E:\usr\sap\CE1\J01\j2ee\cluster\apps\sap.com\TestNWEAR\servlet_jsp\TestNW\root\admin\webwork (The system cannot find the file specified)02004C4F4F50001900000051000013400191D308B45AF1AB
We followed the below weblog to correct the TLD's in JAVA EE 5 @ SAP but it did not work for us.
/people/community.user/blog/2006/10/13/porting-the-java-blueprint-solutions-catalogue-applications-to-sap-netweaver-application-server-java-ee-5-edition
Any immediate help will be rewarded with full points
Thanks in advance
Lakshmi
Edited by: lakshmi N Munnungi on May 5, 2008 11:36 PM
Edited by: lakshmi N Munnungi on May 5, 2008 11:39 PMHi Lakshmi,
I have also the same problem. If you have found the solution please post it thanks,
Thanks,
Tariq -
BLOB image not shows in JSP page!!
Hi Dear all,
I had tried to configure how to show BLOB image to jsp page . The code are works fine and servlet works ok but image can not show only. can you help me that what need to be added. Please help me.
Can any experts help me? BLOB image not shows in JSP page. I am using ADF11g/DB 10gR2.
My as Code follows:
_1. Servlet Config_
<servlet>
<servlet-name>images</servlet-name>
<servlet-class>his.model.ClsImage</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>images</servlet-name>
<url-pattern>/render_images</url-pattern>
</servlet-mapping>
3. class code
package his.model;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import oracle.jbo.ApplicationModule;
import oracle.jbo.Row;
import oracle.jbo.ViewObject;
import oracle.jbo.client.Configuration;
import oracle.jbo.domain.BlobDomain;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class ClsImage extends HttpServlet
//private static final Log LOG = LogFactory.getLog(ImageServlet.class);
private static final Log LOG = LogFactory.getLog(ClsImage.class);
public void init(ServletConfig config)
throws ServletException
super.init(config);
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
System.out.println("GET---From servlet============= !!!");
String appModuleName = "his.model.ModuleAssetMgt";//this.getServletConfig().getInitParameter("ApplicationModuleName");
String appModuleConfig = "TempModuleAssetMgt";//this.getServletConfig().getInitParameter("ApplicationModuleConfig");
String voQuery ="select ITEM_IMAGE from MM_ITEMIMAGE where IMAGE_NO = 'P1000000000006'" ;// 'P1000000000006' this.getServletConfig().getInitParameter("ImageViewObjectQuery");
String mimeType = "jpg";//this.getServletConfig().getInitParameter("gif");
//?IMAGE_NO='P1000000000006'
//TODO: throw exception if mandatory parameter not set
ApplicationModule am =
Configuration.createRootApplicationModule(appModuleName, appModuleConfig);
ViewObject vo = am.createViewObjectFromQueryStmt("TempView2", voQuery);
Map paramMap = request.getParameterMap();
Iterator paramValues = paramMap.values().iterator();
int i=0;
while (paramValues.hasNext())
// Only one value for a parameter is expected.
// TODO: If more then 1 parameter is supplied make sure the value is bound to the right bind
// variable in the query! Maybe use named variables instead.
String[] paramValue = (String[])paramValues.next();
vo.setWhereClauseParam(i, paramValue[0]);
i++;
System.out.println("before run============= !!!");
// Run the query
vo.executeQuery();
// Get the result (only the first row is taken into account
System.out.println("after run============= !!!");
Row product = vo.first();
//System.out.println("============"+(BlobDomain)product.getAttribute(0));
BlobDomain image = null;
// Check if a row has been found
if (product != null)
System.out.println("onside product============= !!!");
// We assume the Blob to be the first a field
image = (BlobDomain) product.getAttribute(0);
//System.out.println("onside run product============= !!!"+image.toString() +"======="+image );
// Check if there are more fields returned. If so, the second one
// is considered to hold the mime type
if ( product.getAttributeCount()> 1 )
mimeType = (String)product.getAttribute(1);
else
//LOG.warn("No row found to get image from !!!");
LOG.warn("No row found to get image from !!!");
return;
System.out.println("Set Image============= !!!");
// Set the content-type. Only images are taken into account
response.setContentType("image/"+ mimeType+ "; charset=windows-1252");
OutputStream os = response.getOutputStream();
InputStream is = image.getInputStream();
// copy blob to output
byte[] buffer = new byte[4096];
int nread;
while ((nread = is.read(buffer)) != -1)
os.write(buffer, 0, nread);
//System.out.println("Set Image============= loop!!!"+(is.read(buffer)));
os.close();
// Remove the temporary viewobject
vo.remove();
// Release the appModule
Configuration.releaseRootApplicationModule(am, false);
} 3 . Jsp Tag
<af:image source="/render_images" shortDesc="Item"/> Thanks.
zakir
====
Edited by: Zakir Hossain on Apr 23, 2009 11:19 AMHi here is solution,
later I will put a project for this solution, right now I am really busy with ADF implementation.
core changes is to solve my problem:
byte[] buffer = new byte[image.getBufferSize()];
int nread;
vo.remove();
while ((nread = is.read(buffer)) != -1) {
os.write(buffer);
}All code as below:
Servlet Code*
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
String appModuleName =
"his.model.ModuleAssetMgt";
String appModuleConfig =
"TempModuleAssetMgt";
String imgno = request.getParameter("imgno");
if (imgno == null || imgno.equals(""))
return;
String voQuery =
"select ITEM_IMAGE from MM_ITEMIMAGE where IMAGE_NO = '" + imgno + "'";
String mimeType = "gif";
ApplicationModule am =
Configuration.createRootApplicationModule(appModuleName,
appModuleConfig);
am.clearVOCaches("TempView2", true);
ViewObject vo = null;
String s;
vo = am.createViewObjectFromQueryStmt("TempView2", voQuery);
// Run the query
vo.executeQuery();
// Get the result (only the first row is taken into account
Row product = vo.first();
BlobDomain image = null;
// Check if a row has been found
if (product != null) {
// We assume the Blob to be the first a field
image = (BlobDomain)product.getAttribute(0);
// Check if there are more fields returned. If so, the second one
// is considered to hold the mime type
if (product.getAttributeCount() > 1) {
mimeType = (String)product.getAttribute(1);
} else {
LOG.warn("No row found to get image from !!!");
return;
// Set the content-type. Only images are taken into account
response.setContentType("image/" + mimeType);
OutputStream os = response.getOutputStream();
InputStream is = image.getInputStream();
// copy blob to output
byte[] buffer = new byte[image.getBufferSize()];
int nread;
vo.remove();
while ((nread = is.read(buffer)) != -1) {
os.write(buffer);
is.close();
os.close();
// Release the appModule
Configuration.releaseRootApplicationModule(am, true);
}Jsp Tag
<h:graphicImage url="/render_images?imgno=#{bindings.ImageNo.inputValue}"
height="168" width="224"/> -
OK, maybe I'm oversharing, but I want to be thorough. Note I asked this question a different way using very different code.
Here's my jsp file - myq.jsp
<%@ page language="java" import="java.util.*,com.serco.inquire.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="inq" tagdir="/WEB-INF/tags" %>
<inq:displayCollection>
<jsp:attribute name="mgr">Chris Novish</jsp:attribute>
</inq:displayCollection>Here's displayCollection.tag used by that jsp:
<%@ tag body-content="scriptless" import="com.serco.inquire.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ attribute name="mgr" required="true" %>
<jsp:useBean id="irc" scope="session" class="com.serco.inquire.IrCollection">
<jsp:setProperty name="irc" property="mgrid" value="${mgr}" />
</jsp:useBean>
${irc.size} | ${irc.mgrid}Here's the java class IrCollection (used as a bean in the tag):
package com.serco.inquire;
import java.sql.*;
import java.util.*;
public class IrCollection {
public ArrayList iRecords = new ArrayList<InquireRecord>();
public int size;
public String mgrid;
public irCollection() {
super();
public void populateCollection() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String filename = "inquire.mdb";
String database = "jdbc:odbc:Driver={Microsof Access Driver (*.mdb)};DBQ=";
database+= filename.trim() + ";DriverID=22;READONLY=true}";
Connection con = DriverManager.getConnection( database ,"","");
Statement s = con.createStatement();
s.execute ("SELECT * FROM inquiries WHERE manager = '" + this.mgrid + "'");
ResultSet rs = s.getResultSet();
int cur;
while (rs.next()) {
cur = rs.getRow()-1;
InquireRecord localIR = new InquireRecord();
int curID = rs.getInt("ID");
localIR.setID(curID);
String cursub = rs.getString("submitter");
localIR.setSubmitter(cursub);
this.iRecords.add(cur, localIR);
con.close();
this.size = iRecords.size();
catch (Throwable e) {
System.out.println(e);
public int getSize () {
return this.size;
public void setMgrid(String datum) {
this.mgrid = datum;
this.populateCollection();
public String getMgrid() {
return this.mgrid;
}and here's the InquireRecord java class used by IrCollection:
package com.serco.inquire;
public class InquireRecord {
private int ID;
private String submitter;
public InquireRecord() {
super();
public InquireRecord(String asubmitter) {
this.submitter = asubmitter;
public int getID(){
return this.ID;
public void setID(int datum) {
this.ID = datum;
public String getSubmitter() {
return this.submitter;
public void setSubmitter(String datum) {
this.submitter = datum;
}The JSP does this: set the mgr variable, which is passes to the tag, the tag then creates an instance of IrCollection using that mgr variable. (Yes, putting that populateCollection() method call in the setMgrid() method is probably Bad Practice, but it works, usually). The IrCollection objects builds an ArrayList of InquireCollection objects from an Access database. It then sets it's size property based on how many InquireCollection instances it put into the ArrayList. Once that's all done, the tag spits out 2 things: The size property and the mgrid property.
When I view the JSP, it gives me 0 for the size and Chris Novish for the mgrid.
I think this could be one of the following:
*Not finding any matching records of the database
*Not actually executing the populateCollection() method
*some how forgetting the information it put into that ArrayList?
I"m sure there's another possibility, but I don't know.
Here's what gets me. Here's a test class I made called TestCollection:
{code}package com.serco.inquire;
import java.util.*;
import java.text.*;
public class TestCollection {
public static void main(String[] args) {
IrCollection myCollection = new IrCollection();
myCollection.setMgrid("Chris Novish");
System.out.println(myCollection.getSize());
System.out.println(myCollection.getMgrid());
}{code}
if I run that I get a size of 4 and a mgrid of Chris Novish.
Same data in, and it works as expected.
So... why won't JSP do it?You have defined a session scope for that bean. You have to make sure that the bean is instantiated by this jsp and not earlier. If the bean is located in the session because it was set earlier, then the body tags within useBean are not evaluated.
Look here - http://java.sun.com/products/jsp/tags/syntaxref.fm14.html#8865
An easy way to test it would be to change the scope of the bean to request.
ram. -
Problem discribe:
1.environment:
(1)Network: only local network.
(2)Platforms
All platforms we use are Solaris 10 for X86.
(2.1)Server: (intel) Solaris 10 for X86
Oracle Application Server Forms Services 10.1.2.0.2
(2.2)Client: Mozolla web browser on (intel) Solaris 10 for X86 .
Mozolla web browser information:
(2.2.1)[menu]-[Help]-[About web browser]display:
Welcome to Mozilla 1.7 for Sun Java(TM) Desktop System
Mozilla/5.0 (X11; U; SunOS i86pc; zh-CN; rv:1.7) Gecko/20070606
(2.2.2)[menu]-[Help]-[About Plug-in]display:
Java(TM) Plug-in 1.5.0_12-b04
file name: libjavaplugin_oji.so
Java(TM) Plug-in 1.5.0_12
MIME type
application/x-java-vm Java
application/x-java-applet Java
application/x-java-applet;version=1.1 Java
application/x-java-applet;version=1.1.1 Java
application/x-java-applet;version=1.1.2 Java
application/x-java-applet;version=1.1.3 Java
application/x-java-applet;version=1.2 Java
application/x-java-applet;version=1.2.1 Java
application/x-java-applet;version=1.2.2 Java
application/x-java-applet;version=1.3 Java
application/x-java-applet;version=1.3.1 Java
application/x-java-applet;version=1.4 Java
application/x-java-applet;version=1.4.1 Java
application/x-java-applet;version=1.4.2 Java
application/x-java-applet;version=1.5 Java
application/x-java-applet;jpi-version=1.5.0_12 Java
application/x-java-bean Java
application/x-java-bean;version=1.1 Java
application/x-java-bean;version=1.1.1 Java
application/x-java-bean;version=1.1.2 Java
application/x-java-bean;version=1.1.3 Java
application/x-java-bean;version=1.2 Java
application/x-java-bean;version=1.2.1 Java
application/x-java-bean;version=1.2.2 Java
application/x-java-bean;version=1.3 Java
application/x-java-bean;version=1.3.1 Java
application/x-java-bean;version=1.4 Java
application/x-java-bean;version=1.4.1 Java
application/x-java-bean;version=1.4.2 Java
application/x-java-bean;version=1.5 Java
application/x-java-bean;jpi-version=1.5.0_12 Java
2.Install Config:
(2.1)formsweb.cfg
after install,
/export/home/ias/OraHome_2/forms/server/formsweb.cfg
include a section :
# Page displayed to users to allow them to download Sun's Java Plugin.
# Sun's Java Plugin is typically used for non-Windows clients.
# (NOTE: you should check this page and possibly change the settings)
jpi_download_page=http://java.sun.com/products/archive/j2se/1.4.2_06/index.html
# Parameter related to the version of the Java Plugin
jpi_classid=clsid:CAFEEFAC-0014-0002-0006-ABCDEFFEDCBA
# Parameter related to the version of the Java Plugin
jpi_codebase=http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,06
# Parameter related to the version of the Java Plugin
jpi_mimetype=application/x-java-applet;jpi-version=1.4.2_06
(2.2)run oracle test form and my forms
http://s216:7777/forms/frmservlet?form=test&userid=scott/tiger@orcl
(Oracle simple test demo form)
or
tttp://s216:7777/forms/frmservlet?form=myform&userid=scott/tiger@orcl
(2.3)browser dialogue window display:
[title:Default Plugin]
This page contains information of a type (application/x-java-applet;jpi-version=1.4.2_06)that can only be viewed with the appropriate Plug-in.
Click OK to download Plugin.
when I Click Ok ,display warning :
File not found:www.sun.com, check filename ,try later.
(2.4)change formsweb.cfg
/export/home/ias/OraHome_2/forms/server/formsweb.cfg
change:
jpi_mimetype=application/x-java-applet;jpi-version=1.4.2_06
to:
jpi_mimetype=application/x-java-applet;
(2.5)run again oracle test form and my forms
http://s216:7777/forms/frmservlet?form=test&userid=scott/tiger@orcl
(Oracle simple test demo form)
or
http://s216:7777/forms/frmservlet?form=myform&userid=scott/tiger@orcl
(2.6)Problem:
myform and test(Oracle simple test demo form) can run and display,
but all buttons(when click) not work(no response);
all meuns not work...........
How to Solve this problem?
thanks in advance.The currently supported versions with patches installed are as follows:
<li>10.1.2.3 (10.1.2.0.2 + patch 5983622)
<li>11.1.1.4 (11.1.1.2 or 11.1.1.3 + patch 11060983 : this also requires WLS 10.3.4)
Fusion Middleware (FMw) 11 downloads are available from here:
http://www.oracle.com/technetwork/middleware/weblogic/downloads/index.html
Patches are only available to customers with access to MyOracleSupport (http://support.oracle.com)
For Forms/Reports users, look for the FMw download titled "Portal, Forms, Reports and Discoverer". The distribution includes all that is necessary to design and deploy your applications. Note that WebLogic Server is also required and is a separate download (from the same page). Be sure to carefully review the installation instructions before attempting the process. It may also be helpful to review MyOracleSupport note 1073776.1. -
@EJB annotation in entity bean does not work
I just started with ejb3. I have created a couple of beans. One session bean that looks like this:
@Stateless
public class MySessionBean implements MySession
@Resource(name="jdbc/mydb")
private DataSource myDB;
public void someMethod() {
myDB.getConnection()
This works great. The other bean is an entity bean, and there the resource injection doesn't work. It looks like this:
@Entity
public class MyEntityBean
@Resource(name="jdbc/mydb")
private DataSource myDB;
public void someMethod() {
myDB.getConnection()
Is resource injection any different in an entity bean then in a session bean? Both beans belong to the same package and are in the same application, (ear). I have exactly the same problem with @EJB injection: it works fine in the session bean but not in the entity bean...
Any help is appreciated...
John<code>
@Entity
@Table(name = "assetfault")
@NamedQueries( {@NamedQuery(name = ... )})
public class Assetfault implements Serializable {
@javax.ejb.EJB private com.novadent.data.assetmg.sessionbeans.AssetFacadeLocal aF;
@javax.ejb.EJB private com.novadent.data.assetmg.sessionbeans.AssetfaultFacadeLocal afF;
</code>
importing javax.ejb.EJB ?
Maybe you are looking for
-
Problema Installazione Camera Raw e colori Lightroom 4?
Salve a tutti. Sono italiano e non trovando un forum in italiano ho postato qui la domanda. Il mio problema è questo: ho una versione completa di Lightroom 4 e purtroppo quando carico i file RAW in formato RAF i colori sono sbiaditi e il programma mi
-
Ads are popping up all over...extra tabs open with "surveys". I have looked at all of the support posts and nothing seems to address how to get rid of this. I even trashed Firefox and reloaded. Same problem. This does not happen with Safari. I am rea
-
Update Batch Classification for a Material
Hello friends, I'm facing the following problem : A specific BTCI wich simulates MB01 was calling another program called SAPLCTMS to update Batch classification for a Material, this program (SAPLCTMS ) seems to be not necessary after the support pack
-
Regex to find word starting with $ symbol.
Hi, I want to find all the words in a JTextPane starting with "$" symbol followed by alphabets or digits. Below is the code, which I have written public void matchAllWords(String textPaneData) { String regexStr = "\\b(\\$?(\\w+))\\b"; Patt
-
Can't select page range to print
When I use the printer system dialog box, print all pages is the only option. Print selection, pages, or current page are all greyed out. Have latest software download installed (printer driver)