JSP as filter class

Hi there,
I am creating a filter, and for the moment I use a class in my webapp as filter-class, and this works well:
<filter-class>lu.mycompany.web.filters.AuthenticationFilter</filter-class>
I wonder if I can use also a JSP in my webapp as filter-class (don't ask why I know it's not the way it should be :)
best regards,
yves

Probably You should. Don't know what exactly you require but better solution may be worked out. If You write jsp as a pure java class it maybe can implement Filter interface but it doesn't make sense. Filter and Servlet have different duties so they were separated.

Similar Messages

  • Get JSF objects in a Filter Class

    Hi! I have a problem with my JSF application. As the most of the web applications I have a login at the begining and I place a Listener - Filter classes for catching the session timeout to returning the user to the login page. All this works OK. The problem it´s to validate that the user only has 1 session open at the time, when the user begin session I change a flag into it's database row, and when the user logout the flags change again to false (both actions (login and logout) was fired by the user clicking it's respective buttons), this works fine, but I want to change the data flag in the database row with the timeout Filter classes after pass 1 minute. My Filter class it's like this:
        public void doFilter(ServletRequest request,ServletResponse response, FilterChain filterChain) throws IOException,ServletException {
            if ((request instanceof HttpServletRequest) && (response instanceof HttpServletResponse)) {
                HttpServletRequest httpServletRequest = (HttpServletRequest) request;
                HttpServletResponse httpServletResponse = (HttpServletResponse) response;                      
                if (!StringUtils.contains(httpServletRequest.getRequestURI(), "welcomeJSF.jsp")) {                                
                    if((httpServletRequest.getRequestedSessionId() != null) && !httpServletRequest.isRequestedSessionIdValid()){
                         /* 1 */               
                           FacesContext context = FacesContext.getCurrentInstance();
                             User user = (User) context.getExternalContext().getSessionMap().get("simpleUser");
                             UserDAO conn = new UserDAO();
                             List users = conn.findByNumber(new Long(user.getNumber()));
                             persistence.User userDB = (persistence.User) users.get(0);
                             userDB.setUse(false);
                             Transaction tx = conn.getSession().beginTransaction();
                             conn.save(userDB);
                             tx.commit();
                             conn.getSession().close();                                     
                             /* 2 */                     
                        String timeoutUrl = httpServletRequest.getContextPath()+ "/faces/" + "welcomeJSF.jsp";
                        System.out.println("Session is not invalid. Redirecting to login page. ");
                        httpServletResponse.sendRedirect(timeoutUrl);
                        return;
            filterChain.doFilter(request, response);
        }When I comment from 1 to 2 works fine, but if I want to get the context.getExternalContext().getSessionMap().get("simpleUser") i get this error:
    java.lang.NullPointerException
         at validadores.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:53)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Thread.java:619)This is because I'm working in a diferent conexts? How can I get Jsf objects from ServletRequest? or to pass getExternalContext().getSessionMap() to the filter class? Any ideas to change the database when the session timeouts if I'm using hibernate?
    Thanks for your time and help!

    correction :
    MyObjectProxy extends ObjectProxy{
         override callProperty(
              // your dyna logic
    and expose new MyObjectProxy(dynaInstance)

  • Trying to page import directive in a JSP  access a class in default package

    I am trying to import a class the is in my default package directory for Tomcat 4.1.18 (context-root\web-inf\classes\*.java). I am getting the following error
    This is error using Tomcat 4.1.18
    org.apache.jasper.JasperException:Unable to compile class for JSP
    C:\Program Files\Tomcat4.1\work\Standalone\localhost\csc297\HTML\SearchByName_jsp.java:9: '.' expected
    import Product;
    C:\Program Files\Tomcat4.1\work\Standalone\localhost\csc297\HTML\SearchByName_jsp.java:10: '.' expected
    import Category;
    This is error using Tomcat 4.0.6
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    C:\forte4j\tomcat401\work\localhost\C_3A_5Cforte4j_5Ctomcat401_5Cwebapps_5Ccsc297\HTML\SearchByName$jsp.java:5: Class Product not found in import.
    import Product;
    ^
    C:\forte4j\tomcat401\work\localhost\C_3A_5Cforte4j_5Ctomcat401_5Cwebapps_5Ccsc297\HTML\SearchByName$jsp.java:6: Class Category not found in import.
    import Category;
    Here is snippet of code from my JSP:
    <%@ page import= "java.util.*"%>
    <%@ page import= "java.text.DecimalFormat"%>
    <%@ page import="Product"%>
    <%@ page import="Category"%>
    Remember these classes are in my default package of my context-root
    Any ideas would greatly appreciated

    Weird error. Never seen this one before.
    Try packaging your classes eg:package myClasses;and import them:<%@page import="myClasses.*"%>Should fix the problem.
    Anthony

  • JSP Debbuging -Error: 'class' or 'interface' expected-

    Hi,
    Does anybody know why am I getting the following error when trying to either debug or run a JSP?
    Error: 'class' or 'interface' expected
    This happens with JDeveloper 9.0.2.829
    It was running just OK, when running from the Navigator Panel (Right click -> Run test.jsp)
    But, when I tried to run the JSP from the Debug Icon -that debugs the whole project-, I got the error I already mentioned.
    Thanks in advance for your help
    Agutin

    Hi,
    Does anybody know why am I getting the following error when trying to either debug or run a JSP?
    Error: 'class' or 'interface' expected
    This happens with JDeveloper 9.0.2.829
    It was running just OK, when running from the Navigator Panel (Right click -> Run test.jsp)
    But, when I tried to run the JSP from the Debug Icon -that debugs the whole project-, I got the error I already mentioned.
    Thanks in advance for your help
    Agutin

  • How to call GET_SEARCH_RESULTS from Filter Class

    Hi All,
    I want to call GET_SEARCH_RESULTS from Filter Class. How can we do? Any sample code.

    Hi Mohan,
    I am using "preComputeDocName"
    public int doFilter(Workspace ws, DataBinder binder, ExecutionContext cxt)
    throws DataException, ServiceException
      String dType=binder.getLocal(UCMConstants.dDocType);
      if(dType.equals("CIDTest"))
       if(binder.getLocal("IdcService").equals("CHECKIN_NEW"))
        String filename=binder.getLocal(UCMConstants.primaryFile);
        originalFileName=filename.substring(filename.lastIndexOf("\\")+1);
        SystemUtils.trace(trace_checkin, "org::"+originalFileName);
        DataBinder newDB = ucmUtils.getNewBinder(binder);
        newDB.putLocal("IdcService", "GET_SEARCH_RESULTS");
        newDB.putLocal("QueryText","dDocType <starts> `"+dType+"` <AND> xcidfilename <starts> `"+originalFileName+"`");
        ucmUtils.executeService(ws, newDB, true);
        DataResultSet docInfoDrs = null;
        docInfoDrs = (DataResultSet) newDB.getResultSet("SearchResults");
        if(docInfoDrs.getNumRows()!=0){
         throw new ServiceException("file is not unique");
        binder.putLocal("xcidfilename", originalFileName);
        return CONTINUE;
    return CONTINUE;

  • JSP vs. Class

    this is a 2 part question.
              1)at my company, jsp pages do a significan amount of server-side
              processing while using regular class files for some additional
              processing. my supervisor wants to remove as much as possible of the jsp
              server-side code and place it in regular class files while having jsp
              pages use those class files. bottom line, what would yield a higher
              performance?
              2)my company's intranet application architecture is JSP->EJB(session
              only; entity is not used at all)->regular class files. EJBs act more
              like a gateway between jsp and regular class files as they do not do any
              processing. for example, if a jsp page makes a call to a class, say
              Class1, it is routed through an EJB. now, if Class1 makes a call to
              Class2, it is done directly without EJB involvement. however, once such
              transaction terminates and the focus is returned back to a jsp, any
              subsequent call to any class would result in a request being routed
              through an EJB again. the question is what would happen if we completely
              removed the EJB layer and just "hit" regular class files directly from
              jsp pages? i now that it works fine since i have tried it on many
              occasions. if such is the case, what is the point of using EJBs in this
              scenario?
              thank you for your help in advance!
              

    Part 1. There are many reasons you might want to make your jsp code lighter
              and imbed more functionality in class files. This would make the JSP files
              easier to maintain, and allow you to have class files which contain logic
              which is not specific to the presentation. (I.e. you could reuse the class
              files much easier in multiple JSP files or other types of clients
              (applications, RMI, etc). As for performance, I don't know if you are going
              to see a dramatic change in performance by removing Java code from the jsp's
              and moving it to the class files. However, you can implement some things
              into your Java class files that you probably wouldn't want to do in jsp
              files, such as connection pooling, singletons, etc that might give you
              higher performance (if you were, for example, making database connections
              straight from the jsp files). For simple iterators and such take a look at
              JSP tags, they are the best model for breaking things out... jsp's don't
              have Java, the beans don't have html- all the translation happens in the
              tags. In the end though I think your biggest gain will be maintainability
              and reusability of the code, not performance.
              Part 2.
              Depends on what you are doing with the class files. Take a look at what the
              EJB architecture affords you--- things like Session State are reliably
              stored in the case of a system crash. (You might want to not commit
              something like an order to the database until the user has visited 3 jsp
              form pages--- between the page visits store the form information in the
              Session Bean to reliably keep the data). Most importantly, you can use
              EJB's to easily take care of issues with transactions and synchronization.
              So if you have a multi-user scenario and need transaction capabilities,
              ejb's are going to really help. If you are already managing synchronization
              issues in your plain java class files you might be ok--- if not you may have
              problems when two people are accessing the class at the same time. Problems
              with not synchronizing your plain class files might not manifest themselves
              most of the time, but under load they are sure to crop up. By wrapping
              every transaction into a session bean you can guarantee that methods called
              on the class are done in a transactionally safe behavior, as well has have
              more choices in terms of optimizing for speed / reliability.
              You might find reading the Enterprise JavaBeans book from O'Reilly useful.
              Also the following link has some lectures from JavaOne which are really
              good:
              http://java.sun.com/javaone/javaone00/replay.html
              Listen to the EJB Architecture Design Strategies and Performance
              Optimizations lecture, it has some good explanations of EJB architecture.
              Josh Lannin
              "mikhail perelman" <[email protected]> wrote in message
              news:[email protected]...
              > this is a 2 part question.
              > 1)at my company, jsp pages do a significan amount of server-side
              > processing while using regular class files for some additional
              > processing. my supervisor wants to remove as much as possible of the jsp
              > server-side code and place it in regular class files while having jsp
              > pages use those class files. bottom line, what would yield a higher
              > performance?
              >
              > 2)my company's intranet application architecture is JSP->EJB(session
              > only; entity is not used at all)->regular class files. EJBs act more
              > like a gateway between jsp and regular class files as they do not do any
              > processing. for example, if a jsp page makes a call to a class, say
              > Class1, it is routed through an EJB. now, if Class1 makes a call to
              > Class2, it is done directly without EJB involvement. however, once such
              > transaction terminates and the focus is returned back to a jsp, any
              > subsequent call to any class would result in a request being routed
              > through an EJB again. the question is what would happen if we completely
              > removed the EJB layer and just "hit" regular class files directly from
              > jsp pages? i now that it works fine since i have tried it on many
              > occasions. if such is the case, what is the point of using EJBs in this
              > scenario?
              >
              > thank you for your help in advance!
              >
              

  • Filter-class 'oracle.webcache.adf.filter.FacesPageCachingFilter' not found

    Hello,
    I am upgrade the JHS to JHS 10.1.3.2.51 and I get the next message when deploy my application:
    500 Internal Server Error
    Servlet error: Error loading filter 'PCF', filter-class 'oracle.webcache.adf.filter.FacesPageCachingFilter' not found
    I put a post on the JHeadstert forum, but they said this is not related to JHeadstart
    Please somebody can help to me?
    Thanks
    Tony

    Tony,
    guess that I need to have a word with them because they bouncing questions back far too often. Make sure you have the Webcache libraries provided and being a part of the project you deploy
    Frank

  • Issue with JSPs with inner classes (bug)

    FYI:
    Turning on Versioning in the registry (Disable=0) JSPs with inner classes causes the following IllegalAccessException...
    This has been confirmed with SP3 and SP4 with our testing...
    14/Jan/2002 13:26:24:4] error: Exception: SERVLET-run_failed: Failed in running template: /NASApp/fortune/foo.jsp, java
    lang.IllegalAccessError: try to access class jsp.APPS.fortune.foo$foobar from class jsp.APPS.fortune.foo
    xception Stack Trace:
    ava.lang.IllegalAccessError: try to access class jsp.APPS.fortune.foo$foobar from class jsp.APPS.fortune.foo
    at jsp.APPS.fortune.foo._jspService(foo.java:78)
    at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.callJSP(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callJspCompiler(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUriRestrictOutput(Unknown Source)
    at com.netscape.server.servlet.platformhttp.PlatformRequestDispatcher.forward(Unknown Source)
    at com.netscape.server.servlet.jsp.JSPRunner.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    Looking for work around....
    Cheers,
    Martin Gee

    I do not see why you would use two sorts.
    And what is the issue exactly by the way? Errors?
    So, the records before the Merge Join need to come sorted, to achieve this simply tick:
    Arthur My Blog

  • Passing values from a JSP to Action class

    Hi,
    I have one JSP in this I have two select boxes.
    The first select box is populated with default values.
    From the first select box I am selecting the value and moving to the other select box using java script.
    Now the value in the second select box has to be submitted alongwith some other values which I am getting.
    These values are to be submitted to a Action class and further to the form bean using struts.
    In the form tag in JSP I am calling the struts action class.
    The issue here is,I am able to get other values except the values in the second select box.
    I am using simple JSP page to get form values and submitting.
    I am not using struts tlds because of project constraints.
    Please advise on how to pass these values.
    Regards,
    Ram

    If the value from the select box isn't submitted, then it's not inside the form. Check the HTML output of your JSP to debug this problem.

  • How to send List from jsp to action class

    hi,
    i m fetching list from database and showing to jsp as follows:
    user can update that list i need to collect that updated list in next action class but i m not able to do that. can anybody suggest me any solution the code i m using is as follows:
    <html:form action="/myUpdate">
    <table>
    <tr>
         <td>
              <label><input type="text" property="name" name="name" value=""/></label>
         </td>
    </tr>
    <logic:iterate id="address" name="info" property="addressList" indexId="rowindex">
         <tr>
         <td>
         <input type="text" value="" name="address[<bean:write name="rowindex"/>].houseno" />
         </td>
         <td>
         <input type="text" value="" name="address[<bean:write name="rowindex"/>].roadname" />
         </td>
         <td>
         <input type="text" value="" name="address[<bean:write name="rowindex"/>].city" />
         </td>
         <td>
         <input type="text" value="" name="address[<bean:write name="rowindex"/>].state" />
         </td>
         <td>
         <input type="text" value="" name="address[<bean:write name="rowindex"/>].country" />
         </td>
         </tr>
         </logic:iterate>
    <tr>
         <html:submit/>
    </tr>
    </table>
    </html:form>
    here in privious action i m settting bean object in session with name 'info'. it is fetching data and disply it correctly but when i m trying to get this updated data in myUpdate action i m not getting list element.

    --------------- MyBean.java----------------------
    package form;
    import java.util.Iterator;
    import java.util.List;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.log4j.Logger;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    * @author Sushant.Raut
    public class MyBean extends ActionForm {
         Logger log = Logger.getLogger(this.getClass());
         /* (non-Javadoc)
          * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
         @Override
         public void reset(ActionMapping mapping, HttpServletRequest request) {
              // TODO Auto-generated method stub
              super.reset(mapping, request);
              this.name = "";
         public String toString()
              System.out.println("name : " + this.name );
              for(Iterator<Address> iterator = addressList.iterator(); iterator.hasNext();)
                   Address address = (Address)iterator.next();
                   System.out.println("city : " + address.getCity());
              return null;
         private static final long serialVersionUID = 1L;
         private String name;
         private List<Address> addressList;
          * @return the names
         public MyBean()
              log.info("Bean Construtor is called.");
              System.out.println("MyBean:::::constructor is called.");
         public String getName() {
              log.info("Bean getName() is called");
              return name;
          * @param names the names to set
         public void setName(String name) {
              this.name = name;
              log.info("Bean setName() is called");
          * @return the address
         public List<Address> getAddressList() {
              log.info("Bean getAddressList() is called");
              return addressList;
          * @param address the address to set
         public void setAddressList(List<Address> address) {
              log.info("Bean setAddressList() is called");
              this.addressList = address;
         public Address getAddress(int index)
              log.info("Bean getAddress(int index) is called");
              while(index >= addressList.size())
                   addressList.add(new Address());
              return this.addressList.get(index);
         public void setAddress(int index, Address address)
              log.info("Bean setAddress(int index, Address address)) is called");
              this.addressList.add(index, address);
    }------------- Address.java------------
    package form;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionMapping;
    * @author Sushant.Raut
    public class Address {
         private String houseno;
         private String roadname;
         private String city;
         private String state;
         private String country;
         public Address(){}
          * @return the houseno
         public String getHouseno() {
              return houseno;
          * @param houseno the houseno to set
         public void setHouseno(String houseno) {
              this.houseno = houseno;
          * @return the roadname
         public String getRoadname() {
              return roadname;
          * @param roadname the roadname to set
         public void setRoadname(String roadname) {
              this.roadname = roadname;
          * @return the city
         public String getCity() {
              return city;
          * @param city the city to set
         public void setCity(String city) {
              this.city = city;
          * @return the state
         public String getState() {
              return state;
          * @param state the state to set
         public void setState(String state) {
              this.state = state;
          * @return the country
         public String getCountry() {
              return country;
          * @param country the country to set
         public void setCountry(String country) {
              this.country = country;
         public void reset(ActionMapping mapping, HttpServletRequest request)
              this.city = "";
              this.country = "";
              this.houseno = "";
              this.roadname = "";
              this.state = "";
    }------ MyAction.java------
    package action;
    import java.util.ArrayList;
    import java.util.List;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.log4j.Logger;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import form.Address;
    import form.MyBean;
    * @author Sushant.Raut
    public class MyAction extends Action {
         Logger log = Logger.getLogger(this.getClass());
         public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)throws Exception{
              MyBean myBean = new MyBean();
              log.info("Bean is Initialised.");
              String name = "sushant";
              Address address = new Address();
              address.setCity("city1");
              address.setCountry("India");
              address.setHouseno("1111");
              address.setRoadname("xyz Road");
              address.setState("MH");
              Address address1 = new Address();
              address1.setCity("Hyderabad");
              address1.setCountry("India");
              address1.setHouseno("2222");
              address1.setRoadname("ABC Road");
              address1.setState("AP");
              List<Address> addressSet = new ArrayList<Address>();
              addressSet.add(address);
              addressSet.add(address1);
              myBean.setName(name);
              myBean.setAddressList(addressSet);
              request.getSession().setAttribute("info", myBean);
              log.info("Bean is bound to session.");
              System.out.println("MyBean object is bound to session.");
              System.out.println(myBean);
              return mapping.findForward("success");
    }-------- show.jsp-----------
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
         <html:form action="/myUpdate">
              <table>
                   <tr>
                        <td>
                             <label><html:text property="name" name="info"/></label>
                        </td>
                   </tr>
                   <logic:iterate id="address" name="info" property="addressList" indexId="rowindex">
                        <tr>
                             <td>
                                  <html:text property="houseno" name="address" indexed="true"/>
                             </td>
                             <td>
                                  <html:text property="roadname" name="address" indexed="true"/>
                             </td>
                             <td>
                                  <html:text property="city" name="address" indexed="true"/>
                             </td>
                             <td>
                                  <html:text property="state" name="address" indexed="true"/>
                             </td>
                             <td>
                                  <html:text property="country" name="address" indexed="true"/>
                             </td>
                        </tr>
                   </logic:iterate>
                   <tr>
                        <html:submit title="Submit"/>
                   </tr>
              </table>
         </html:form>
    </body>
    </html>

  • Problem while trying to execute Java class in JSP using  RunTime Class

    Hi,
    I want to execute a JAVA class through a JSP. For this I am using following code ....
    JSP (AAA.jsp) CODE ............
    try
    String[] cmd = new String[3];
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[2] = "java -DPeBS_CONFIG_HOME=D:/CASLIntegration/PeBS/srcvob/PeBS/config Service_Statement_Application 22/May/2001 22/May/2003";
    Runtime rt = Runtime.getRuntime();
    System.out.println("Execing " + cmd[0] + " " + cmd[1] + " " + cmd[2]);
    Process proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
    // any output?
    StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    catch (Throwable t)
    t.printStackTrace();
    StreamGobbler THread class Code ..........
    import java.util.*;
    import java.io.*;
    public class StreamGobbler extends Thread
    InputStream is;
    String type;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.type = type;
    public void run()
    try
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ( (line = br.readLine()) != null)
    System.out.println(type + ">" + line);
    } catch (IOException ioe)
    ioe.printStackTrace();
    I have successfully compiled and placed the class file for the above class in JSP's servlet engine. However, when I execute the JSP through explorer Web Browser, I get following compile time error:
    An error occurred between lines: 36 and 86 in the jsp file: /casl/LocalApp/VehicleServiceStmt/AAA.jsp
    Generated servlet error:
    D:\Tomcat\work\localhost\_\casl\LocalApp\VehicleServiceStmt\AAA$jsp.java:118: No constructor matching StreamGobbler(java.io.InputStream, java.lang.String) found in class StreamGobbler.
    StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
    ^
    An error occurred between lines: 36 and 86 in the jsp file: /casl/LocalApp/VehicleServiceStmt/AAA.jsp
    Generated servlet error:
    D:\Tomcat\work\localhost\_\casl\LocalApp\VehicleServiceStmt\AAA$jsp.java:121: No constructor matching StreamGobbler(java.io.InputStream, java.lang.String) found in class StreamGobbler.
    StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
    I am unable to determine the reason of why the constructor which exists in the StreamGobbler Class is not recevied in JSP. If I try to write the same code in JSP as a JAVA class, keeping StreamGobler class same, the programme executes successfully.
    Please help me find solution to this at the earliest. Thanks in advance,
    Prachi

    Thanks,
    I got it working by making the constructor Public.
    -Prachi

  • How to include applet in jsp if applet.class file in another folder

    hi,
    i'm getting problem when my applet.class file is not with its appropriate jsp file. i'm using jsp :plugin tag.it work when jsp file n apllet.class file at same location.
    in short my jsp file is at location /webapps/jsp-examples/myproject/includeDemo.jsp
    n applet i want in a WEB-INF folder.
    Plz help me to solve this..
    or give me other way that an applet can be loaded in jsp page n applet should be in WEB-INF file..
    Help me for this

    http://forum.java.sun.com/thread.jspa?threadID=5148764&messageID=9556205

  • Java Bean access in a JSP Tag handler class

    Hello Everybody,
    I am trying to access my java bean(ErrorBean.java) in th doEndTag() method of the tag handler class(MyTagHandler.java) and iam getting an "CLASSCAST EXCEPTION"
    I am doing it like this in the tag handler class.
    MyBeans.ErrorBean errorBean = (MyBeans.ErrorBean)pageContext.getSession().getAttribute("ErrorBean");
    Where MyBeans is the package in which my Error Bean is and iam placing the ErrorBean object in the session object before it comes to the jsp page where i have the jsp Custom tag:
    <%@ taglib uri="/WEB-INF/taglib.tld" prefix="errors" %>
    <errors:message/>
    <%@ include file="footer.jsp"%>
    I was of the opinion that i was casting it right...can anyone help me to find ...where iam doing it wrong...its really URGENT ..PLEASE

    Friend that did not work either ...
    u know what...the ErrorTagHandler class is comiling fine with out errors but in the jsp page when the custom tag is hit..this error is showing up when i see the server log.
    can you throw some light on this..
    thanks..
    Firasath

  • Jsp page - java class binding

    Is there any configuration file that binds the jsp page and the java class? I need to replace some jsp pages and their classes in different packages, but the pages cannot find their classes. Does anybody know where/how I can set the appropriate binding?
    Thanks,
    Kelly.

    It's not configurable (yet). The page name, and the "backing bean", must have the same name (including case), and the java class needs to be in the package folder with the rest of the backing beans.
    -- Tor
    http://blogs.sun.com/tor

  • Managing JSP files (.java, .class) size in working directory

              Our new web application automatically generates JSP pages which
              causes the working directory holding the JSP files to grow
              too large to manage,does Weblogic have a alternate way to
              compile JSP without permanently storing the .java, .class files
              on disk.
              Maybe in cache were they can be managed, cleaned up similar
              to how a database cache works.
              Any ideas or advice would be appreciated.
              THANKS IN ADVANCE.
              

              Just don't look in the classfiles directory and everything will
              be fine.
              WLS will only leave the .java files if you ask it to keep them (keepgenerated).
              If you don't keep the .class files on disk then WLS will have to
              recompile them every time it is restarted. If you have so many
              JSPs you are having trouble managing them, you definitely don't
              want to recompile everytime you restart WLS.
              Last time I looked in our public_html there were 67000 JSP files.
              We don't have any problems managing them.
              Mike
              "denis mercier" <[email protected]> wrote:
              >
              >Our new web application automatically generates JSP pages which
              >causes the working directory holding the JSP files to grow
              >too large to manage,does Weblogic have a alternate way to
              >compile JSP without permanently storing the .java, .class files
              >on disk.
              >Maybe in cache were they can be managed, cleaned up similar
              >to how a database cache works.
              >Any ideas or advice would be appreciated.
              >THANKS IN ADVANCE.
              

Maybe you are looking for

  • Error while creating SAPJSF user

    Hi all, I am receiving following error despite manually creating  sapjsf user in  client 800. This is the trace from dev_usercheck. Aug 31, 2010 6:05:16 AM  ...eck.main() Path: Entering method Aug 31, 2010 6:05:16 AM  ...eck.main() Debug: Version: $I

  • HT4623 my itunes is telling me i already have a ringtone in my collection but I cannot find it

    i am on my 3 iphone however i am trying to buy a ringtone an it is saying i already bught it

  • Xbmc+nvidia+vdpau issues [SOLVED]

    I've been at this for 5 hours straight now, and i'm back to square one. I've tried xbmc-svn but that one didn't even have "vdpau" listed as an option, so I tried xbmc instead. And yes vdpau is showing up as an option but no matter what I try the scre

  • Mutilple Pages Report

    hi, I have a requirement that i have to print an agreement, which is three pages. Most of the contents are typing in the report, few fields will be inserting into the reports. I have total 10 fields. 1st page i need to display 3 fields, 2nd page anot

  • Como activar iphone

    como puedo activar un iphone 5s, que compre en estados unidos para asi utilizarlo en mexico