Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-07-2008, 09:10 AM
Member
 
Join Date: May 2008
Posts: 64
prabhurangan is on a distinguished road
Error using ajax call in onchange event of select box.... struts 1.x?
Hi Members,

Im getting this error,

Quote:
null: java.lang.NullPointerException at com.neto2.attest.tpm.RegressionListByAjaxAction.ex ecute(RegressionListByAjaxAction.java:88) at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:419) at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:224) at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1196) at com.neto2.attest.usm.ui.UsmServlet.process(UsmServ let.java:62) at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet .java:709) at javax.servlet.http.HttpServlet.service(HttpServlet .java:802) at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173) at org.apache.struts2.dispatcher.FilterDispatcher.doF ilter(FilterDispatcher.java:413) at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178) 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.invok e(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595)
Here is my code:

JSP page 1:

<html:form action="showCharacters.do">
TV Show:
<html:select property="TVShowSelect"
onchange="retrieveURL(' showCharacters.do?tvShow=' + this.value);">
<htmlption value="Lissie Maguire"> Lissie Maguire </htmlption>
<htmlption value="That�s so Raven"> That�s so Raven </htmlption>
<htmlption value="Dhoom machale"> Dhoom machale </htmlption>
</html:select>
<br>
Characters: <span id="characters"></span>
</html:form>


Struts-config.xml:

<action path="/showCharacters " type="ShowTVAction" validate="false" >
<forward name="success" path="/pages/showCharacters.jsp" />
</action>


Action.java:

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);
request.getSession().setAttribute("characters", characters);
response.setContentType("text/html");
return mapping.findForward("success");
} // End execute()


Success.JSP:

<html:select property="TVShowSelect">
<logicresent name="characters">
<%ArrayList ch = (ArrayList) request.getSession().getAttribute("characters");
String[] s = new String[ch.size()];
ch.toArray(s);
for(int i=0;i<s.length;i++)
{%>
<htmlption value ="<%=s[i] %>" ></htmlption>
<%} %>
</logicresent>
</html:select>


Javascript Ajax code:

function processStateChange() {
if (req.readyState == 4) { // Complete
if (req.status == 200) { // OK response
document.getElementById("characters").innerHTML = req.responseText;
} else {
alert("Problem: " + req.statusText);
}
}
}

But by doing like this im getting the error above......

Please help me out in this.....

Thanks and Regards,
Prabhu.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Jsp with Ajax sundarjothi JavaServer Pages (JSP) and JSTL 16 09-25-2008 12:29 PM
[SOLVED] Struts 2 &lt;s:select&gt; tag value ..... ? prabhurangan Web Frameworks 2 06-27-2008 10:57 AM
Example for Ajax-JSP smrithi JavaServer Pages (JSP) and JSTL 8 06-02-2008 04:00 PM
struts error sandor Web Frameworks 3 04-24-2007 09:27 PM
Struts tag error with bean:write sandor Web Frameworks 1 04-07-2007 06:50 AM


All times are GMT +3. The time now is 05:32 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org