Generic forwarding methods with recursive bounds.

Hello all,
I'm attempting to create a forwarding class assoicated with an interface. The interface has a generic method with recursive bounds. The problem relates to ambiguous method calls as the following code segment should demonstrate:
interface TestInterface
    //generic method with recursive bounds. (use of Comparable<T> is
    // not relevant, any generic class/interface could have been used.)
    <T extends Comparable<T>> T testMethod(T bob);
//Concrete implementation of the TestInterface.
class TestClass implements TestInterface
    public <T extends Comparable<T>> T testMethod(T bob)
       return bob;
    public static void main(String[] args)
        TestInterface bob = new TestClass();
        bob.testMethod("blah"); //Works fine.
class ForwardingClass implements TestInterface
    //Forwarding class composed of a TestClass object. All methods forward calls to this object.
    private final TestClass test;
    public ForwardingClass(TestClass test)
        this.test = test;
    //forwarding method.
    public <T extends Comparable<T>> T testMethod(T bob)
        return test.testMethod(bob);   //Ambiguous testMethod call. Both testMethod (T) in TestClass
                                       //and testMethod (T) in TestInterface match. Very annoying...
    }Therefore, if you could assist with the following issues, it would be greatly appreciated.
Firstly, I don't think I fully understand why this error is given, so any explanation would be greatly appreciated.
Secondly, is there any way to get around the problem?
Thanks in advance,
Matt.

My bad. This appears to be an issue with Intellij 8.0M1. I'll create post on the Intellij forums. It compiles absolutely fine from the command line, and using Intellij 7.04. (Probably should have checked that before my initial post...)
Apologies for wasting your time. Cheers for the replies.
Matt.

