GetQueryString()
I passed successfully quiery string from one jsp page.
In next page, I've to retrieve certian data from MySQL table. I used the sql statement as
Select * from table_name where id='"+request.getQueryString()+"';
but id didn't returned anything.
please help me regarding this problem.
First test what getQueryString() returns by adding this line b4 u run the query.
System.out.println(getQueryString());
If it returns null, then query won't return anything.
Similar Messages
-
Struts portlet and request.getQueryString()
Hi all,
I've run into what seems like a bug in using struts portlets.
In my JSP page, I'm attempting to retrieve the query string (parameters) from the request URL, but apparently under the Portal framework, only the first parameter/value in the query string can be retrieved.
Eg. URL:
http://www.myportal.com/portal/page?_pageid=11,86282&_dad=portal&_schema=PORTAL&_piref33_92271_33_86282_86282.strutsAction=%2myAction.do?param1=abc¶m2=cde¶m3=fgh
When invoking a request.getQueryString() either in my JSP or in the action servlet, only the first part is returned, which is param1=abc. The rest is dropped.
I should mention that the actual use of these parameters are okay (such as request.getParameter("param2") will return "cde"). Just pulling them out with the getQueryString() method seems not too work.
The only way to workaround it for me is to use the request.getParameterNames() and run through the enumeration and construct the query string manually. Of course this is ugly running under the Portal framework because I have to filter out all the Portal parameters that begin with the underscore character(eg. page, schema, etc).
Has anyone else had this problem and worked around it?
Thanks in advanceHi,
This may help. Use the pdk-struts-html:link tag instead.
Something like
<jsp:useBean id="prevDetail" class="java.util.HashMap"/>
<c:set target="${prevDetail}" property="event_PreviousSet" value="PreviousSet"/>
<c:set target="${prevDetail}" property="sortref" value="${param.sortref}"/>
<c:set target="${prevDetail}" property="sortacc" value="${param.sortacc}"/>
<c:set target="${prevDetail}" property="filteron" value="${param.filteron}"/>
<pdk-struts-html:link action="portal/something.do" name="prevDetail">
Good luck, Hernando -
Getting rid of %20 in getQueryString
Hi,
I get the query string from the request object and it contains %20 for spaces. Is there a nice way of getting rid of these?
AliThe query string is URL encoded. You can use the decode(String s) method on java.net.URLDecoder to get the decoded string.
-
Error while assigning resultset value to Querytable variable in Coldfusion 10
We are upgrading from coldfusion 8 to 10. Internally we were using java function to to get the data.
In java function we have a resultset object, if we assign this resultset value to Querytable variable, we are getting below error. This code was working fine in coldfusion 8.
Detail This exception is usually caused by service startup failure. Check your server configuration.
Message The Runtime service is not available.
StackTrace coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Runtime service is not available. at coldfusion.server.ServiceFactory.getRuntimeService(ServiceFactory.java:117) at coldfusion.runtime.RequestMonitor.<clinit>(RequestMonitor.java:14) at coldfusion.sql.QueryTable.populate(QueryTable.java:358) at coldfusion.sql.QueryTable.populate(QueryTable.java:283) at coldfusion.sql.QueryTable.<init>(QueryTable.java:96) at com.myCompany.myClass.myFunct(myClass.java:627) at
Here is the function which is causing error.
static private QueryTable myFunct(String userId, SessionFactory sf) {
PreparedStatement pStmt = null;
ResultSet rs = null;
QueryTable ret = null;
try{
Query q = sf.getCurrentSession().getNamedQuery("ListUsers");
pStmt = sf.getCurrentSession().connection().prepareStatement(q.getQueryString());
rs = pStmt.executeQuery();// works fine till here
ret = new QueryTable(rs); // error line
rs.close();
}catch(Exception e){
e.printStackTrace();
throw new RuntimeException(e.getLocalizedMessage());
return ret;
Can you provide some help on this. Please let me know if you need any other details.We have found this error is logs
coldfusion.runtime.Encryptor$InvalidParamsForEncryptionException: An error occurred while trying to encrypt or decrypt your input string: The input and output encodings are not same..
at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:303)
at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:284)
at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5353)
at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5326)
at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5458)
at com.vmware.vcp.service.impl.EncryptColdFusionImpl.decrypt(EncryptColdFusionImpl.java:65)
at com.vmware.vcp.web.servlet.ApplicationConfigServlet.initEmailService(ApplicationConfigSer vlet.java:119)
at com.vmware.vcp.web.servlet.ApplicationConfigServlet.init(ApplicationConfigServlet.java:51 )
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at coldfusion.bootstrap.ClassloaderHelper.initServletClass(ClassloaderHelper.java:121)
at coldfusion.bootstrap.BootstrapServlet.init(BootstrapServlet.java:59)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5001)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5278)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722) -
Null values passed into the servlet
Hi all,
I keep getting null values for all the params that I pass into the servlet i.e. sqltype, producttype, process, instance etc....I have attempted to print some of them out on the screen but I keep getting the 'NullPointerException' error message...can anyone tell me what it is that I have down wrong in the below code?
If I run the servlet with method calls that have hardcoded arguments in them it works but not when I pass in the params from the URL...I am absolutley puzzled!
Help!
package blotter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.db.util.WriteToLogFile;
import blotter.cache.*;
Servlet to extract an object that has already been placed
in the cache by GetBondPrices servlet from the cache.
public class ExtractSecurityObject extends HttpServlet
String sqlType = "";
String productType = "";
String instance = "";
String process = "";
String asOfDate = "";
String currencyCode = "";
String curveId = "";
String results = "";
private String debug;
private PrintWriter out;
private WriteToLogFile logFile;
// called when servlet first initialised
public void init(ServletConfig config) throws ServletException
super.init(config);
// method called for each get request
public void doGet( HttpServletRequest request, HttpServletResponse response )
throws ServletException, IOException
String toWrite = " ";
// Get the object identifier from the parameters passed in
sqlType = request.getParameter("sqltype");
productType = request.getParameter("producttype").toUpperCase();
instance = request.getParameter("instance");
process = request.getParameter("process");
asOfDate = request.getParameter("asofdate");
curveId = request.getParameter("curveid");
currencyCode = request.getParameter("ccy").toUpperCase();
out.println(currencyCode);
if ( request.getParameter("debug") !=null)
debug = request.getParameter("debug");
else
debug ="";
// set the mime type to html
response.setContentType( "text/html" );
out = response.getWriter();
out.println("<HTML>");
try
// write some parameters to a log file
toWrite = toWrite + "<li>" + getServletInfo() + " at " + new Date() + " " + sqlType + " " +
productType + " " + instance + " " + process + " " + asOfDate + " " + curveId + " " +
currencyCode;
CachedObject o1 = (CachedObject)CacheManager.getCache("EB_" + currencyCode + productType + asOfDate);
if(o1 == null){
CacheSecurityObject cso = new CacheSecurityObject();
if((request.getParameter("sqltype") == null) && (request.getParameter("instance") != null)){
results = (String)cso.putSecurityinCache(null, request.getParameter("producttype"), request.getParameter("instance"), request.getParameter("process"), request.getParameter("asOfDate"), request.getParameter("curveId"), request.getParameter("currencyCode"));
//results = (String)cso.putSecurityinCache(null, "yc", "frafu", "official", "20011105", "baceod", "sek");
out.println(results);
} else {
//results = (String)cso.putSecurityinCache("bondtypes", "bond", null, "official", "20011105", "baceod", "eur");
results = (String)cso.putSecurityinCache(request.getParameter("sqltype"), request.getParameter("producttype"), null, request.getParameter("process"), request.getParameter("asOfDate"), request.getParameter("curveId"), request.getParameter("currencyCode"));
out.println(results);
else{
out.println(((String)o1.object).toString());
// general catch for all exceptions
catch(Exception exception)
out.println( "Exception: The item that you requested was not found in the cache" + "<BR>" );
toWrite = toWrite + "Exception : " + exception.getMessage() + "\n" ;
finally
// write to logfile
logFile = new WriteToLogFile();
logFile.setSourceDirName("blotter");
logFile.setQuery(request.getQueryString());
logFile.setServletPath(request.getServletPath());
if (toWrite!=null)
logFile.writeLog(getServletInfo(),toWrite);
out.println("</HTML>");
out.close();
// need the class name for log file
public String getServletInfo()
return this.getClass().getName();
}That section of the code references a cache to extract an item that has been requested by the user. If the item is not in the cache i.e. if(o1 == null) then it will call a class that generates that object and places that object into the cache. The second time the user makes the same call then they will be handed a cached copy of that object which is aimed to make the whole servlet call faster.
That section of the code works fine coz I have tested that separately. It is the reading in of the arguments that is causing the problem. -
Hi,
We are trying to fire a SOAP request and print the response but its throwing this error �host parameter null�.
hc.executeMethod(post) is failing. the strXMLRequest seems to be correct
Exception in thread "main" java.lang.IllegalArgumentException: host parameter is null
The piece of code iim using is:
String strURL = "http://athenec:47112/oms/XMLAPI/login";
URI u = new URI(strURL);
PostMethod post = new PostMethod();
String strXMLRequest = new String(baos.toByteArray());
post.setRequestBody(strXMLRequest);
post.setURI(u);
post.setPath("/");
post.setRequestHeader("Content-type", "text/xml");
System.out.println("post url is " post.getURI() " post is " +post.getQueryString());
HttpClient hc = new HttpClient();
System.out.println("Came here");
int iResultCode = hc.executeMethod(post);
System.out.println("passed here");
The logs are as follows
post url is http://athenec:47112/ post is null_
Came here
passed here
iResultCode = 404
Can anybody help me out ??your PostMethod takes the Url as the parameter. Check you are using the proper URl i.e like http://host:port/name?params like that
-
CR Server 2008 / Using openDocument interface with a no-logon wrapper
Hi, all!
I had a problem with the openDocument.jsp interface and a no-logon wrapper which took me quite a while to figure out. I'm now posting these results here in the hopes that someone else will find them useful. Of course, if anyone has input how to improve the solution, it's also welcome!
The system on which this was developed and tested was a vanilla Crystal Reports Server 2008 installation on Tomcat / MySQL / Windows Server 2003.
The problem was that calls to openDocument interface left sessions open and this quickly led to the situation where all the concurrent access licenses (CALs) were used. It seemed nondeterministic when a session was released; it could have been minutes or hours.
The solution: write a HTTP session timeout listener which logoffs the CRS-backend session. (The code below has still some dubug output enabled.)
package fi.niscayah.util;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import javax.servlet.http.*;
import java.util.Date;
import java.util.Enumeration;
import java.text.SimpleDateFormat;
public class KillSession implements HttpSessionListener
public void sessionCreated(HttpSessionEvent event)
debug("sessionCreated()", event);
public void sessionDestroyed(HttpSessionEvent event)
HttpSession session = event.getSession();
try {
java.util.Enumeration name = session.getAttributeNames();
while (name.hasMoreElements()) {
String attributeName = (String)name.nextElement();
Object attribute = session.getAttribute(attributeName);
if((attribute != null) && (attribute instanceof IEnterpriseSession)) {
debug(" attribute : " + attributeName);
debug(" type : " + attribute.getClass().getName());
IEnterpriseSession ies = (IEnterpriseSession)attribute;
ies.logoff();
debug("sessionDestroyed()", event);
} catch (Exception ex) {
debug("sessionDestroyed() exception");
private void debug(String msg)
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String timestamp = sdf.format(new Date());
System.err.println("[KillSession] [" + timestamp + "] " + msg);
private void debug(String msg, HttpSessionEvent event)
HttpSession session = event.getSession();
String id = session.getId();
String context = session.getServletContext().getServletContextName();
debug("[" + context + "] [" + id + "] " + msg);
(If you want to test the above code, create a .jar package out of it and put it in webapps/OpenDocument/WEB-INF/lib.)
Next we need to register our listener. I noticed that the openDocument-webapp's web.xml-file already contained a listener definition that claimed to expire enterprise sessions on HTTP timeout. I never saw such results; I tested it by registering my own listener, which only outputted debug information, and then when ever a session timeout happened, I checked the amount of licenses in use via the CMC - it never dropped predictably.
So, comment out the SessionCleanupListener and add KillSession.
<!-- SK: Added own listener. -->
<listener>
<listener-class>fi.niscayah.util.KillSession</listener-class>
</listener>
<!-- SK: Commented out. -->
<!-- SessionCleanupListener is used to expire the EnterpriseSession when the web session is timeout -->
<!-- <listener>
<listener-class>com.businessobjects.sdk.ceutils.SessionCleanupListener</listener-class>
</listener> -->
After the above, change the HTTP session timeout to something more suitable. If you're creating really big reports, one minute might be too little. Also notice, that the value is an approximation. The timeout event might happen just as one minute has passed, but usually it takes more.
<session-config>
<session-timeout>1</session-timeout>
</session-config>
Now we're good to go and test the openDocument interface. The result should be that every time a HTTP session timeouts, an enterprise session (which was initialized via the openDocument call) is logged off.
Next the no-logon wrapper.
I found a lot of examples for logging in automatically, but every one of them exhibited a strange behavior (at least when used in conjunction with the openDocument interface) where the session count was increased by two. A lot of head scratching later, the solution below was devised.
<%@ page language="java"
import = "com.crystaldecisions.sdk.framework.CrystalEnterprise,
com.crystaldecisions.sdk.framework.IEnterpriseSession,
com.crystaldecisions.sdk.framework.ISessionMgr,
com.crystaldecisions.sdk.exception.SDKException"
%>
<%
ISessionMgr sessionManager = CrystalEnterprise.getSessionMgr();
IEnterpriseSession entSession = sessionManager.logon("Guest", "", "<server>:6400", "secEnterprise");
String entToken = entSession.getLogonTokenMgr().createWCAToken("", 1, 1);
// So that this can be logged off when the session timeouts
HttpSession httpSession = request.getSession();
httpSession.setAttribute("nologon_SESSION", entSession);
String query = request.getQueryString();
String redirectURL = "http://<server>:8080/OpenDocument/opendoc/openDocument.jsp?" +
query + "&token=" + entToken;
response.sendRedirect(redirectURL);
%>
You can put the above .jsp-file where you like, but I dropped it in webapps/openDocument, since it's no use by itself.
The use of nologon.jsp is simple: use it as you would openDocument.jsp.
And there you have it. A word of warning though, if you're not sure what you're doing, I wouldn't recommend trying these things out. And you certainly shouldn't deploy these on a production environment.
As said before, any input is welcome!I'll comment on the BusinessObjects Enterprise logon tokens that you may generate via the Enterprise SDK.
DefaultToken - this is used for failover - i.e., if the original EnterpriseSession object is destroyed without having logoff() method invoked, the failover can be used to re-connect to Enterprise without redo-ing authentication. This token is immediately invalidated with EnterpriseSession.logoff().
CreateLogonToken - token represents an EnterpriseSession independent of the original EnterpriseSession that generates it. So you should generated the CreateLogonToken and log off the EnterpriseSession before using the token, or you'll have two licenses being used.
CreateWCAToken - the Web Component Adapter token - this token is tied to the EnterpriseSession used to create it. If this EnterpriseSession is invalidated, the WCA token can no longer be used. Since this is essentially re-use of the original EnterpriseSession, license count is not increased with its use.
So in your application, you're generating the WCA Token, and using the Session Listener to explicitly log off the originating EnterpriseSession. The SessionCleanupListener is for cleaning up sessions created within InfoView on Web Application Server Session timeout.
Sincerely,
Ted Ueda -
In WL6.1 request.getParameter returns NULL for URL parameters that exist
With the following URL, I get different results between WebLogic 4.5.1 and WebLogic
6.1:
http://phx-kmccarthy.medspecialists.net/tsweb/ParametersTest.jsp?apple=macintosh&tree&dog&country=USA
Weblogic 6.1 returns:
query string = apple=macintosh&tree&dog&country=USA
apple = macintosh
tree = null
dog = null
country = USA
WebLogic 4.5.1 returns:
query string = apple=macintosh&tree&dog&country=USA
apple = macintosh
tree =
dog =
country = USA
here is the jsp...
<%--
* ParamtersTest.jsp which shows that empty parameters are ignored in WebLogic
6.1
--%>
<%
String apple, tree, dog, country;
apple = request.getParameter("apple");
tree = request.getParameter("tree");
dog = request.getParameter("dog");
country = request.getParameter("country");
out.println("<br>query string = " + request.getQueryString());
out.println("<br>apple = " + apple);
out.println("<br>tree = " + tree);
out.println("<br>dog = " + dog);
out.println("<br>country = " + country);
%>
From the documentation on the getParameter() method:
Returns the value of a request parameter as a String, or null if the parameter
does not exist.
In my opinion, not existing and being empty are different. Also, every other web
application environment we've dealt with (including WebLogic 4.5.1) treats them
as different. If the parameter doesn't have a value, (i.e. ...&tree&dog&...) then
getParameter() returns the empty string, not null.
As a result of this we have JSPs that break when running on 6.1.
Found the solution at last. Tomcat servlet container can't handle the chunked transfer-encoding that the J2ME Wireless Toolkit uses when you call outputstream.flush() in midlet. Using outputstream.close() instead of outputstream.flush() will avoid this problem for small requests. For all the codes in the articles on Http Post in Wireless Forum, don't use outputstream.flush() and it will run perfectly - Servlet's request.getParameter(parameterName) will work fine in doPost method.
-
Problem with inserting data into mySQL database with jsp
I have a jsp page that collects infromation about a users vehicle and puts the data into a mySQL database. Iv'e been messing around with it for ages & i can't seem to get it to work even though i cannot see anything wrong with the code, which can be seen below.
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="Connections/connection.jsp" %>
<%
// *** Restrict Access To Page: Grant or deny access to this page
String MM_authorizedUsers="";
String MM_authFailedURL="login_form.jsp";
boolean MM_grantAccess=false;
if (session.getValue("MM_Username") != null && !session.getValue("MM_Username").equals("")) {
if (true || (session.getValue("MM_UserAuthorization")=="") ||
(MM_authorizedUsers.indexOf((String)session.getValue("MM_UserAuthorization")) >=0)) {
MM_grantAccess = true;
if (!MM_grantAccess) {
String MM_qsChar = "?";
if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&";
String MM_referrer = request.getRequestURI();
if (request.getQueryString() != null) MM_referrer = MM_referrer + "?" + request.getQueryString();
MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + java.net.URLEncoder.encode(MM_referrer);
response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
return;
String vehicle_details__registration = null;
if(request.getParameter("txt_registration") != null){ vehicle_details__registration = (String)request.getParameter("txt_registration");}
String vehicle_details__make = null;
if(request.getParameter("txt_make") != null){ vehicle_details__make = (String)request.getParameter("txt_make");}
String vehicle_details__model = null;
if(request.getParameter("txt_model") != null){ vehicle_details__model = (String)request.getParameter("txt_model");}
String vehicle_details__colour = null;
if(request.getParameter("txt_colour") != null){ vehicle_details__colour = (String)request.getParameter("txt_colour");}
String vehicle_details__tax_class = null;
if(request.getParameter("select_tax_class") != null){ vehicle_details__tax_class = (String)request.getParameter("select_tax_class");}
String vehicle_details__chasis_num = null;
if(request.getParameter("chasis_num") != null){ vehicle_details__chasis_num = (String)request.getParameter("chasis_num");}
String vehicle_details__status = null;
if(request.getParameter("radio_status") != null){ vehicle_details__status = (String)request.getParameter("radio_status");}
String owner_details__MMColParam = "1";
if (session.getValue("MM_Username") !=null) {owner_details__MMColParam = (String)session.getValue("MM_Username");}
Driver Drivervehicle_details = (Driver)Class.forName(MM_connection_DRIVER).newInstance();
Connection Connvehicle_details = DriverManager.getConnection(MM_connection_STRING,MM_connection_USERNAME,MM_connection_PASSWORD);
PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
vehicle_details.executeUpdate();
%>
<form name="add_vehicle_form" id="add_vehicle_form">
<p>Registration mark:
<input name="txt_registration" type="text" id="txt_registration">
</p>
<p>Make:
<input name="txt_make" type="text" id="txt_make">
</p>
<p>Model:
<input name="txt_model" type="text" id="txt_model">
</p>
<p>Colour:
<input name="txt_colour" type="text" id="txt_colour">
</p>
<p>Tax Class:
<select name="select_tax_class" id="select_tax_class">
<option value="AAA">Band AAA (up to 100g/km)</option>
<option value="AA">Band AA (101 - 120g/km)</option>
<option value="A">Band A (121 - 150g/km)</option>
<option value="B">Band B (151 - 165g/km)</option>
<option value="C">Band C (166 - 185g/km)</option>
<option value="D">Band D (Over 185g/km)</option>
</select>
</p>
<p>Chasis Number:
<input name="txt_chassis_num" type="text" id="txt_chassis_num">
</p>
<p>Status: active:
<input name="radio_status" type="radio" value="1" checked>
off-road
<input name="radio_status" type="radio" value="0">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<%
Connvehicle_details.close();
%>This is the error I am getting from the server
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 3 in the jsp file: /add_vehicle_form.jsp
Generated servlet error:
C:\Servers\Tomcat 5.0\work\Catalina\localhost\Assignment\org\apache\jsp\add_005fvehicle_005fform_jsp.java:113: ')' expected
PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
^
1 error
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:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
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)
Any help would be much appreciated.
Thanksuse this ...
PreparedStatement vehicle_details =
Connvehicle_details.prepareStatement("INSERT INTO
vehicle_man_db.vehicle_details (registartion, make,
model, colour, tax_class, chasis_num) VALUES
vehicle_details .setString(1,String
vehicle_details__registration );
vehicle_details setString(2,String
vehicle_details__make );
vehicle_details .setString(3,String
vehicle_details__model );
vehicle_details .setString(4,vehicle_details__colour
vehicle_details .setString(5,String
vehicle_details__tax_class);
vehicle_details .setString(6,String
vehicle_details__chasis_num );
vehicle_details .executeQuery();Even you need a screwing up... what's the point putting that String inside. That's the bloody error. -
How to get the ASM to OS device name mapping
Hi all,
This seems to be an often answered question, but usually the answers specify what to do on the OS (e.g. run oracleasm etc) and/or in the ASM database running on the ASM Host (select * from V$...).
In our situation have plug-ins collecting data from Agents. Plugins collect data from Oracle db/ASM targets and from storage arrays.
Back on the OMS we want to be able to report on the ASM to OS device name mapping. To report, we use either the default metadata UI (i.e. data from the sysman.mgmt_emx_... tables) or we have a BI Publisher report that queries the OEM Repository Database (and can join the ECM tables from the different plug-ins).
The link between the ASM path and the OS device name does not seem to be collected by either the Oracle DB/ASM plug-in, nor by any other plug-in (Host/Storage/...).
It would be easy to go to Linux and run a few commands, but we need to support multiple platforms, like AIX, Solaris x86, Windows as well.
A complicating factor is that ASM can be installed in different configurations, e.g. using ASMlib or using udev...
I really suspect this wheel has been invented before?! Or is it really a matter of having multiple OS-specific low-level scripts and adding a bunch of instance parameters for allowing the user to specify all OS-specific path/utility names etc?
Any suggestions welcome... :-)
Many thanks,
EdGoogle is your best friend ;-)
Those are standard CGI variables, must be available in PHP/ASP(X)/JSP/your-favorite.
Anyway, try this:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
/** Creates a table showing the values of all the CGI variables.
* Part of tutorial on servlets and JSP that appears at * http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/ * 1999 Marty Hall; may be freely used or adapted. */ public class ShowCGIVariables extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String[][] variables = { { "AUTH_TYPE", request.getAuthType() }, { "CONTENT_LENGTH", String.valueOf(request.getContentLength()) }, { "CONTENT_TYPE", request.getContentType() }, { "DOCUMENT_ROOT", getServletContext().getRealPath("/") }, { "PATH_INFO", request.getPathInfo() }, { "PATH_TRANSLATED", request.getPathTranslated() }, { "QUERY_STRING", request.getQueryString() }, { "REMOTE_ADDR", request.getRemoteAddr() }, { "REMOTE_HOST", request.getRemoteHost() }, { "REMOTE_USER", request.getRemoteUser() }, { "REQUEST_METHOD", request.getMethod() }, { "SCRIPT_NAME", request.getServletPath() }, { "SERVER_NAME", request.getServerName() }, { "SERVER_PORT", String.valueOf(request.getServerPort()) }, { "SERVER_PROTOCOL", request.getProtocol() }, { "SERVER_SOFTWARE", getServletContext().getServerInfo() } }; String title = "Servlet Example: Showing CGI Variables"; out.println(ServletUtilities.headWithTitle(title) + "\n" + "
" + title + "\n" + "\n" + "\n" + "CGI Variable Name
Value"); for(int i=0; iNot specified"; out.println("
" + varName + "
" + varValue); } out.println("
"); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } -
Custom Login using the Pluggable Identity Management Framework
Hi all,
We are trying to establish 2 ways into our application:
1. via a login form
2. seamless login from an external application
To achieve this we are trying to build our own custom authentication using the pluggable IDM framework.
Basically if a secure page is requested, we want to check the header/cookie/request (don't mind which) for a key which is provided by the external application. If present, the key is validated against a web service provided by the external app, the identity is asserted and the user is entered seamlessly into the application. If the header/cookie/request does not contain a key the user is to be redirected to a login page, where they can input username and password which will be validated against our database.
We've created a Token Collector and Token Asserter class, we've modified our custom Login Module to retrieve the identity created by the Token Asserter but we haven't worked out how to get the alternate login page working for users which don't come through the external application.
Has anybody built anything similar? From the documentation it appears we should be able to achieve our goal using the pluggable IDM, but we're going around in circles a bit at the moment.
Any help/sample code would be greatly appreciated.
thanks.Can you tell why the page is not working? I mean, any errors ? What happens when you try to open the protected resource?
Here is an example of the code, I removed some part of the code specific to the bussines so if you have doubts just let me know
token collector
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import oracle.security.jazn.collector.CollectorException;
import oracle.security.jazn.collector.TokenCollector;
import oracle.security.jazn.sso.SSOTokenFormatException;
import oracle.security.jazn.token.IdentityToken;
import oracle.security.jazn.token.TokenNotFoundException;
public class MyTokenCollector implements TokenCollector
private Properties _properties;
public void fail(HttpServletRequest request,
HttpServletResponse response, int reason)
throws CollectorException
String loginURL = _properties.getProperty("custom.sso.url.login");
String urlParam = _properties.getProperty("custom.sso.url.param");
String idParam = _properties.getProperty("custom.sso.id.param");
Log.Info("Token collection failed (" + reason + ")");
StringBuffer requestURL = request.getRequestURL();
String queryString = request.getQueryString();
requestURL = requestURL.append("?").append(queryString);
StringBuffer sb = new StringBuffer();
try
sb = sb.append(urlParam).append("=");
String encodedStr =
URLEncoder.encode(requestURL.toString(), "UTF-8");
sb = sb.append(encodedStr);
sb = sb.append("#").append(request.getServerName()).append("#").append(request.getServerPort());
String redirectQueryString = sb.toString();
String rurl = loginURL + "?" + redirectQueryString;
response.sendRedirect(response.encodeRedirectURL(rurl));
catch (UnsupportedEncodingException uee)
SSOTokenFormatException stfe =
new SSOTokenFormatException(uee, 4);
Log.Error(stfe.getMessage());
throw new CollectorException(stfe);
catch (IOException ioe)
Log.Error("IOException occured: " + ioe);
throw new CollectorException(ioe);
public IdentityToken getToken(String tokenType,
HttpServletRequest request,
List tokenNames, Properties properties)
throws TokenNotFoundException, CollectorException
_properties = properties;
String valor = null;
Log.Info("URL: "+request.getRequestURI());
if ( tokenType. equalsIgnoreCase("HTTP_COOKIE"))
valor = procesarCookie(request, tokenNames);
}else if (tokenType.equalsIgnoreCase("HTTP_HEADER"))
valor = procesarHeader(request, tokenNames);
}else
throw new CollectorException("token type not supported");
MyIdentityToken token = new MyIdentityToken(valor);
token.setTokenType(tokenType);
token.setPropiedades(properties);
return token;
private String procesarCookie(HttpServletRequest request, List tokenNames)
throws TokenNotFoundException
if (1 != tokenNames.size())
//Only one cookie can be handled
String error = "Invalid number of cookies check jazn.xml";
throw new TokenNotFoundException(error);
Map cookies = new Hashtable();
Cookie allCookies[] = request.getCookies();
if (allCookies != null)
String cookieName = (String) tokenNames.get(0);
Log.Info( "Searching for cookie: " + cookieName);
Cookie cookie;
for(int i = 0; i < allCookies.length; i++)
cookie = allCookies;
if (cookie.getName().equals(cookieName))
return cookie.getValue();
String error = "Rquired cookie not found";
Log.Error(error);
throw new TokenNotFoundException(error);
}else
String error = "No cookie on request";
throw new TokenNotFoundException(error);
private String procesarHeader(HttpServletRequest request, List tokenNames)
throws TokenNotFoundException
String nombreHeader = (String) tokenNames.get(0);
String header = request.getHeader(nombreHeader);
if (header != null)
return header;
}else
String error = "Request doesn't have the requierd header";
throw new TokenNotFoundException(error);
Token Asserter Example
import java.util.Properties;
import javax.security.auth.Subject;
import oracle.security.jazn.asserter.AsserterException;
import oracle.security.jazn.asserter.TokenAsserter;
import oracle.security.jazn.callback.IdentityCallbackHandler;
import oracle.security.jazn.callback.IdentityCallbackHandlerImpl;
import oracle.security.jazn.token.IdentityToken;
public class MyTokenAsserter
implements TokenAsserter
public void finalize()
throws Throwable
public IdentityCallbackHandler assertIdentity(String tokenType,
IdentityToken token,
Properties properties)
throws AsserterException
InversuraIdentityToken idToken = (InversuraIdentityToken) token;
String valorToken = idToken.getValorToken();
InversuraToken invToken;
try {
invToken = new InversuraToken(valorToken);
if (verificarVigencia(invToken))
IdentityCallbackHandlerImpl idcb = new IdentityCallbackHandlerImpl(invToken.getLogin());
idcb.setAuthenticationType("InversuraSSO");
idcb.setIdentityAsserted(true);
MyPrincipal ppal = new MyPrincipal(invToken.getLogin());
Subject subj = new Subject();
subj.getPrincipals().add(ppal);
idcb.setSubject(subj);
return idcb;
throw new AsserterException("Token expired");
}catch (Exception e)
String error = e.getMessage();
throw new AsserterException(error, e);
public boolean verificarVigencia(InversuraToken token)
return token.estaVigente(); -
How do i make http connection from an applet to a servlet
i am not able to make a http connection from the applet to servlet
my code for servlet is as follows
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class newDatabaseServlet extends HttpServlet {
// Connection con;
// Statement stmt;
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType("text/content");
System.out.println("megha");
String mthd[] = req.getParameterValues("event");
System.out.println(mthd.length);
System.out.println(mthd);
System.out.println(req.getQueryString());
// System.out.println("megha");
PrintWriter fw = new PrintWriter(new FileOutputStream(new File("e:/JRun/servers/default/default-app/mycontent.txt")));
String s = "this text comes from servlet";
fw.print(s);
fw.flush();
if(mthd[0].equalsIgnoreCase("callEditor")) {
openEditor(req,resp);
public void openEditor(HttpServletRequest req, HttpServletResponse resp) {
/* try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@pc6:1521:oradba","test","test");
catch(Exception e) {
e.printStackTrace();
try {
resp.sendRedirect("/RunApp1.html");
catch(IOException e) {
e.printStackTrace();
/*try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@pc6:1521:oradba","test","test");
catch(Exception e) {
e.printStackTrace();
resp.setContentType("text/html");
PrintWriter output = resp.getWriter();
try {
stmt = con.createStatement();
String strContent = "select * from edTable where newsid = 2";
ResultSet rs = stmt.executeQuery(strContent);
if(rs.next()) {
String newsText = rs.getString(2);
/* StringBuffer buf = new StringBuffer();
buf.append("<B>servlet</B>");
try {
resp.sendRedirect("RunApp");
catch(IOException e) {
e.printStackTrace();
// output.println(buf.toString());
// output.close();
my code for applet is
import javax.swing.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.awt.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
public class EdApplet extends JApplet {
public void init() {
Container c;
c = getContentPane();
JPanel but = new JPanel();
c.add(but,BorderLayout.NORTH);
final JEditorPane je = new JEditorPane();
JScrollPane jsp = new JScrollPane(je);
HTMLEditorKit ht = new HTMLEditorKit();
je.setEditorKit(ht);
je.setEditable(true);
HTMLDocument mdoc = (HTMLDocument)ht.createDefaultDocument();
StyleSheet mcontext =mdoc.getStyleSheet();
je.setDocument(mdoc);
c.add(jsp,BorderLayout.CENTER);
JPanel bot = new JPanel();
c.add(bot,BorderLayout.SOUTH);
JButton save = new JButton("save");
but.add(save);
String str = getInitialText();
je.setText(str);
String servletUrl="http://pc7:8100/servlet/newDatabaseServlet";
try{
URL servletURL = new URL(servletUrl);
URLConnection servletConnection = servletURL.openConnection();
servletConnection.setRequestProperty("event","saveText");
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
catch(Exception e) {
// je.setText(e.printStackTrace());
ActionListener lst = new ActionListener() {
public void actionPerformed(ActionEvent ae) {
String save = je.getText();
saveText(save,je);
save.addActionListener(lst);
//je.setText("<B>this</B>");
//URLConnection servletConnection = null;
/* try {
String servletUrl="http://pc7:8100/servlet/newDatabaseServlet";
URL myUrl = new URL(servletUrl);
servletConnection = myUrl.openConnection();
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
/* BufferedReader br = new BufferedReader(new InputStreamReader(servletConnection.getInputStream()));
String t = br.readLine();
je.setText(t);
catch(Exception e) {
e.printStackTrace();
/* ActionListener lst = new ActionListener() {
public void actionPerformed(ActionEvent ae) {
BufferedReader br = new BufferedReader(new InputStreamReader(servletConnection.getInputStream()));
String t = br.readLine();
je.setText(t);
click.addActionListener(lst);
/*void String changeText(UrlConnection con) {
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream));
String t = br.readLine();
return t;
public String getInitialText()
//String me = null;
URLConnection textConnection = null;
StringBuffer sb = new StringBuffer();
try {
String textUrl="http://pc7:8100/mycontent.txt";
URL myUrl = new URL(textUrl);
textConnection = myUrl.openConnection();
textConnection.setDoInput(true);
textConnection.setUseCaches(false);
BufferedReader br = new BufferedReader(new InputStreamReader(textConnection.getInputStream()));
// me = (String)servletConnection.getContent();
String s = null;
while((s = br.readLine())!=null) {
sb.append(s);
catch(Exception e) {
e.printStackTrace();
return sb.toString();
public void saveText(String saveStr,JEditorPane je) {
//String saveStr = je.getText();
//String servletUrl="http://pc7:8100/servlet/newDatabaseServlet?event='saveText'&newsid='2'";
//String servletGet="http://pc7:8100/servlet/newDatabaseServlet";
String servletUrl="http://pc7:8100/servlet/newDatabaseServlet";
//String servletUrl = servletGet + "?"
// + URLEncoder.encode("event") + "="
// + URLEncoder.encode("saveText");
// je.setText(servletUrl);
try {
URL servletURL = new URL(servletUrl);
URLConnection servletConnection = servletURL.openConnection();
// servletConnection.setRequestProperty("event","saveText");
servletConnection.setRequestProperty(
"User-Agent","Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
//System.out.println("from applet");
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
//Propertiew prop = new Properties();
// prop.put("event","saveText");
PrintStream out = new PrintStream(servletConnection.getOutputStream());
out.println("event");
out.close();
catch(IOException e) {
je.setText(e.toString());
kindly tell me what is the error
what is the best method of doing this
thanking u in anticipation
megha soodomg O_o
We cannot debug your code, but:
Did you try the servlet directly from your browser? Does it work?
Best regards from Germany,
r.v. -
Can we have a filter to handle all the apps in a container?
Hi,
I have a simple (Stupid) question.
Can I configure a Servlet filter to intercept requests to all the applications (a.k.a all the ServletContexts)? All I know is we can configure a filter for each ServletContext (application), but I am wondering if there is any way.
The reason I am asking is because, if there is a way to do so, I can configure my filter to provide me the debug output (Such as CGI, session, request, and ServletContext variables) on all the applications on development servers and when I can get rid of debugging on production servers (by not deploying the filter).
Thanx in advance,
Thirupati PanyalaThanks for the reply Sudhir.
I tried it in Tomcat 4.x. It works for only the root resources even though I configured the filter for /* which is expected to include all the resources including root (for ex: /examples/...).
So, I understand, the web.xml under /conf will be overriden by that of the respective apps as you go further down the context paths (apps). That's why the container was not executing my filter when I went to the next level of the URI (http://localhost:8080/index.html WORKED, but NOT http://localhost:8080/examples/jsp/num/numguess.jsp).
If you want to try it for yourself, here is the piece of code I tried with (This is taken from Apache Tomcat source):
package filters;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.Timestamp;
import java.util.Enumeration;
import java.util.Locale;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
* Example filter that dumps interesting state information about a request
* to the associated servlet context log file, before allowing the servlet
* to process the request in the usual way. This can be installed as needed
* to assist in debugging problems.
* @author Craig McClanahan
* @version $Revision: 1.5 $ $Date: 2001/05/23 22:26:17 $
public final class RequestDumperFilter implements Filter {
// ----------------------------------------------------- Instance Variables
* The filter configuration object we are associated with. If this value
* is null, this filter instance is not currently configured.
private FilterConfig filterConfig = null;
// --------------------------------------------------------- Public Methods
* Take this filter out of service.
public void destroy() {
this.filterConfig = null;
* Time the processing that is performed by all subsequent filters in the
* current filter stack, including the ultimately invoked servlet.
* @param request The servlet request we are processing
* @param result The servlet response we are creating
* @param chain The filter chain we are processing
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet error occurs
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
if (filterConfig == null)
return;
// Render the generic servlet request properties
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
writer.println("Request Received at " +
(new Timestamp(System.currentTimeMillis())));
writer.println(" characterEncoding=" + request.getCharacterEncoding());
writer.println(" contentLength=" + request.getContentLength());
writer.println(" contentType=" + request.getContentType());
writer.println(" locale=" + request.getLocale());
writer.print(" locales=");
Enumeration locales = request.getLocales();
boolean first = true;
while (locales.hasMoreElements()) {
Locale locale = (Locale) locales.nextElement();
if (first)
first = false;
else
writer.print(", ");
writer.print(locale.toString());
writer.println();
Enumeration names = request.getParameterNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
writer.print(" parameter=" + name + "=");
String values[] = request.getParameterValues(name);
for (int i = 0; i < values.length; i++) {
if (i > 0)
writer.print(", ");
writer.print(values);
writer.println();
writer.println(" protocol=" + request.getProtocol());
writer.println(" remoteAddr=" + request.getRemoteAddr());
writer.println(" remoteHost=" + request.getRemoteHost());
writer.println(" scheme=" + request.getScheme());
writer.println(" serverName=" + request.getServerName());
writer.println(" serverPort=" + request.getServerPort());
writer.println(" isSecure=" + request.isSecure());
// Render the HTTP servlet request properties
if (request instanceof HttpServletRequest) {
writer.println("---------------------------------------------");
HttpServletRequest hrequest = (HttpServletRequest) request;
writer.println(" contextPath=" + hrequest.getContextPath());
Cookie cookies[] = hrequest.getCookies();
if (cookies == null)
cookies = new Cookie[0];
for (int i = 0; i < cookies.length; i++) {
writer.println(" cookie=" + cookies[i].getName() +
"=" + cookies[i].getValue());
names = hrequest.getHeaderNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
String value = hrequest.getHeader(name);
writer.println(" header=" + name + "=" + value);
writer.println(" method=" + hrequest.getMethod());
writer.println(" pathInfo=" + hrequest.getPathInfo());
writer.println(" queryString=" + hrequest.getQueryString());
writer.println(" remoteUser=" + hrequest.getRemoteUser());
writer.println("requestedSessionId=" +
hrequest.getRequestedSessionId());
writer.println(" requestURI=" + hrequest.getRequestURI());
writer.println(" servletPath=" + hrequest.getServletPath());
writer.println("=============================================");
// Log the resulting string
writer.flush();
response.getWriter().print(sw.getBuffer().toString());
// Pass control on to the next filter
chain.doFilter(request, response);
* Place this filter into service.
* @param filterConfig The filter configuration object
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
* Return a String representation of this object.
public String toString() {
if (filterConfig == null)
return ("RequestDumperFilter()");
StringBuffer sb = new StringBuffer("RequestDumperFilter(");
sb.append(filterConfig);
sb.append(")");
return (sb.toString());
And the config in web.xml is :
<filter>
<filter-name>Request Dumper Filter</filter-name>
<filter-class>filters.RequestDumperFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Request Dumper Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Thanx
Thirupati Panyala -
HTTP POST and Internet Explorer
Sorry for the cross post, but after reading through this newsgroup, it
seems that this audience is better suited to answer this question...
===========================
We're running across a very strange bug that is happening only in
Internet Explorer and only when posting form data. Netscape works
completely fine every single time.
The user experience is this:
Using IE, I get to a JSP that's got a form. I click a button on said
form that performs either a "Save" or a "Cancel" action and am
immediately hit with the wonderful "This page cannot be displayed(Cannot
find server or DNS Error)" IE error message.
What happens on the server side is this:
User posts a form to a JSP. The JSP does any processing that it needs
to, which in the case of "Cancel" is nothing, and issues these commands:
response.sendRedirect("/some/page.jsp");
return; //exit program immediately!
I've verified that the server is executing as expected, sending the
response and returning out of the program. That's where things seem to
go awry in Internet Explorer. It's as if IE is not interpreting the
HTTP response header correctly and just dies not knowing where to go.
The even stranger thing is that, when running WLS on our internal
network, this does not happen unless your dialed up. However, when
hitting our servers that are colocated, this happens on a regular basis.
One more thing to note is that this does not happen every time. It
happens more than 90% of the time, but not every time, which is why it's
very hard for me to recreate.
Another strange thing is that this error seems to depend on the content
of the form
variables, for instance I can have a form with check boxes that errors
out when the
check boxes are unchecked, but is fine when the boxes are checked, and
in both
cases I'm not doing anything at all with the data that is getting
posted.
I've tried everything from changing the http headers to changing the
post to be
multipart encoded, and nothing works.
If you've got a clue or a hint or any suggestions where I should be
looking, then please let me know. I've got a few more things to check
out, but I'm running out of ideas.
Our platform:
- RedHat Linux 6.0
- WebLogic Server 4.5.1 Service Pack 5
- JDK 1.2.2 (Sun/Blackdown)
These JSPs:
- Are posting form data ("GET" works for some reason)
- Are not using any JavaScript
Hi Chris/All,
Following on from this I contacted WebLogic support (Frederic). They
suggested I downgrade from 4.5.1 sp8 to 4.5.1 sp7. They also suggested I
use HttpResponse.encodeURL()...
This did not solve my problem but I went on to discover the following...
Hi Frederic,
We tried with sp7
I thought HttpResponse.encodeURL just encoded session data where no cookie
support was in the browser, but I tried it anyway.
Also tried the following to the page I'm redirecting back to (to prevent
browser cacheing)
resp.setHeader("Cache-Control","no-cache"); file://HTTP 1.1
resp.setHeader("Pragma","no-cache"); file://HTTP 1.0
resp.setDateHeader ("Expires", 0); file://prevents caching at the proxy
server
Also added the following to override the standard implementation
protected long getLastModified(HttpServletRequest req)
System.out.println("ServletA.getLastModified"); // ensure lastModified is
always in the future requiring a reload
return Long.MAX_VALUE;
The only way I've been able to force this to work is a bit of a cludge and
is as follows...
// add time to queryString to fool IE5 into thinking this is a new web page.
String parentURL = HttpUtils.getRequestURL(req) + "?" + req.getQueryString()
+ "&t=" + System.currentTimeMillis();
The following is also of interest
http://forum.java.sun.com/forum?14@@.787c19c1
HTH, Let me know
Thanks, Gary
Gary <[email protected]> wrote in message
news:[email protected]...
> This sounds similar to a problem I'm having with straight Servlets.
>
> I have a servlet (ServletA) that has a link to another servlet via <a
href>
> tags (ServletB). ServletB does some processing and calls ServletA with
> original parameters to show the user the changed details. This is done as
> follows...
>
> respose.sendRedirect(ServletA?params);
> return;
>
> Once again this is fine in Netscape 4.07 but only works on IE5 machine
here
> to date (which unfortunately happens to be mine, leading to my late
> discovery of this problem).
>
> My IE version is 5.00.2314.1003 if that helps.
>
>
> Chris Fraser <[email protected]> wrote in message
> news:[email protected]...
> > Sorry for the cross post, but after reading through this newsgroup, it
> > seems that this audience is better suited to answer this question...
> > ===========================
> > We're running across a very strange bug that is happening only in
> > Internet Explorer and only when posting form data. Netscape works
> > completely fine every single time.
> >
> > The user experience is this:
> > Using IE, I get to a JSP that's got a form. I click a button on said
> > form that performs either a "Save" or a "Cancel" action and am
> > immediately hit with the wonderful "This page cannot be displayed(Cannot
> >
> > find server or DNS Error)" IE error message.
> >
> > What happens on the server side is this:
> > User posts a form to a JSP. The JSP does any processing that it needs
> > to, which in the case of "Cancel" is nothing, and issues these commands:
> >
> > response.sendRedirect("/some/page.jsp");
> > return; file://exit program immediately!
> >
> > I've verified that the server is executing as expected, sending the
> > response and returning out of the program. That's where things seem to
> > go awry in Internet Explorer. It's as if IE is not interpreting the
> > HTTP response header correctly and just dies not knowing where to go.
> >
> > The even stranger thing is that, when running WLS on our internal
> > network, this does not happen unless your dialed up. However, when
> > hitting our servers that are colocated, this happens on a regular basis.
> >
> > One more thing to note is that this does not happen every time. It
> > happens more than 90% of the time, but not every time, which is why it's
> >
> > very hard for me to recreate.
> >
> > Another strange thing is that this error seems to depend on the content
> > of the form
> > variables, for instance I can have a form with check boxes that errors
> > out when the
> > check boxes are unchecked, but is fine when the boxes are checked, and
> > in both
> > cases I'm not doing anything at all with the data that is getting
> > posted.
> >
> > I've tried everything from changing the http headers to changing the
> > post to be
> > multipart encoded, and nothing works.
> >
> > If you've got a clue or a hint or any suggestions where I should be
> > looking, then please let me know. I've got a few more things to check
> > out, but I'm running out of ideas.
> >
> > Our platform:
> > - RedHat Linux 6.0
> > - WebLogic Server 4.5.1 Service Pack 5
> > - JDK 1.2.2 (Sun/Blackdown)
> >
> > These JSPs:
> > - Are posting form data ("GET" works for some reason)
> > - Are not using any JavaScript
> >
>
>
-
Help:UIModel.xml file for ADF Tree with three level depth
Hello,
I am trying to create a DCTree with structure like this:
root....branch1----child11,child12
..........branch2......branch21---child212,child212
............................branch22---child221,child222
Because I can not create more than one binding rule due to the problem that "Add New Rule" button disappears after the first rule is created when I use the tool under Createbinding/Input/Tree to create the DCTree.
Could somebody post or send me a script of the UIModel.xml file of the tree structure above so that I can work around this problem?
Thanks in advance,
DeborahHi,
I haven't test it for more than 3 layers but I have never seen this limitation mantioned anywhere.
I used HGrid and this is my code:
1. UIX file (the relevant part highlighted):
<?xml version = '1.0' encoding = 'windows-1252'?>
<page xmlns="http://xmlns.oracle.com/uix/controller"
xmlns:ui="http://xmlns.oracle.com/uix/ui"
xmlns:data="http://xmlns.oracle.com/uix/ui"
xmlns:ctrl="http://xmlns.oracle.com/uix/controller"
xmlns:html="http://www.w3.org/TR/REC-html40" expressionLanguage="el"
xmlns:myTemplate="test">
<templates xmlns="http://xmlns.oracle.com/uix/ui">
<templateImport source="baseTemplate.uit"/>
</templates>
<content>
<dataScope xmlns="http://xmlns.oracle.com/uix/ui">
<provider>
<!-- Add DataProviders (<data> elements) here -->
</provider>
<contents>
<document>
<metaContainer>
<!-- Set the page title -->
<head title=""/>
</metaContainer>
<contents>
<body>
<contents>
<form name="form0">
<contents>
<myTemplate:baseTmpl title="" xmlns:myTemplate="test">
<contents>
<rowLayout>
<contents>
<link text="Bets View" destination="browseCustBets.do"/>
<spacer width="10" height="10"/>
<link text="Customer Bets" destination="viewCustBets.do"/>
</contents>
</rowLayout>
<rowLayout>
<contents>
<spacer width="10" height="10"/>
</contents>
</rowLayout>
<rowLayout>
<contents>
<hGrid id="hg1" treeData="${uix.data.treeData}" proxy="${uix.eventResult.hGridProxy}">
<columnHeaderData>
<col text="Email"/>
<col text="Bet Date"/>
<col text="ID"/>
<col text="Is Winner"/>
<col text="Amount"/>
<col text="Rate"/>
</columnHeaderData>
<columnHeaderStamp>
<text text="${uix.current.text}"/>
</columnHeaderStamp>
<columnFormats>
<columnFormat columnDataFormat="textFormat" width="140"/>
<columnFormat columnDataFormat="textFormat" width="160"/>
<columnFormat columnDataFormat="textFormat" width="40"/>
<columnFormat columnDataFormat="textFormat" width="70"/>
<columnFormat columnDataFormat="textFormat" width="70"/>
<columnFormat columnDataFormat="textFormat" width="40"/>
</columnFormats>
<contents>
<text text="${uix.current.Email}"/>
<text text="${uix.current.BetDate}"/>
<text text="${uix.current.BetID}"/>
<text text="${uix.current.IsWinner}"/>
<text text="${uix.current.Amount}"/>
<text text="${uix.current.Rate}"/>
</contents>
</hGrid>
</contents>
</rowLayout>
</contents>
<tabs/>
<pageButtons/>
<globalButtons/>
<pageHeader/>
<start/>
<end/>
<about/>
<copyright/>
<privacy/>
<corporateBranding/>
<productBranding/>
</myTemplate:baseTmpl>
<formValue name="${bindings.statetokenid}" value="${bindings.statetoken}" id="_uixState"/>
</contents>
</form>
</contents>
</body>
</contents>
</document>
</contents>
<provider>
<data name="treeData">
<method class="view.CreateTreeData" method="getTreeData"/>
</data>
</provider>
</dataScope>
</content>
<handlers>
<event name="*">
<method class="view.BetDetailsAction" method="doHGridEvent"/>
</event>
</handlers>
</page>
2. CreateTreeData class:
It has a static method getTreeData() that returns a DataObject containing the tree nodes. This methode is mentiond in <provider> node in UIX/XML.
package view;
import java.util.Enumeration;
import model.*;
import oracle.cabo.servlet.BajaContext;
import oracle.cabo.servlet.ServletConstants;
import oracle.cabo.servlet.ui.BajaRenderingContext;
import oracle.cabo.ui.RenderingContext;
import oracle.cabo.ui.UIConstants;
import oracle.cabo.ui.data.DataObject;
import oracle.cabo.ui.data.servlet.HttpSessionDataObject;
import oracle.cabo.ui.data.tree.SimpleTreeData;
import oracle.jbo.ApplicationModule;
import oracle.jbo.ViewObject;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCDataControl;
//import oracle.jbo.common.Configuration;
import javax.servlet.http.HttpSession;
import oracle.jbo.client.Configuration;
public class CreateTreeData
public CreateTreeData()
public static DataObject getTreeData(RenderingContext context, String namespace, String name)
// create root node
SimpleTreeData root = new SimpleTreeData();
int BetID = 0;
// get the parameter from url
BajaContext bContext = (BajaContext) context.getProperty(ServletConstants.BAJA_NAMESPACE,
BajaRenderingContext.BAJA_CONTEXT_PROPERTY);
HttpSession session = bContext.getServletRequest().getSession(true);
try
//BetID = new Integer(( bContext.getServletRequest( ) ).getParameter( "BetID" )).intValue();
String s = ( bContext.getServletRequest( ) ).getQueryString();
BetID = new Integer(s).intValue();
session.setAttribute("BetID", s);
//BetID = new Integer(session.getAttribute("BetID").toString()).intValue();
catch ( Exception ex)
// log the error on the console
BetID = new Integer(session.getAttribute("BetID").toString()).intValue();
//System.out.println( "Parameters cannot be retrieved" );
//System.out.println( ex.getMessage() );
String amDef = "model.AppModule";
String config = "AppModuleLocal";
ApplicationModule am = Configuration.createRootApplicationModule(amDef, config);
AppModuleImpl myAm = (AppModuleImpl)am;
root = myAm.createNodesData(BetID);
myAm.remove();
Configuration.releaseRootApplicationModule(am,true);
// return the tree
return root;
3. createNodesData(int Id) is the actual function that creates the data structure containing the nodes.
It is in AppModule. The actual tree is kept in one table and every node knows its parent ID. There is no limitation in depth.
This function is called recursively until the tree is finished and the parameter Id is the Id of the parent node that I want to be listed. Tne top parent nodes has null in ParentID field.
public SimpleTreeData createNodesData(int Id)
SimpleTreeData tData = new SimpleTreeData();
String baseSQL =
"SELECT Bet.ID, Bet.CUST_LOGIN_ID, Bet.BET_CLASS_ID, Bet.PARENT_BET_ID," +
"Bet.CHAMPIONSHIP_ID, Bet.AMOUNT, Bet.WIN_RATE, Bet.IS_WINNER, Bet.BET_DATE, " +
"BetClass.NAME, CustLogin.EMAIL, CustLogin.ID AS CUST_LOGIN_ID " +
"FROM BET Bet, CUST_LOGIN CustLogin, BET_CLASS BetClass " +
"WHERE (Bet.CUST_LOGIN_ID = CustLogin.ID) AND (Bet.BET_CLASS_ID = BetClass.ID) ";
if(Id!=0){
String sqlStmt = baseSQL + " AND (Bet.ID = '"+ Id +"')";
ViewObject betVo = this.createViewObjectFromQueryStmt("betVo", sqlStmt);
betVo.executeQuery();
if(betVo.hasNext())
//SimpleTreeData tData = new SimpleTreeData();
tData.setText(betVo.first().getAttribute("NAME").toString());
if(betVo.first().getAttribute("PARENT_BET_ID")==null)
tData.put("Email", betVo.first().getAttribute("EMAIL").toString());
tData.put("BetDate", betVo.first().getAttribute("BET_DATE").toString());
tData.put("BetID", betVo.first().getAttribute("ID").toString());
tData.put("IsWinner", betVo.first().getAttribute("IS_WINNER").toString());
tData.put("Amount", betVo.first().getAttribute("AMOUNT").toString());
tData.put("Rate", betVo.first().getAttribute("WIN_RATE").toString());
if(Integer.parseInt(betVo.first().getAttribute("BET_CLASS_ID").toString())>1){
tData.setExpandable(UIConstants.EXPANDABLE_EXPANDED);
betVo.remove();
String sqlStmt = baseSQL + " AND (Bet.PARENT_BET_ID = '"+ Id +"')";
ViewObject betVo = this.createViewObjectFromQueryStmt("betVo" + Id, sqlStmt);
betVo.executeQuery();
while(betVo.hasNext()){
tData.addChild(createNodesData(Integer.parseInt(betVo.next().getAttribute("ID").toString())));
betVo.remove();
return tData;
Hope this will help...
Maybe you are looking for
-
After opening certain websites, pogo, firefox 4.0.1 closes with no error message. When I restore the session I get: Well, this is embarrassing. Firefox is having trouble recovering your windows and tabs. This is usually caused by a recently opened we
-
Generics and warning free code
Is it possible to cast to a generic class without compiler warnings? Object object = null; Comparable comparable1 = (Comparable) object; comparable1.compareTo(object); // warning: unchecked call Comparable<Object> comp
-
Tranport portal content from SP14 to SP18
Hello, Is it possible and advisable to transport portal content (iviews, roles, etc) from a portal on EP6 SP14 to EP6 SP18? Do I need to manually move configuration from one portal to the other? What are my options? Thank you for feedback. Kevin
-
Vkorg,vtweg,spart cannot be determined
im using ORDERS05 idoc to create sales order.when im executing it in we19,the above error is displayed.can any one suggest me the process and mandatory fields in orders05.where should i give the inputs for sales area?? Edited by: vidya sagar on Jul 1
-
How do I add text with not background or box? i need the two lines of text to appear throughout my video as a disclaimer.