Frank,

I tried forwarding it to a jsp page ShowCharacters.jsp

<select name="TVShowSelect">
        <%int i = 0;
        ArrayList ch = (ArrayList) 
request.getSession().getAttribute("characters");
        String[] s = new String[ch.size()];
                                ch.toArray(s);
            for (Iterator it = s.length; it.hasNext();) {
              String name = (String)it.next();
               %>
             <option><%=name%></option>
        </select>

public ActionForward execute(ActionMapping mapping, ActionForm inForm,
HttpServletRequest request, HttpServletResponse response) throws Exception {

                 String tvShow = (String)request.getParameter("tvShow");
                        if (tvShow == null) {
                                 tvShow = "";
                        }
                        ArrayList characters = getCharacters(tvShow);
                        request.getSession().setAttribute("characters", 
characters);
                        response.setContentType("text/html");
                        return mapping.findForward("success");
          } // E
But when I select some value from the first combo box(TVShowSelect),I get
the message Problem:Internal Server Error.
IN the logs,I get the following error message

Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP: 




Stacktrace:
        at
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
        at
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
        at
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
        at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
        at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
        at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
        at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
        at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
        at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
        at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
        at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
        at java.lang.Thread.run(Thread.java:619)

Can you please post the coding here?

Thanks



Frank W. Zammetti wrote:
> 
> Simply forward to a JSP and render your output there, same as any Struts
> Action.  It can be XML, JSON, HTML, some custom format, whatever.  I wish
> I had written that article showing that in the first place since this is a
> question that gets asked all the time, but I thought this was simpler (one
> less bounce to follow the ball through), but in retrospect.. :(
> 
> Frank
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM/Yahoo: fzammetti
> MSN: [EMAIL PROTECTED]
> Author of "Practical Ajax Projects With Java Technology"
>  (2006, Apress, ISBN 1-59059-695-1)
> and "JavaScript, DOM Scripting and Ajax Projects"
>  (2007, Apress, ISBN 1-59059-816-4)
> Java Web Parts - http://javawebparts.sourceforge.net
>  Supplying the wheel, so you don't have to reinvent it!
> 
> On Tue, September 11, 2007 11:46 am, aarthy wrote:
>>
>> Hi,
>>
>> In the below code,how can I avoid the HTML coding in the action
>> class?(http://www.omnytex.com/articles/xhrstruts/xhrstruts.zip)
>> I tried many different codings,but everything failed.
>>
>> public class Example3GetCharactersAction extends Action {
>>
>>
>>   public ActionForward execute(ActionMapping mapping, ActionForm inForm,
>> HttpServletRequest request, HttpServletResponse response) throws
>> Exception
>> {
>>
>>     // Get a list of characters associated with the select TV show
>>     String tvShow = (String)request.getParameter("tvShow");
>>     if (tvShow == null) {
>>       tvShow = "";
>>     }
>>     ArrayList characters = getCharacters(tvShow);
>>
>>     // And yes, I know creating HTML in an Action is generally very bad
>> form,
>>     // but I wanted to keep this exampel simple.
>>     String html = "<select name=\"CharactersSelect\">";
>>     int i = 0;
>>     for (Iterator it = characters.iterator(); it.hasNext();) {
>>       String name = (String)it.next();
>>       i++;
>>       html += "<option value=\"" + i + "\">" + name + "</option>";
>>     }
>>     html += "</select>";
>>
>>     // Write the HTML to response
>>     response.setContentType("text/html");
>>     PrintWriter out = response.getWriter();
>>     out.println(html);
>>     out.flush();
>>
>>     return null; // Not forwarding to anywhere, response is fully-cooked
>>
>>   } // End execute()
>>
>>
>>   // This method returns a list of characters for a given TV show.  If no
>> TV
>>   // show is selected, i.e., initial page view, am empty ArrayList is
>> returned.
>>    private ArrayList getCharacters (String tvShow) {
>>
>>               ArrayList al = new ArrayList();
>>
>>                       if (tvShow.equalsIgnoreCase("StarTrekTNG")) {
>>       al.add("Jean Luc Picard");
>>       al.add("William T. Riker");
>>       al.add("Data");
>>       al.add("Deanna Troi");
>>       al.add("Geordi LaForge");
>>     }
>>
>>     if (tvShow.equalsIgnoreCase("Babylon5")) {
>>       al.add("John Sheridan");
>>       al.add("Delenn");
>>       al.add("Londo Mollari");
>>       al.add("Stephen Franklin");
>>       al.add("Vir Cotto");
>>     }
>>
>>     if (tvShow.equalsIgnoreCase("StargateSG1")) {
>>       al.add("Samantha Carter");
>>       al.add("Jack O'Neil");
>>       al.add("Teal'c");
>>       al.add("Daniel Jackson");
>>       al.add("Baal");
>>     }
>>
>>                      return al;
>>
>>        } // End getCharacters()
>>
>> Thanks.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Ajax-using-XMLHttpRequest-and-Struts-tf4423481.html#a12617736
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Ajax-using-XMLHttpRequest-and-Struts-tf4423481.html#a12620775
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to