Similar Messages

  • A question about a method with generic bounded type parameter

    Hello everybody,
    Sorry, if I ask a question which seems basic, but
    I'm new to generic types. My problem is about a method
    with a bounded type parameter. Consider the following
    situation:
    abstract class A{     }
    class B extends A{     }
    abstract class C
         public abstract <T extends A>  T  someMethod();
    public class Test extends C
         public <T extends A>  T  someMethod()
              return new B();
    }What I want to do inside the method someMethod in the class Test, is to
    return an instance of the class B.
    Normally, I'm supposed to be able to do that, because an instance of
    B is also an instance of A (because B extends A).
    However I cannot compile this program, and here is the error message:
    Test.java:16: incompatible types
    found   : B
    required: T
                    return new B();
                           ^
    1 errorany idea?
    many thanks,

    Hello again,
    First of all, thank you very much for all the answers. After I posted the comment, I worked on the program
    and I understood that in fact, as spoon_ says the only returned value can be null.
    I'm agree that I asked you a very strange (and a bit stupid) question. Actually, during recent months,
    I have been working with cryptography API Core in Java. I understood that there are classes and
    interfaces for defining keys and key factories specification, such as KeySpec (interface) and
    KeyFactorySpi (abstract class). I wanted to have some experience with these classes in order to
    understand them better. So I created a class implementing the interface KeySpec, following by a
    corresponding Key subclass (with some XOR algorithm that I defined myself) and everything was
    compiled (JDK 1.6) and worked perfectly. Except that, when I wanted to implement a factory spi
    for my classes, I saw for the first time this strange method header:
    protected abstract <T extends KeySpec> T engineGetKeySpec
    (Key key, Class<T> keySpec) throws InvalidKeySpecExceptionThat's why yesterday, I gave you a similar example with the classes A, B, ...
    in order to not to open a complicated security discussion but just to explain the ambiguous
    part for me, that is, the use of T generic parameter.
    The abstract class KeyFactorySpi was defined by Sun Microsystem, in order to give to security
    providers, the possibility to implement cryptography services and algorithms according to a given
    RFC (or whatever technical document). The methods in this class are invoked inside the
    KeyFactory class (If you have installed the JDK sources provided by Sun, You can
    verify this, by looking the source code of the KeyFactory class.) So here the T parameter is a
    key specification, that is, a class that implements the interface KeySpec and this class is often
    defined by the provider and not Sun.
    stefan.schulz wrote:
    >
    If you define the method to return some bound T that extends A, you cannot
    return a B, because T would be declared externally at invocation time.
    The definition of T as is does not make sense at all.>
    He is absolutely right about that, but the problem is, as I said, here we are
    talking about the implementation and not the invocation. The implementation is done
    by the provider whereas the invocation is done by Sun in the class KeyFactory.
    So there are completely separated.
    Therefore I wonder, how a provider can finally impelment this method??
    Besides, dannyyates wrote
    >
    Find whoever wrote the signature and shoot them. Then rewrite their code.
    Actually, before you shoot them, ask them what they were trying to achieve that
    is different from my first suggestion!
    >
    As I said, I didn't choose this method header and I'm completely agree
    with your suggestion, the following method header will do the job very well
    protected abstract KeySpec engineGetKeySpec (Key key, KeySpec key_spec)
    throws InvalidKeySpecException and personally I don't see any interest in using a generic bounded parameter T
    in this method header definition.
    Once agin, thanks a lot for the answers.

  • Problem with forward method of jsp

    am having problem with the requestDispatcher.forward method in my jsp + wml , the forward method gets executed but the new page is not displayed in the wap browser,
    code snippet
    small.jsp
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
    <%@ page language="java" %>
    <%@ page contentType="text/vnd.wap.wml; charset=UTF-8" %>
    <%@ page import="java.lang.*,java.io.*,java.util.*,java.util.Vector,java.util.Properties "%>
    <%
    System.out.println("in small");
    RequestDispatcher rd = request.getRequestDispatcher("small1.jsp");
    rd.forward(request,response);
    %>
    small1.jsp
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
    <%@ page language="java" autoFlush="false"%>
    <%@ page contentType="text/vnd.wap.wml; charset=UTF-8" %>
    <%@ page import="java.net.*,java.lang.*,java.io.*,java.util.*,java.util.Vector,java.util .Properties"%>
    <%
    String sm = "small1";
    System.out.println("in small1");
    %>
    <wml>
    <card id="two">
    <p>
    <small><%=sm%></small>
    </p>
    </card>
    </wml>
    i get the following output in the log
    in small
    in small1
    but i dont get to see the small1.jsp' content , also the response.sendRedirect method works fine ,,
    pls give me the soln
    Thnk u in advance

    thank u very for the repl this is the message which i get in the nokia wap browser...
    cannot load small1.jsp(HTTP Error 500 Server Error)
    and i use IBM WebSphere as the web server....
    and i have found that using response.reset in the small2.jsp overcomes this problem but the card title and the anchor tag is not displayed !!!!
    what could be this problem?

  • Trouble with forward() method in a Servlet

    I am new to Servlets and am having trouble with one that queries a database and forwards the data to a JSP. A portion of the code is below (The <i> are really , but are being displayed wrong).
                   for(int i = 0; i < numberOfRows; i++)
                        data2[0] = rs.getString("REIMBUR_DATE");
                        data2[i][1] = occupancyPCT;
                        data2[i][2] = rs.getString("RMBR_RATE_REVENUE");
                        data2[i][3] = rs.getString("RMBR_ROOM_TAX");
                        data2[i][4] = "reimbur total";
                        data2[i][5] = rs.getString("BOOK_RATE_REVENUE");
                        data2[i][6] = rs.getString("BOOK_ROOM_TAX");
                        data2[i][7] = "rebate";
                        data2[i][8] = "tax rebate";
                        rs.next();
                   request.setAttribute("CERT_INFO", data);
                   request.setAttribute("OTHER_INFO", data2);
                   request.setAttribute("NUMBER_ROWS", new Integer(numberOfRows));
                   ServletContext context = getServletContext();
                   RequestDispatcher dispatcher = context.getRequestDispatcher("/certdetails.jsp");
                   dispatcher.forward(request, response);
              catch(Exception ee)
                   PrintWriter out = null;
                   response.setContentType("text/html");
                   out = response.getWriter();
                   out.println("<html>");
                   out.println("<body>");
                   out.println("Exception !!<br>");
                   out.println(ee.getMessage());
                   out.println("</body>");
                   out.println("</html>");
    When I include the line with the forward() method, I get an exception and the message is "1998-08-20", the contents of data2[numberOfRows - 1][0]. I don't know why an exception is being generated or how it is getting this database value as its message. What's going on?

    Nevermind, I found the problem. There was an error in my JSP. I don't know how it affected the Servlet as it did, but...who cares!!

  • How to add item to a List with a bounded wildcard

    Hi,
    Is there a way to add a subtype instance to a List with a bounded wildcard? For example, say I have an
    abstract class called Car. Then I have 2 concrete subclasses--Ford and Toyota. Now say I have another
    class that contains a prepopulated list and is wildcard bounded like this: List<? extends Car> carList. I
    want to add a method where I pass in a Car subtype as a parameter and then add it into this list, e.g:
    public void addCar(Car car) {
    carList.add(car);
    Trying this, I keep getting "cannot find symbol" compilation errors. When I went back to read the Generics
    tutorial by Bracha, he mentions that explicitly adding a subtype, e.g. carList.add(new Ford()), can not be
    done. But here I'm adding the "upper bound" of the wildcard, i.e. the Car type. Therefore there should be no
    discrepancy between supertype and subtype an thus the carList.add(car) should be ok, IMO.
    Am I misunderstanding something with this logic? Also, if carList.add(car) can not be done, then how can
    I go about doing something similar which will allow me to add subtypes to a "generic" list?
    Thanks in advanced!
    -los

    I get a compilation error expecting an Object instead of a Car. Of course you did. List<? super Car> is a list into which you can put cars -- and possibly other stuff. List<? extends Car> is a list out of which you can get cars (possibly of different makes).
    Do you need a list that you can put cars in and get cars out? That's List<Car>
    This isn't a linguistic problem you are having; this is a design problem. If you have a function that takes an argument which is a list that you can put any kind of car into and be sure of getting a car out of, it isn't reasonable to pass in a List<Ford> (because the function might put in a Chevy) or a List<Object> (but there might be motorcycles already in there). By the requirements you have, you need a List<Car> and nothing else.
    Yes, you could use a cast, but all you are doing is circumventing the type system by saying "I know this List<Object> only has Cars in it."

  • L2 and L3 Forwarding Method in the Same WAE

          Hi Everyone,
          Is possible to use simultaneously L2 and L3 Forwarding Method (WCCPv2) in the same WAE.
          I wanna to design a cluster with 2 WAE using the same service group in a DC and I wanna support both the L2 and L3
          Forwarding Method at the same time..
          If yes, is there any link when I can get a documentation showing some example configuration
         Thanks in Advanced,
         My Best Regards,
             Andre Lomonaco

    Hi Andrej,
             If I understand this correctly, then your best option is to use G-GRE (Generic GRE) as egress method, and use GRE redirection and MASK assignment. See an Example below.
    wccp router-list 1 172.16.10.1
    wccp tcp-promiscuous service-pair 61 62 router-list-num 1 mask-assign
    wccp version 2
    egress-method generic-gre intercept-method wccp
    For more details, please follow below CCO URL.
    http://www.cisco.com/en/US/docs/app_ntwk_services/waas/waas/v441/configuration/guide/traffic.html#wp1041742
    Ahsan

  • Building a method with more than one result data

    Hi, everyone:
    I'm a little shy to ask this question, however, it's been hanging in my mind for so long, so I think I'd rather make a confession on it. You may laugh at me if you want, I'm ready for that, but I more look forward to that someone can really give me the light, or even the link, or some hint....
    For your ease of reading, I give the question first, and my whole story behind:
    When I need a method which can provide more than one result( in other words, multiple outputs), how can I do it in Java? As I know, either you pass and object, or the result of the function is an object will do , for the object contains the datas you want, but that means your needs for those data have to be defined in object format in advance, won't that be inconvinient? Or Java has a better solution for that?
    //And here's the whole story....
    I began my career as a programmer by starting with LabVIEW, it's a graphical programming language made by National Instrument, and it's powerful on DAQ, and industrial field. One of the most important issues on design is to devide your system into multiple functions( in its own term: subVI), I think it's just like applying structured analysis method.
    When we dealing with functions in LabVIEW, a programmer can define his own function with mulitiple inputs and outputs, for example, I can design a function called SumAndDevide, which accepts two input ( two variables to be summed and devided) and gives two results( result of summing and that of deviding).
    The methodology has its power, at least it provide the functional decomposition, and you can compose a suitable solution in certain circumstance even they are not the smallest unit function. And testing is easy. It affects me so large that I look the trail of it when I come to other programming languages. In COBOL( well, that is a VERY old COBOL version ), I was scared to find there is no protection to the inner data on the performed sections, while making a outside subroutine to be called is cubersome and really a hard work. When I came to Delphi, I knew that using the result of a function cannot satisfy me, for it give only one output, even you can define it as variant, but I think it's vague to realize. So I use the difference of called by value and called by reference to handle the problem, that is: a value parameter for the input, and a variable paramter for the output.
    Well, when I came to Java, I am stunned again, now there is no passing by reference mechanism in Java, otherwise you have to pass it as an object, but that means when you need multiple outputs, the output has to be defined in object form in advance. And that will be very inconvinient!! I tried to find some solutions, but I can't. So is there any way that in Java you can define a method with multiple output? or Java handles the problem in totally different way?
    Any comments will be appreciated!!
    Thanks!!
    aQunx from Taiwan

    You missed the most common OO solution - separation of concerns and implementation hiding.
    If you have a function which returns a string, that is one method of the object that provides the service.
    If you have a function which returns a real, that is a different method of the object.
    If both functions require common code, move that into a private method which is called by both. If the method is costly, cache the result.
    eg an aerodynamics properties class, which could be done as a multivalued return of (lift, drag), refactored to independent lift() and drag() methods, which delegate to an interpolate() method, which caches the interpolated value and uses mach, pressureHeight and _alpha to determine whether it should recalculate:  /**
       * Calculates the aerodynamic drag force at a given mach, alpha and pressure height.
      public double drag (final double aMach, final double aPressureHeight, final double aAlpha) {
        interpolate(aMach, aPressureHeight, aAlpha);
        return _drag;
       * Calculates the aerodynamic lift force at a given mach, alpha and pressure height.
      public double lift (final double aMach, final double aPressureHeight, final double aAlpha) {
        interpolate(aMach, aPressureHeight, aAlpha);
        return _lift;
      private void interpolate (final double aMach, final double aPressureHeight, final double aAlpha) {
        if (aMach != _mach) {
          setMach(aMach);
          _pressureHeight = Double.NaN;
        if (aPressureHeight != _pressureHeight) {
          setPressureHeight(aPressureHeight);
          _alpha = Double.NaN;
        if (aAlpha != _alpha) {
          setAlpha(aAlpha);
    ... actual interpolation happens in the private setXXX methods.

  • How to use RequestDispatcher.forward method  in a portlet

    I have a servlet (HelloServlet2) that acts as the controller. This is a very simplified example. This servlet calls the dispatcher.foward(req, res) method to foward to a JSP page for displaying. At this point I get a FileNotFoundException. The HelloServlet2 is in the standard location WEB-INF/classes/com/a2i/industrial/servlet/HelloServlet2.java.
    How come it's looking in Industrial/servlet/HelloServlet2 instead of Industrial/WEB-INF/classes/..? If I access the servlet by http://host:port/Industrial/HelloServlet2, it works fine. I have another portlet (servlet) that doesn't call the forward method and it works fine too. Thanks for your help.
    Here is the web.xml:
    <servlet>
    <servlet-name>HelloServlet2</servlet-name>
    <display-name>HelloServlet2</display-name>
    <servlet-class>com.a2i.industrial.servlet.HelloServlet2</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet2</servlet-name>
    <url-pattern>/HelloServlet2/*</url-pattern>
    </servlet-mapping>
    Here is the calling code from HelloServlet2:
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    RequestDispatcher dispatcher= getServletContext().getRequestDispatcher("/hello.jsp");
    dispatcher.forward(req, res);
    Here is the portlet definition:
    <portlet class="oracle.portal.provider.v2.DefaultPortletDefinition">
    <id>2</id>
    <name>HelloServlet2</name>
    <title>Hello Servlet2</title>
    <shortTitle>Hello Servlet2</shortTitle>
    <description>This is the "hello world" sample implemented using Java Servlets and the extensible renderer architecture.</description>
    <timeout>10000</timeout>
    <timeoutMessage>Hello Servlet timed out</timeoutMessage>
    <acceptContentType>text/html</acceptContentType>
    <renderer class="oracle.portal.provider.v2.render.RenderManager">
    <contentType>text/html</contentType>
    <autoRedirect>true</autoRedirect>
    <showPage>/servlet/HelloServlet2</showPage>
    </renderer>
    </portlet>
    Here is the stack trace:
    7/15/03 10:43 AM industrial: JspServlet: unable to dispatch to requested page: java.io.FileNotFoundException: C:\ora9iasp\j2ee\OC4J_Portal\applications\_industrial\industrial\servlet\HelloServlet2 (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:64)
         at oracle.jsp.provider.JspFilesystemResource.fromStream(JspFilesystemResource.java:153)
         at oracle.jsp.provider.JspFilesystemResource.fromReader(JspFilesystemResource.java:169)
         at oracle.jsp.runtimev2.JspPageCompiler.fromReader(JspPageCompiler.java:345)
         at oracle.jsp.runtimev2.JspPageCompiler.attemptCompilePage(JspPageCompiler.java:250)
         at oracle.jsp.runtimev2.JspPageCompiler.compilePage(JspPageCompiler.java:171)
         at oracle.jsp.runtimev2.JspPageInfo.compileAndLoad(JspPageInfo.java:338)
         at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:481)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:255)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:407)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:330)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:59)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:523)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:219)
         at com.a2i.industrial.servlet.HelloServlet2.doGet(HelloServlet2.java:21)
         at com.a2i.industrial.servlet.HelloServlet2.doPost(HelloServlet2.java:14)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:283)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:59)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:523)
         at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:108)
         at oracle.portal.provider.v2.render.http.ResourceRenderer.renderBody(Unknown Source)
         at oracle.portal.provider.v2.render.RenderManager.render(Unknown Source)
         at oracle.portal.provider.v2.DefaultPortletInstance.render(Unknown Source)
         at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.showPortlet(Unknown Source)
         at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.handleHttp(Unknown Source)
         at java.lang.reflect.Method.invoke(Native Method)
         at oracle.webdb.provider.v2.adapter.SOAPServlet.doHTTPCall(Unknown Source)
         at oracle.webdb.provider.v2.adapter.SOAPServlet.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:59)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:523)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:735)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:151)
         at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)
    7/15/03 10:43 AM industrial: ERROR: ResourceRenderer.renderBody - Resource "/servlet/HelloServlet2" returned HTTP Status: 404. Error message: OracleJSP:
    java.io.FileNotFoundException: C:\ora9iasp\j2ee\OC4J_Portal\applications\_industrial\industrial\servlet\HelloServlet2 (The system cannot find the path specified). Content returned follows....

    Thanks for you help David. I changed my code from getServletContext().getRequestDispatcher(jspPage).forward(req, res) to getServletContext().getNamedDispatcher(jspPage).forward(req, res). It worked but I run into the same problem with jsp:include.
    I am using the July 2003 of the PDK. I followed the direction for installing version 2 but I did not redeploy with the new jpdk.ear since one was already deployed. After redeploying with the new jpdk.ear, it fixed the jsp:include problem I was having. The problem with using getServletContext().getRequestDispatcher(jspPage).forward(req, res) STILL exist. I am not sure what the deal is.
    Oh, I also tried the code below and it doesn't work.
    path = req.getContextPath() + jspPage
    getServletContext().getRequestDispatcher(path).forward(req, res)
    In any case, using getNamedDispatcher() is working fine. I am still curious about getRequestDispatcher() though.

  • Generic static methods in a parameterized class

    Is there anything wrong with using generic static methods inside of a parameterized class? If not, is there anything special about defining them or calling them? I have a parameterized class for which I'd like to provide a factory method, but I'm running into a problem demonstrated below:
    class MyClass<T> {
         private T thing;
         public
         MyClass(T thing) {
              this.thing = thing;
         public static <U> MyClass<U>
         factoryMakeMyClass(U thing)     {
              return new MyClass<U>(thing);
    class External {
         public static <U> MyClass<U>
         factoryMakeMyClass(U thing)     {
              return new MyClass<U>(thing);
    class Test {
         public static void
         test()
              // No problem with this line:
              MyClass<String> foo = External.factoryMakeMyClass("hi");
              // This line gives me an error:
              // Type mismatch: cannot convert from MyClass<Object> to MyClass<String>
              MyClass<String> bar = MyClass.factoryMakeMyClass("hi");
    }Does this code look ok to you? Is it just a problem with my ide (Eclipse 3.1M2)? Any ideas to make it work better?

    I've been working on essentially the same problem, also with eclipse 3.1M2. A small variation on using the external class is to use a parameterized static inner class. I'm new enough to generics to not make definitive statements but it seems to me that the compiler is not making the correct type inference.
    I think the correct (or at least a more explicit) way of invoking your method would be:
    MyClass<String> bar = MyClass.<String>factoryMakeMyClass("hi");
    See http://www.langer.camelot.de/GenericsFAQ/FAQSections/TechnicalDetails.html#FAQ401
    See http://www.langer.camelot.de/GenericsFAQ/FAQSections/TechnicalDetails.html#FAQ402
    Unfortunately, this does not solve the problem in my code. The compiler reports the following error: The method myMethod of raw type MyClass is no more generic; it cannot be parameterized with arguments <T>.
    Note that in my code MyClass is most definitely parameterized so the error message is puzzling.
    I would like to hear from more people on whether the sample code should definitely work so I would appreciate further comments on whether this an eclipse problem or my (our) misunderstanding of generics.     

  • Using methods with links

    Hi all !
    Can i call a jsp-method by clicking on a html-link ??
    The method:
    <%!
        int month=2;
        public void forward() {
            month++;
    %>And now i want to call the method with a link.
    Something like this:
    <a href="..." onclick="forward()">Click</a>Is there a possibility to use methodes out of the html-code.

    I don't think u can call a method, but u can call the jsp page by using the "action"
    so u can soemthing like this
    document.formname.action = '*.jsp';
    Hi all !
    Can i call a jsp-method by clicking on a html-link ??
    The method:
    <%!
    int month=2;
    public void forward() {
    month++;
    %>And now i want to call the method with a link.
    Something like this:
    <a href="..." onclick="forward()">Click</a>Is there a possibility to use methodes out of the
    html-code.

  • PowerShell-EWS How to use .Forward Method of EmailMessage Class

    Hello, 
    im new to PowerShell and EWS and would like to know how to forward an E-Mail with the .Forward Method of the EmailMessage Class.
    Is it possible to also forward an Email with an FileAttachment?
    I already have access to the Messages i want to forward but i cant figure out how to .Forward these Messages.
    Thank you for your help
    Greetings 
    Ingo

    >> Is it possible to also forward an Email with an FileAttachment?
    Yes doing a normal forward is EWS should maintain the attachment on the message eg the following would forward the last email in the Mailbox
    $folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$MailboxName)
    $Inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid)
    $ivItemView = New-Object Microsoft.Exchange.WebServices.Data.ItemView(1)
    $fiItems = $null
    $fiItems = $service.FindItems($Inbox.Id,$ivItemView)
    $messageBodyPrefix = "This is message that was forwarded by using the EWS Managed API";
    $addresses = New-Object Microsoft.Exchange.WebServices.Data.EmailAddress[] 1
    $addresses[0] = "[email protected]";
    $fiItems.Items[0].Forward($messageBodyPrefix, $addresses);
    If your looking to forward the actual message as an attachment you can use something like
    http://gsexdev.blogspot.com.au/2013/07/forwarding-message-as-attachment-using.html
    Cheers
    Glen

  • Forward plans with unmaintainable code.

    Has anyone inherited a Java project that did not meet any or extremely few maintainability standards... If so, how did you move forward?
    (1) Brought the project up to maintainable standards
    (2) Rewrote the project
    (3) Attempted to maintain the project as is.

    Once I got a project to clean up some horrible code before handing it off to another team who was going to replace whole sections of it.
    I told my boss that it was pointless, because the horrible part was exactly what was being replaced. So (with his approval) I did nothing other than sending the code to the other team with some notes pointing out what's horrible about it and how they shouldn't do things the same way. They (presumably) ripped out the garbage and did the right thing.
    Generally speaking, however, I find that there's never time to completely fix anything, and managers are resistant to refactoring anything, no matter how much they jump up and down yelling "agile". I think they confuse Agile methods with the jumping up and down part. So you end up refactoring things on a piecemeal basis. I also suggest that when you have to add new stuff to the project, try to avoid doing the quickest fix, because that just makes things worse. The "do the simplest thing that can possibly work" philosophy is only a good idea if you also adopt the aggressive refactoring philosophy as well, and sadly the latter is generally sacrificed.
    So despite all the exhortations from managers to be agile, what actually happens is that refactoring, incremental design, test-driven design, etc., are never practiced under those managers, but instead are practiced by the developers in their own time in non-work projects. The developers are criticized for not being agile enough, but they're actually discouraged from being as agile as they'd like. There's something really dysfunctional about all this.
    Well, I could complain all day.
    Edited by: paulcw on May 10, 2008 7:52 PM

  • When forwarding mail with 2 attachments it only attaches one of them.

    Trying to forward email with more than one attachment but it only attaches one of them. Please help

    That's the problem with getting yourself popular on the internet - its not so easy to disappear!
    I would have thought it would be better to publish the new files with the same folder name as the old one....
    TrethowansDairyShop
    ... and keep the same page name for your landing page....
    TRETHOWANS_DAIRY.html
    That way the new files would simply overwrite the old on your iDisk and you won't have to start from square one with SEO. Also your original site name and home page name are a lot better for SEO than the generic "Site" and "Home". If you want to be found by search engines, avoid these page names such as "About", "Contact" etc, like the plague.

  • Generics at method level

    As we all know, in Java5.0, Sun introduced Generics. Now I used this at class level and at field method. However I tried using them at method level, but could not succeced.
    I did a search on the internet and I found a very good article about generics. The url is the following: http://www-128.ibm.com/developerworks/java/library/j-djc02113.html
    Scrolling to the bottom, I found out what I needed. the example on that website shows the following:class Utilities {
       <T extends Object> public static List<T> make(T first) {
         return new List<T>(first);
    }However I tried to do this code in a method inside my project, but did not work at all.
    Does any one know how I can do generics at method level. What I want to achieve is that you pass the class type you want to be returned as a generic at the method level.
    regards,
    sim085

    Please before you check my code, check the example that there is in the article, that is the code I posted in my first post. I based all this on the information I read from the website, and since the source looks very reliable,, there is no need for me to doubt that it works!
    I did a simple example, I am just using generics to get used to them ... Here comes the exampleimport java.util.*;
    public class Test{
         private List<String> myList;
         public Test(){
              myList = new ArrayList<String>();
              <List>normalMethod();
         <T>public T normalMethod(){
              return null;
         <T>public static void staticMethod(){
         public static void main(String... args){
              <List>staticMethod();
              new Test();
    }The exception throws is an exception you would see when the syntax is incorrect. However I do have Java5.0 and if you delete the methods and the method calls, but you leave the generics at the field level , the code would compile.
    The exception throws are the following:C:\Documents and Settings\saquilina\My Documents\Test.java:21: illegal start of type
         <T>public static void staticMethod(){
               ^
    C:\Documents and Settings\saquilina\My Documents\Test.java:32: <identifier> expected
    }Now since in the example in that website they use a static method, I tried it also with a static method, but it did not work all the same :(
    regards,
    sim085

  • Traversing a directory with recursion.

    This section of my code implements a static method that recursively traverses a directory and displays the results.
    package directories;
    import java.io.File;
    import java.util.Date;
    public class DirectoryList {
        public static void showDirectory(String filename) {
            File myFile = new File(filename);
            if(myFile.exists()) {
                System.out.println(myFile.getPath() + " [" + (myFile.isDirectory() ? "
    D" : "") + (myFile.canRead() ? " R" : "")
                        + (myFile.canWrite() ? " W" : "") + " ]  " + myFile.length() + " bytes  last modified: " + (new Date(myFile.lastModified())));
                if(myFile.isDirectory()) {
                    String[] list = myFile.list();
                    if (list != null)
                        for(int c = 0; c < list.length; c++)
                            showDirectory(myFile.getPath() + myFile.separator + list[c]);
            else
                System.out.println("The file does not exist.");
    The output I currently have looks like:
    /Applications [ D R W ]  2822 bytes  last modified: Sun Oct 21 20:17:14 CDT 2007
    /Applications/.DS_Store [ R W ]  21508 bytes  last modified: Sun Oct 21 20:17:31 CDT 2007
    /Applications/.localized [ R W ]  0 bytes  last modified: Sun Mar 20 17:57:33 CST 2005
    /Applications/Acquisition.app [ D R W ]  102 bytes  last modified: Mon Nov 20 05:44:31 CST 2006
    /Applications/Acquisition.app/Contents [ D R W ]  204 bytes  last modified: Mon Nov 20 05:45:17 CST 2006
    /Applications/Acquisition.app/Contents/Info.plist [ R W ]  2423 bytes  last modified: Mon Nov 20 05:40:34 CST 2006
    The output I want would look like:
    /Applications [ D R W ]  2822 bytes  last modified: Sun Oct 21 20:17:14 CDT 2007
    /Applications
         /.DS_Store [ R W ]  21508 bytes  last modified: Sun Oct 21 20:17:31 CDT 2007
    /Applications
         /.localized [ R W ]  0 bytes  last modified: Sun Mar 20 17:57:33 CST 2005
    /Applications
         /Acquisition.app [ D R W ]  102 bytes  last modified: Mon Nov 20 05:44:31 CST 2006
    /Applications
         /Acquisition.app
              /Contents [ D R W ]  204 bytes  last modified: Mon Nov 20 05:45:17 CST 2006
    /Applications
         /Acquisition.app
              /Contents
                   /Info.plist [ R W ]  2423 bytes  last modified: Mon Nov 20 05:40:34 CST 2006
    */

    Binthari wrote:
    Yes , I do understand... I'm trying to understand your code and do. I am doing sumthing similar to his. It's all in my main program. I wanted to print the whole directory. But i can print only a single file detail. I wish you can help me on how to display all the files and their details. That is my problem. I don't like to copy and then not understand at all. I agree with you.In reply #3 I showed you how to print the absolute path of a file. In the original post, the OP should you how to print the length etc. of a file. You only need to combine the code. As I already said: if you really don't know how to do that: you are obviously not ready for it and need to master some more basic stuff. This is not an insult: everybody who is (at some extend) good in programming starts with the basics of the language.
    Getting Started
    http://java.sun.com/docs/books/tutorial/getStarted/index.html
    Learning the Java Language
    http://java.sun.com/docs/books/tutorial/java/index.html

Maybe you are looking for

  • Unable to delete rows from Target.

    Hello everyone, I am unable to delete rows from target data store. Here is what I have done. Source Oracle 10g - staging 11g - Target Oracle 11g I have implemented consistent set CDC on data model in staging and added 2 tables to CDC and turned on th

  • Execute more than one thing at the same time.

    Hey why every time i want to execute more than one thing(create tables) at the same time it say "ORA-00911: invalid character" , i dont wanna execute one thing at a time. check the pic please http://img370.imageshack.us/img370/5120/oraclesw5.jpg but

  • Essbase 11.1.2 Connectivity issue

    I successfully completed the installation of EPM 11.1.2 in a distributed environment: Server A: Foundation Services, Reporting and Analysis, Workspace. Server B: Essbase Server and Essbase Studio Server I added the external MSAD authentication direct

  • SPNego - Login Screen Appears for IE Browser in Some machines.

    Hi, We've done the SPNEGO Implementation for Portal SSO. All the settings related to KDC in AD server, Portal WAS and IE browser client settings have been done. In most of the machines with WINDOWS XP SP2, portal login screen is not getting appeared

  • Help a Beginner? cannot find symbol error?

    class Box {      double width;      double height;      double depth; Box(Box ob) {           width = ob.width;           height = ob.height;           depth = ob.depth; Box(double w, double h, double d) {      width = w;      height = h;      depth