1 2 Previous Next 16 Replies Latest reply on Aug 24, 2005 4:35 AM by Florian Gogon

    examples

    Anton Vahčič Newbie

      Hi,

      It would be great if there would be an example a hello world - but this time with jsp page.

      Second - also for multilanguage - like using utf-8 - but putting "hello world" many different languages and letters - to prove that jboss works with multilanguage. BTW example struct with japanese options does not work (hopefully you don't use code pages - but unicode!).

      Correct support for unicode is a must (and many application fall to many times on not supporting it correctly).

      Thanks,
      Anton

        • 1. Re: examples
          Florian Gogon Newbie

          Hum... it'll be really helpfull for me too to have an helloworld-jsp Portlet example...
          I'm trying to create my own portlet with servlet/jsp pages and i didn't find a lot of documentations or examples...
          so if someone have some good links or tips to share...

          Thanks in advance.

          Flo.

          • 2. Re: examples
            Thomas Heute Master

            You just need to replace what's in the doView method with:

             PortletRequestDispatcher rdisp = getPortletContext()
             .getRequestDispatcher("/helloworld.jsp");
             rdisp.include(req, resp);
            


            And it will include whatever JSP code you wrote inside helloworld.jsp (at the root of your heeloworld.war)

            • 3. Re: examples
              Florian Gogon Newbie

              Thanks for your quick answer thomas... i'll test it in a while...

              Really thx again.

              Flo.

              • 4. Re: examples
                Andrej Tibaut Newbie

                Here is another "less hardcoded" solution that reads name of the JSP file as an portlet parameter:

                Portlet's doView() method:

                String startJSPPage = getPortletConfig().getInitParameter("startPage");
                 PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(
                 startJSPPage);
                 rd.include(request, response);
                



                Portlet.xml:

                <portlet>
                 <portlet-name>TestPortlet</portlet-name>
                 <portlet-class>si.avris.centrala.jbportal.portlet.Test</portlet-class>
                 <init-param>
                 <name>startPage</name>
                 <description>Start JSP page</description>
                 <value>/WEB-INF/jsp/StartPage.jsp</value>
                 </init-param>
                 <supported-locale>en</supported-locale>
                 <!-- <resource-bundle>Resource</resource-bundle> -->
                 <supports>
                 <mime-type>text/html</mime-type>
                 <portlet-mode>VIEW</portlet-mode>
                 </supports>
                 <portlet-info>
                 <title>My JSP Test Portlet</title>
                 </portlet-info>
                 </portlet>
                


                This way path to start JSP file can be changed without modifying code.

                Andrej

                • 5. Re: examples
                  Anton Vah&#269;i&#269; Newbie

                  That code works well (actually it is pretty much general) - and i am sure it will help many people.

                  But anyway, the issue i am still having - i can put utf-8 jsp and some special characters inside just for test bus still does not work. Any idea how to make it work? For example ????? (hope they will be shown correctly here ;))

                  I have added those lines into jsp file:
                  <%@ page session="false" contentType="text/html; charset=UTF-8"
                  import="java.util.*,javax.portlet.*,helloworld.*"%>
                  and of course it was saved correctly in utf-8 format.

                  Also in java file:

                  String sa = "text/html; charset=UTF-8";
                  response.setContentType(sa);

                  (it is short cut, but anyway..).

                  But in short how to convince jboss portal to get this line into html code

                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

                  or now even better - how to make sure that any meta data can be included and then later shown into code that is generated by portal.

                  Anton

                  • 6. Re: examples
                    Florian Gogon Newbie

                    Hello(world) again men :)

                    I tried to test an helloworldPortlet with servlet/JSP but...
                    Well... that didn't work for me... I must have missed something important i think... it must be a stupid error, but i don't see it...
                    I'm a newbie in java world so i don't really understand all what i make :-/

                    So, i'll describe what i have done and i'm begging for some helps plz.
                    I'm sure that when i'll undestand how the relation between portlet and JSP works, i'll succeed in developping some portlets alone.

                    So i have an helloworld.war file constituted like that:

                    -helloworld.war
                     |--WEB-INF
                     |--all xml files at the root of the WEB-INF directory
                     |--jsp
                     | |--helloworld.jsp
                     |--classes
                     |--gontouf
                     |--helloworld
                     |--servlet
                     |--Helloworld.class
                     |--MonPortlet.class
                    


                    the code of my servlet(HelloWorld.java) is:

                    package gontouf.helloworld.servlet;
                    
                    import java.io.*;
                    
                    import javax.servlet.*;
                    import javax.servlet.http.*;
                    public class HelloWorld extends HttpServlet {
                    public void doGet(HttpServletRequest req, HttpServletResponse resp)
                    throws IOException, ServletException
                    {
                    
                    String monNom ="FGO";
                    String nom ="anotherFGO";
                    resp.setContentType("text/html");
                    
                    req.setAttribute("monNom",monNom);
                    req.setAttribute("nom",nom);
                    getServletContext().getRequestDispatcher("/helloworld.jsp").forward(req,resp);
                    
                    
                    }


                    The code of my jsp file is:

                    <%
                    String nom=(String)request.getAttribute("nom");
                    String monNom=(String)request.getAttribute("monNom");
                    if(nom==null) nom="inconnu";
                    if(monNom==null) monNom="toujoursInconnu";
                    %>
                    
                    <html>
                    <head>
                    <title>Just Hello</title>
                    </head>
                    <body>
                    
                    Hello
                    <h6><%= nom %></h6>
                    <h6><%= monNom %></h6>
                    
                    </body>
                    </html>
                    
                    


                    the code of my Portlet MonPortlet is:
                    package gontouf.helloworld.servlet;
                    
                    import java.io.IOException;
                    
                    import javax.portlet.GenericPortlet;
                    import javax.portlet.PortletException;
                    import javax.portlet.PortletRequestDispatcher;
                    import javax.portlet.RenderRequest;
                    import javax.portlet.RenderResponse;
                    
                    public class MonPortlet extends GenericPortlet {
                    
                     protected void doView(RenderRequest req, RenderResponse resp)
                     throws PortletException, IOException {
                    
                     String startJSPPage = getPortletConfig().getInitParameter("hellopage");
                     PortletRequestDispatcher rdisp = getPortletContext()
                     .getRequestDispatcher(startJSPPage);
                     rdisp.include(req, resp);
                    
                     }
                    }
                    
                    


                    the couple servlet/jsp works very well, but when i want to put the content of them in the portlet, i have an error and that don't run.


                    ERROR MESSAGE:

                    2005-07-12 11:05:11,585 ERROR [org.jboss.portal.core.servlet.CoreServlet] Error
                    java.lang.IllegalStateException: No content type defined
                    at org.jboss.portal.server.output.FragmentResult.getWriter(FragmentResult.java:93)
                    at org.jboss.portal.portlet.impl.RenderResponseImpl.getWriter(RenderResponseImpl.java:81)
                    at org.jboss.portal.portlet.impl.DispatchedHttpServletResponse.getWriter(DispatchedHttpServletResponse.java:118)
                    at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
                    at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)
                    at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)
                    at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:183)
                    at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
                    at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
                    at org.apache.jsp.WEB_002dINF.jsp.helloworld_jsp._jspService(org.apache.jsp.WEB_002dINF.jsp.helloworld_jsp:75)
                    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
                    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
                    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.jboss.portal.portlet.impl.PortletRequestDispatcherImpl.execute(PortletRequestDispatcherImpl.java:71)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at org.jboss.portal.server.servlet.CommandFilter.doFilter(CommandFilter.java:54)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
                    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
                    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
                    at org.jboss.portal.portlet.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:113)
                    at gontouf.helloworld.servlet.MonPortlet.doView(MonPortlet.java:19)
                    at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
                    at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
                    at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invokeRequest(DispatcherInterceptor.java:163)
                    at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invoke(DispatcherInterceptor.java:195)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.portlet.invocation.PreferencesInterceptor.invoke(PreferencesInterceptor.java:93)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor$InvokeNextCommand.execute(ContextDispatcherInterceptor.java:94)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at org.jboss.portal.server.servlet.CommandServlet.doGet(CommandServlet.java:49)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
                    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:539)
                    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
                    at org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:58)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.core.invocation.AccessControlInterceptor.invoke(AccessControlInterceptor.java:125)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.server.invocation.component.CacheInterceptor.invoke(CacheInterceptor.java:74)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:238)
                    at org.jboss.portal.server.Component.invoke(Component.java:173)
                    at org.jboss.portal.server.invocation.portal.MainDispatcherInterceptor.invoke(MainDispatcherInterceptor.java:93)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.core.invocation.StrategyInterceptor.invoke(StrategyInterceptor.java:184)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.core.invocation.ViewInterceptor.invoke(ViewInterceptor.java:118)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.server.invocation.portal.TargetInterceptor.invoke(TargetInterceptor.java:153)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.core.invocation.ContentTypeInterceptor.invoke(ContentTypeInterceptor.java:117)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.core.invocation.UserContextInterceptor.invoke(UserContextInterceptor.java:92)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                    at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:238)
                    at org.jboss.portal.server.PortalServer.invoke(PortalServer.java:186)
                    at org.jboss.portal.server.servlet.AbstractMainServlet.invoke(AbstractMainServlet.java:78)
                    at org.jboss.portal.server.servlet.AbstractMainServlet.doGet(AbstractMainServlet.java:71)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


                    Description of my xml files:

                    --hello-pages.xml:
                    <pages>
                    <portal-name>default</portal-name>
                    <page>
                     <page-name>hello</page-name>
                     <window>
                     <window-name>HelloPortletWindow</window-name>
                     <instance-ref>hello.HelloPortlet.HelloPortletInstance</instance-ref>
                     <default>true</default>
                     <region>left</region>
                     <height>0</height>
                     </window>
                    </page>
                    </pages>
                    


                    --jboss-app.xml:
                    <jboss-app>
                     <app-name>hello</app-name>
                    </jboss-app>


                    --jboss-portlet.xml:


                    <portlet-app>
                     <portlet>
                     <portlet-name>HelloPortlet</portlet-name>
                     <security></security>
                     </portlet>
                    </portlet-app>


                    --jboss-service.xml
                    --jboss-web.xml

                    --portlet-instances.xml:

                    <?xml version="1.0" standalone="yes"?>
                     <instances>
                     <instance>
                     <instance-name>HelloPortletInstance</instance-name>
                     <component-ref>HelloPortlet</component-ref>
                     </instance>
                     </instances>


                    --portlet.xml:

                    <?xml version="1.0" encoding="UTF-8"?>
                     <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd /opt/SUNWps/dtd/portlet.xsd" version="1.0">
                     <portlet>
                     <portlet-name>HelloPortlet</portlet-name>
                     <portlet-class>gontouf.helloworld.servlet.MonPortlet</portlet-class>
                     <init-param>
                     <name>hellopage</name>
                     <description>Start JSP page</description>
                     <value>/WEB-INF/jsp/helloworld.jsp</value>
                     </init-param>
                     <supported-locale>en</supported-locale>
                     <supports>
                     <mime-type>text/html</mime-type>
                     <portlet-mode>VIEW</portlet-mode>
                     </supports>
                     <portlet-info>
                     <title>Mon port</title>
                     </portlet-info>
                     </portlet>
                     </portlet-app>
                    



                    --web.xml:

                    <?xml version="1.0" encoding="UTF-8"?>
                    <!DOCTYPE web-app SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd">
                    <web-app>
                     <servlet>
                     <servlet-name>Hello</servlet-name>
                     <servlet-class>gontouf.helloworld.servlet.HelloWorld</servlet-class>
                     </servlet>
                     <servlet-mapping>
                     <servlet-name>Hello</servlet-name>
                     <url-pattern>/helloworld</url-pattern>
                     </servlet-mapping>
                    
                    </web-app>



                    I have another question:

                    the portlet call the jsp files, but when i test my couple servlet/jsp with the URL http://localhost:8080/Helloworld-JSP/helloworld , i recover the value of my variable "nom" and "monNom" but with the url http://localhost:8080/Helloworld-JSP/helloworld.jsp, my variable take the default value of the jsp page. That's logic, i know, but if the portlet include the jsp files, i'm afraid that it'll be the same...

                    is it possible to call the servlet files instead of the jsp one???


                    I'm a little lost so if someone can put me back on the road of Portlet City :)


                    Thanks in advance.



                    • 7. Re: examples
                      Florian Gogon Newbie

                      Sorry for the big post on top of this one, but it's working now...
                      it seems that i forgot this line in HelloWorld.java (my servlet)

                      resp.setContentType("text/html");


                      But i still want to know how to include the servlet instead of the jsp page if it's possible... I'll try at my side...

                      Thanks for help and advices.

                      Flo.

                      • 8. Re: examples
                        Anton Vah&#269;i&#269; Newbie

                        HI.

                        You can not. That's by the definition. Portlets = portal version of servlet. If you use portlets, you don't have to think about many things you have to when you use servlets. Especially if you wish to be compatible with 168.

                        Read about portal (find some resources at sun, ibm, jboss, and other companies that use 168 standard). I am sure many things will be more clear -especialyl what portlets can do and what not.

                        • 9. Re: examples
                          Woodler Expert

                          hmm, what do you mean cannot ?

                          Maybe I'm reading this thread wrong, but a portlet can request dispatch to a servlet just like it can to a jsp. use PortletContext.getRequestDispatcher(String path) or PortletContext.getNamedDispatcher(String name) to point to your servlet

                          • 10. Re: examples
                            P B Newbie

                            Hi,

                            The worked similar to the mentioned above.But I am now getting the following error.I am unable to view the jsp.What shld I do regarding this.

                            javax.portlet.PortletException
                            at org.jboss.portal.portlet.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:131)
                            at org.jboss.portlet.login.servlet.RSPortlet.doView(RSPortlet.java:19)
                            at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
                            at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
                            at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invokeRequest(DispatcherInterceptor.java:163)
                            at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invoke(DispatcherInterceptor.java:195)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.portlet.invocation.PreferencesInterceptor.invoke(PreferencesInterceptor.java:93)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor$InvokeNextCommand.execute(ContextDispatcherInterceptor.java:94)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                            at java.lang.reflect.Method.invoke(Method.java:324)
                            at org.jboss.portal.server.servlet.CommandServlet.doGet(CommandServlet.java:49)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                            at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
                            at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:539)
                            at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
                            at org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:58)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.core.invocation.AccessControlInterceptor.invoke(AccessControlInterceptor.java:125)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.server.invocation.component.CacheInterceptor.invoke(CacheInterceptor.java:74)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:238)
                            at org.jboss.portal.server.Component.invoke(Component.java:173)
                            at org.jboss.portal.server.invocation.portal.MainDispatcherInterceptor.invoke(MainDispatcherInterceptor.java:93)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.core.invocation.StrategyInterceptor.invoke(StrategyInterceptor.java:184)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.core.invocation.ViewInterceptor.invoke(ViewInterceptor.java:118)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.server.invocation.portal.TargetInterceptor.invoke(TargetInterceptor.java:153)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.core.invocation.ContentTypeInterceptor.invoke(ContentTypeInterceptor.java:117)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.core.invocation.UserContextInterceptor.invoke(UserContextInterceptor.java:92)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                            at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:238)
                            at org.jboss.portal.server.PortalServer.invoke(PortalServer.java:186)
                            at org.jboss.portal.server.servlet.AbstractMainServlet.invoke(AbstractMainServlet.java:78)
                            at org.jboss.portal.server.servlet.AbstractMainServlet.doGet(AbstractMainServlet.java:71)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                            at org.jboss.portal.core.servlet.TransactionFilter.doFilter(TransactionFilter.java:79)
                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                            at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
                            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
                            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
                            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
                            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
                            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
                            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                            at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                            at java.lang.Thread.run(Thread.java:534)

                            • 11. Re: examples
                              P B Newbie

                              Hi,

                              I followed the above steps but still I am getting the error as below.Can someone help in this regard..

                              javax.portlet.PortletException
                               at org.jboss.portal.portlet.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:131)
                               at org.jboss.portlet.login.servlet.RSPortlet.doView(RSPortlet.java:19)
                               at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
                               at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
                               at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invokeRequest(DispatcherInterceptor.java:163)
                               at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invoke(DispatcherInterceptor.java:195)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.portlet.invocation.PreferencesInterceptor.invoke(PreferencesInterceptor.java:93)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor$InvokeNextCommand.execute(ContextDispatcherInterceptor.java:94)
                               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                               at java.lang.reflect.Method.invoke(Method.java:324)
                               at org.jboss.portal.server.servlet.CommandServlet.doGet(CommandServlet.java:49)
                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                               at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
                               at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:539)
                               at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
                               at org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:58)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.core.invocation.AccessControlInterceptor.invoke(AccessControlInterceptor.java:125)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.server.invocation.component.CacheInterceptor.invoke(CacheInterceptor.java:74)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:238)
                               at org.jboss.portal.server.Component.invoke(Component.java:173)
                               at org.jboss.portal.server.invocation.portal.MainDispatcherInterceptor.invoke(MainDispatcherInterceptor.java:93)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.core.invocation.StrategyInterceptor.invoke(StrategyInterceptor.java:184)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.core.invocation.ViewInterceptor.invoke(ViewInterceptor.java:118)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.server.invocation.portal.TargetInterceptor.invoke(TargetInterceptor.java:153)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.core.invocation.ContentTypeInterceptor.invoke(ContentTypeInterceptor.java:117)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.core.invocation.UserContextInterceptor.invoke(UserContextInterceptor.java:92)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                               at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:238)
                               at org.jboss.portal.server.PortalServer.invoke(PortalServer.java:186)
                               at org.jboss.portal.server.servlet.AbstractMainServlet.invoke(AbstractMainServlet.java:78)
                               at org.jboss.portal.server.servlet.AbstractMainServlet.doGet(AbstractMainServlet.java:71)
                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                               at org.jboss.portal.core.servlet.TransactionFilter.doFilter(TransactionFilter.java:79)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                               at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
                               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
                               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
                               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
                               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
                               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                               at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                               at java.lang.Thread.run(Thread.java:534)
                              


                              • 12. Re: examples
                                Florian Gogon Newbie

                                Hi guys,

                                I'm just giving you some news of my HelloWorldPortlet:
                                I succeeded in calling the servlet file from my portlet, but the problem was that the redirection to my jsp didn't work, i didn't know why...

                                I have resolved this problem in putting into the portlet file the parameters of my servlet that i want to see through the jsp page.
                                Now, it's my portlet that is calling the jsp file and that is giving to it the parameters that i need.

                                Now i's time to try something harder than the HelloWorldPortlet.

                                I thank everyone for the assistance and advice.

                                Flo.

                                • 13. Re: error while running helloworld jsp
                                  ramesh mohan Newbie

                                  java.lang.IllegalStateException: No content type defined
                                  at org.jboss.portal.server.output.FragmentResult.getWriter(FragmentResult.java:93)
                                  at org.jboss.portal.portlet.impl.RenderResponseImpl.getWriter(RenderResponseImpl.java:81)
                                  at org.jboss.portal.portlet.impl.DispatchedHttpServletResponse.getWriter(DispatchedHttpServletResponse.java:118)
                                  at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
                                  at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)
                                  at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)
                                  at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:183)
                                  at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
                                  at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
                                  at org.apache.jsp.WEB_002dINF.jsp.helloworld_jsp._jspService(org.apache.jsp.WEB_002dINF.jsp.helloworld_jsp:85)
                                  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
                                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                                  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
                                  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
                                  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
                                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                  at org.jboss.portal.portlet.impl.PortletRequestDispatcherImpl.execute(PortletRequestDispatcherImpl.java:71)
                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                  at java.lang.reflect.Method.invoke(Method.java:324)
                                  at org.jboss.portal.server.servlet.CommandFilter.doFilter(CommandFilter.java:54)
                                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
                                  at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
                                  at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
                                  at org.jboss.portal.portlet.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:113)
                                  at examples.helloworld.servlet.MonPortlet.doView(MonPortlet.java:19)
                                  at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:154)
                                  at javax.portlet.GenericPortlet.render(GenericPortlet.java:394)
                                  at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invokeRequest(DispatcherInterceptor.java:163)
                                  at org.jboss.portal.portlet.invocation.DispatcherInterceptor.invoke(DispatcherInterceptor.java:195)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.portlet.invocation.PreferencesInterceptor.invoke(PreferencesInterceptor.java:93)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor$InvokeNextCommand.execute(ContextDispatcherInterceptor.java:94)
                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                  at java.lang.reflect.Method.invoke(Method.java:324)
                                  at org.jboss.portal.server.servlet.CommandServlet.doGet(CommandServlet.java:49)
                                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
                                  at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:539)
                                  at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
                                  at org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:58)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.core.invocation.AccessControlInterceptor.invoke(AccessControlInterceptor.java:125)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.server.invocation.component.CacheInterceptor.invoke(CacheInterceptor.java:74)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:238)
                                  at org.jboss.portal.server.Component.invoke(Component.java:173)
                                  at org.jboss.portal.server.invocation.portal.MainDispatcherInterceptor.invoke(MainDispatcherInterceptor.java:93)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.core.invocation.StrategyInterceptor.invoke(StrategyInterceptor.java:184)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.core.invocation.ViewInterceptor.invoke(ViewInterceptor.java:118)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.server.invocation.portal.TargetInterceptor.invoke(TargetInterceptor.java:153)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.core.invocation.ContentTypeInterceptor.invoke(ContentTypeInterceptor.java:117)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.core.invocation.UserContextInterceptor.invoke(UserContextInterceptor.java:92)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:213)
                                  at org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:238)
                                  at org.jboss.portal.server.PortalServer.invoke(PortalServer.java:186)
                                  at org.jboss.portal.server.servlet.AbstractMainServlet.invoke(AbstractMainServlet.java:78)
                                  at org.jboss.portal.server.servlet.AbstractMainServlet.doGet(AbstractMainServlet.java:71)
                                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                  at org.jboss.portal.core.servlet.TransactionFilter.doFilter(TransactionFilter.java:79)
                                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
                                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                  at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
                                  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
                                  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
                                  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
                                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
                                  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
                                  at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                  at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                  at java.lang.Thread.run(Thread.java:534)

                                  • 14. Re: error while running helloworld jsp
                                    Florian Gogon Newbie

                                    just try to insert this in your HelloWorld.java(your servlet??)

                                    resp.setContentType("text/html");


                                    I think it's that if you had just copied and pasted the whole code before because there was an error into it.
                                    Tell me if it's working now...

                                    Flo.

                                    1 2 Previous Next