Using ajax with struts 1.2.9

Hello Experts ,
First of all I am sorry if I have posted question in a wrong forum but I have tried posting my problem in struts forum also but didn't get reply & I am pretty new to struts.
I am trying to use ajax in struts 1.2.9.I have used 1 dependent combo.When I am changing value in 1 combo it will call an action class which will fetch data for 2nd combo .My problem is ,action class "success" has to be forwarded to some particular jsp.But I want to refresh only a part of page not the whole page.How to refresh just a part of page?? Any idea or any link which can help me.Any help in this will be highly appreciated.Many many Thanx in advance.

Hello Shasi,
Lets take the sample code for one combo box (College) , one change of which I want to display the information of that college in the textboxes below it.So on change of college combo I am calling the action class which is retrieving info of college.My problem is now how to send this data to jsp & what should be the success & failure forward for my action class.
In my JSP I have written something like this....
                       createXMLHttpRequest();
                        queryString2 ="retrieve_college_info.do?";
                        queryString2 = queryString2 + "selcollege="+document.forms[0].college_name.options[document.forms[0].college_name.selectedIndex].value;
                        xmlHttp.open("GET", queryString2, true);
                        xmlHttp.onreadystatechange = handleCollegeRetrieve;
                        xmlHttp.send(null);My action class code goes like this
package ibm.tgmc_nextyear.actionclass;
import ibm.tgmc_nextyear.businesslogic.*;
import ibm.tgmc_nextyear.formbean.*;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import java.sql.*;
import java.util.ArrayList;
import org.apache.struts.util.LabelValueBean;
public class CollegeRetrieveInfoAjaxAction extends org.apache.struts.action.Action {
    public ActionForward execute(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
               String optionSelected = request.getParameter("selcollege");    
               String responseText="";
               Connection conn = null;
               Statement stmt = null;
               ResultSet rs = null;
               TeamDetailsForm team_frm = null;
               try {
                    conn = getDataSource(request).getConnection();
                    stmt = conn.createStatement();
            rs = stmt.executeQuery("select name , address  , city , pincode , ph_no , hod_name , principal_name , alt_no , website from user.college_table where college_id=" + optionSelected);
*//what after this ???*
        } finally {
            if (rs != null) {
                rs.close();
            if (stmt != null) {
                stmt.close();
            if (conn != null) {
                conn.close();
         *//what should be the value os success forward*
       return(mapping.findForward("success"));
}

Similar Messages

  • Uploading a file to server using ajax and struts

    My problem is i wrote a program to upload a file to the server using Ajax.
    Here iam used Struts and Ajax.
    The problem is when iam uploaded a file from my PC the file is uploading to the server in the upload folder located in the server my system.
    Iam using Tomcat server 5.0
    But when iam trying to access it through other system it is not doing so
    Giving an internal server error i,e 500.
    Iam putting the necessary documents for ur reference.
    Plz help me soon .
    My exact requirement is i have to upload a file to the upload folder located in the server.
    And i have to get the path of that file and display the file path exactly below the browse button from where iam uploaded a file.
    That should be done without page refresh and submit thats y iam used Ajax
    Any help would greatly appreciated
    Thanks and Regards
    Meerasaaheb.
    The action class is FilePathAction
    package actions;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.*;
    public class FilePathAction extends Action{
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    String contextPath1 = "";
    String uploadDirName="";
    String filepath="";
    System.out.println(contextPath1 );
    String inputfile = request.getParameter("filepath");
    uploadDirName = getServlet().getServletContext().getRealPath("/upload");
    File f=new File(inputfile);
    FileInputStream fis=null;
    FileOutputStream fo=null;
    File f1=new File(uploadDirName+"/"+f.getName());
    fis=new FileInputStream(f);
    fo=new FileOutputStream(f1);
    try
    byte buf[] = new byte[1024*8]; /* declare a 8kB buffer */
    int len = -1;
    while((len = fis.read(buf)) != -1)
    fo.write(buf, 0, len);
    catch(Exception e)
    e.printStackTrace();
    filepath=f1.getAbsolutePath();
    request.setAttribute("filepath", filepath);
    return mapping.findForward("filepath");
    the input jsp is
    filename.jsp
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <script type="text/javascript">
    alertflag = false;
    var xmlHttp;
    function startRequest()
    if(alertflag)
    alert("meera");
    xmlHttp=createXmlHttpRequest();
    var inputfile=document.getElementById("filepath").value;
    xmlHttp.open("POST","FilePathAction.do",true);
    xmlHttp.onreadystatechange=handleStateChange;
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttp.send("filepath="+inputfile);
    function createXmlHttpRequest()
    //For IE
    if(window.ActiveXObject)
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    //otherthan IE
    else if(window.XMLHttpRequest)
    xmlHttp=new XMLHttpRequest();
    return xmlHttp;
    //Next is the function that sets up the communication with the server.
    //This function also registers the callback handler, which is handleStateChange. Next is the code for the handler.
    function handleStateChange()
    var message=" ";
    if(xmlHttp.readyState==4)
    if(alertflag)
    alert(xmlHttp.status);
    if(xmlHttp.status==200)
    if(alertflag)
    alert("here");
    document.getElementById("div1").style.visibility = "visible";
    var results=xmlHttp.responseText;
    document.getElementById('div1').innerHTML = results;
    else
    alert("Error loading page"+xmlHttp.status+":"+xmlHttp.statusText);
    </script></head><body><form name="thumbs" enctype="multipart/form-data" method="post" action="">
    <input type="file" name="filepath" id="filepath" onchange="startRequest();"/>
    </form>
    <div id="div1" style="visibility:hidden;">
    </div></body></html>
    The ajax response is catching in a dummy.jsp
    <%=(String)request.getAttribute("filepath")%>
    corresponding action mapping
    <action path="/FilePathAction" type="actions.FilePathAction">
    <forward name="filepath" path="/dummy.jsp"/>
    </action>
    So plz help me to upload a file to the server from any PC.
    Iam searched alot but didnt get any solution.

    Plz help me soon if it possible so
    Iam in great need.
    I have worked alot but not worked out.
    Any help greatly appreciated

  • Use Ajax with OAF developed in JDeveloper 9i for Oracle Apps 11.5.10.2

    Hi,
    I am looking to use Ajax to have the same Google type functionality to be impelmented in OAF pages.
    Example : Searching of employee names, organization etc.
    JDeveloper version is 9i
    Oracle Apps - 11.5.10.2
    Please advice.
    Thanks,
    Anirban

    I dont think thats possible using OAF. OAF is not designed with AJAX in mind.

  • Using jsf with struts

    hi;
    i am trying to understand the proper architecture when using jsf and struts together.
    i think i understand the differences between the technologies . it seems to me that instead of justifying jsf there should be a focus on how the two technologies actually collaborate.
    specifically, i would like to know or see examples of things like replacing the view portion of struts and plugging in the jsf framework instead or how to i replace the struts actions with jsf commands or maybe they are totally different things.
    where can i get information like this?
    thanks.

    At present, i think the best thing to do is to look at the example provided with the struts-faces integration taglib. I don't know any documentation about it.
    http://cvs.apache.org/builds/jakarta-struts/nightly/struts-faces/

  • How to use displaytags with struts

    How to use display tags with struts to generate report from database

    I think it would only consist in including the tag library of displaytags in the header and use the prefix of desplay tags.
    Exporting the report from a database would only need to retrieve this information from the database as a List, Map or Collection of objects (beans) and display tem with the corresponding tag (table)
    You have some more information here:
    http://displaytag.sourceforge.net/11/tut_basic.html
    Regards and good luck,
    Fran Serrano.

  • How to use Ajax In struts

    I want to use Ajax in my struts framework.Can anyone please suggest me how
    to do this
    Thanks

    http://www.google.com/search?hl=en&q=ajax+struts&btnG=Google+Search

  • Problem if i use ajax in struts

    hi,
    i am working on struts, now i got one problem if i use ajax in jsp.
    In my jsp page i have two dropdown lists, according to the first dropdown value second dropdown result will getting from the database by calling an action class.
    but my requirement is for getting the second dropdown result page should not be refresh for this i am using ajax.
    in ajax how can we call one action class what should we return in actionmapping.
    If any one already written some code for this please send it to me.
    please can anyone help on this its very urgent for me.

    Hi
    First of all you have to write on fnRetrieveURL which will be responsible for getting the connection and XML communication.
                   function fnRetrieveURL(strURL, strFnProcessStateChange)
                        if(window.XMLHttpRequest)
                             varXMLrequest = new XMLHttpRequest();
                             varXMLrequest.onreadystatechange = eval(strFnProcessStateChange);
                             try
                                  varXMLrequest.open("POST",strURL,true);
                             catch(Exception)
                                  alert("Problem in Getting data ");
                             varXMLrequest.send(null);
                        else if(window.ActiveXObject)
                             varXMLrequest = new ActiveXObject("Microsoft.XMLHTTP");
                             if(varXMLrequest)
                                  varXMLrequest.onreadystatechange =eval(strFnProcessStateChange);
                                  varXMLrequest.open("POST",strURL,true);
                                  varXMLrequest.send();
                   }This method will be called in user written method in which request will be submitted to action class.
                   function fnGetAreaForRegion()
                        var iRegion = document.getElementById("region").value;
                        var strURL = "../getAreaForRegion.do"
                        strURL = strURL+"?methodName="+"getAreaForRegion";
                        strURL = strURL+"&controlName="+"area";
                        strURL = strURL+"&iRegion="+iRegion ;
                        fnRetrieveURL(strURL,"fnOnReturnFromRegion");
                   }Then there will be one on Return method i.e the method which will be called when the response will come back to JSP from fnGetAreaforRegion.
                   function fnOnReturnFromRegion()
                        if (varXMLrequest.readyState == 4)
                             if(varXMLrequest.status == 200)
                                  var strSubClassValue = varXMLrequest.responseText;
                                  if(strSubClassValue != '')
                                    var strArray = strSubClassValue.split(",");
                                       var iLength = strArray.length;
                                       var strName = new Array();
                                       var strID = new Array();
                                       var j=0;
                                       for(var i =0 ; i< iLength;i=i+2)
                                            strName[j] = strArray;
                                            j++;
                                       var k=0;
                                       for(var i =1 ; i< iLength;i=i+2)
                                            strID[k] = strArray[i];
                                            k++;
                                       var iNewLength = strID.length;
                                       var optnSelect = document.createElement("OPTION");
                                       optnSelect.text = 'Select';
                                       optnSelect.value = '';
                                       document.getElementById("area").options.add(optnSelect);
                                       for(var i =0 ; i< iNewLength;i++)
                                            var optn = document.createElement("OPTION");
                                            optn.text = strName[i];
                                            optn.value = parseInt(strID[i]);
                                            document.getElementById("area").options.add(optn);
    Rest modification in struts-config, you can do by urself. and also you have to write one action class which will take care of parameters and all business logic.
    Above code you can reuse by bit modification. Action class you have to write by your own.
    let me know if you still face any issues

  • Can I use Ajax with jsf

    Hi All,
    Is JSF 1.1 supports AJAX or not???
    Please tell me..

    JSF RI 1.1 = Java Server Faces Reference Implementation 1.1.
    It is the Sun reference implementation of JSF. There are also 3rd party implementations of JSF available, like MyFaces, Tomahawk, IceFaces, ADF, etcetera.
    If you aren't limited to JSF RI version 1.1, I recommend you to use version 1.2. It provides more features and benefits.
    Here are some links:
    https://javaserverfaces.dev.java.net
    http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/
    http://jsftutorials.net
    http://java.sun.com/javaee/5/docs/tutorial/doc/ (starting at chapter 9)
    http://jboss.org/projects/jbossAjax4jsf (most widely used AJAX library for JSF)

  • How to upload a file to the server using ajax and struts

    With the following code iam able to upload a file ato the server.
    But my problem is It is working fine if iam doing in my system nd when iam trying to
    access theis application from someother system in our office which are connected through lan
    iam getting an error called 500 i,e internal server error.
    Why it is so???????
    Plz help me????????
    It is required in my project.
    I want the code to access from every system.
    My exact requirement is i have to upload a file to the server and retrive its path and show it in the same page from which we
    have uploaded a file.
    Here the file has to be uploaded to the upload folder which is present in the server.Iam using Tomcat server.
    Any help highly appreciated.
    Thanks in Advance
    This is my input jsp
    filename.jsp
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <script type="text/javascript">
    alertflag = true;
    var xmlHttp;
    function startRequest(file1)
         if(alertflag)
         alert("file1");
         alert(file1);
    xmlHttp=createXmlHttpRequest();
    var video=document.getElementById("filepath").value;
    xmlHttp.open("POST","FilePathAction.do",true);
    xmlHttp.onreadystatechange=handleStateChange;
    xmlHttp.setRequestHeader('Content-Type', application/x-www-form-urlencoded');
    xmlHttp.send("filepath="+file1);
    function createXmlHttpRequest()
         //For IE
    if(window.ActiveXObject)
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         //otherthan IE
    else if(window.XMLHttpRequest)
    xmlHttp=new XMLHttpRequest();
    return xmlHttp;
    //Next is the function that sets up the communication with the server.
    //This function also registers the callback handler, which is handleStateChange. Next is the code for the handler.
    function handleStateChange()
    var message=" ";
    if(xmlHttp.readyState==4)
         if(alertflag)
              alert(xmlHttp.status);
    if(xmlHttp.status==200)
    if(alertflag)
                                       alert("here");
                                       document.getElementById("div1").style.visibility = "visible";     
    var results=xmlHttp.responseText;
              document.getElementById('div1').innerHTML = results;
    else
    alert("Error loading page"+xmlHttp.status+":"+xmlHttp.statusText);
    </script></head><body><form >
    <input type="file" name="filepath" id="filepath" onchange="startRequest(this.value);"/>
    </form>
    <div id="div1" style="visibility:hidden;">
    </div></body></html>
    The corresponding action class is FIlePathAction
    package actions;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.*;
    public class FilePathAction extends Action{
         public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)
                   throws IOException, ServletException
              String contextPath1 = "";
              String uploadDirName="";
              String filepath="";
                        System.out.println(contextPath1 );
                        String inputfile = request.getParameter("filepath");
                        uploadDirName = getServlet().getServletContext().getRealPath("/upload");
                        File f=new File(inputfile);
    FileInputStream fis=null;
    FileOutputStream fo=null;
    File f1=new File(uploadDirName+"/"+f.getName());
    fis=new FileInputStream(f);
         fo=new FileOutputStream(f1);
                        try
         byte buf[] = new byte[1024*8]; /* declare a 8kB buffer */
         int len = -1;
         while((len = fis.read(buf)) != -1)
         fo.write(buf, 0, len);
                        catch(Exception e)
                                  e.printStackTrace();
                        filepath=f1.getAbsolutePath();
                        request.setAttribute("filepath", filepath);
                        return mapping.findForward("filepath");
    Action-mappings in struts-config.xml
    <action path="/FilePathAction"
                   type="actions.FilePathAction">
                   <forward name="filepath" path="/dummy.jsp"></forward>
              </action>
    and the dummy.jsp code is
    <%=request.getAttribute("filepath")%>

    MESSAGE FROM THE FORUMS ADMINISTRATORS and COMMUNITY
    This thread will be deleted within 24 business hours. You have posted an off-topic question in an area clearly designated for discussions
    about Distributed Real-time Java. Community members looking to help you with your question won't be able to find it in this category.
    Please use the "Search Forums" element on the left panel to locate a forum based on your topic. A more appropriate forum for this post
    could be one of:
    Enterprise Technologies http://forums.sun.com/category.jspa?categoryID=19
    David Holmes

  • Best Practices of using AJAX with JSF : BluePrints or  Ajax4Jsf ?

    am a newbie to AJAX4JSF . I think it provides Rapid Application Development (RAD) just by using tags like a4j: without the need to develop complex JSF Custom Components as shown in BluePrints Catalog
    https://bpcatalog.dev.java.net/ajax/jsf-ajax/
    I understand the purpose of developing JSF Custom components as Reusable for using with AJAX. But its complex and requires lot of coding i.e. PhaseListeners and Managed Beans. There should be easy way to do this especially our project needs RAD tool like AJAX4JSF.
    Any suggestions will be highly appreciated
    Regards
    Bansi

    Bansi, you are trying to compare orange-to-apple. Blue print catalog is a historical retrospection about what people thought about AJAXifying JSF in the past. Currently, the playground has been moved to the jsf-extension project. Look for DynaFaces there.

  • ALBPM5.7: Using ALUI with struts application??

    I have a fully functional struts application that uses PAPI to interact with ALBPM5.7. Now I want to Expose all UI screens on the portal server. This need not be portlets, rather using ALUI framework/ EDK to wrap the UI JSPs and expose them in our portal
    Can I reuse my Struts Application with ALUI in some way.
    Thanks.
    Edited by [email protected] at 12/11/2007 9:49 PM

    Ravinder,
    Yes, of course you can bring your struts web application on ALUI portal as a portlet.In general, any web application running either on remote server or ALUI server can be brought up to the ALUI portal.
    If your Struts application is running on the remote server ,here is the steps to view this application on ALUI Portal :
    Login to your ALUI admin ( http://<hostname>:<portnumber >/portal/server.pt(like http://yh759.yashind.com:7001/portal/server.pt) with Administrator as userid(no password required by default)
    Create a Remote server in ALUI where you need to have the info of your Struts application server info
    Create a remote webservice for portlet
    Create a portlet out of that remote webservice
    Put this portlet on any page.
    Alo you can find the online help on ALUI admin conosle for doing all the above steps.
    Thanks
    Bishnu
    Regards
    Bishnu

  • Using AJAX with ApEx

    Hi All,
    I'm new to Ajax and I'm trying to create an alert that prompts the user if the information that they entered into a form results in a primary key violation. The problem is that the application procedure that I created is not returning a value when it should be, because I am not receiving the alert when I violate a primary key...I don't know what I am doing wrong. Any help would be much appreciated.
    My javascript code is as follows:
    function checkNull(){
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=P3PK',0);
    get.add('P3_MEMIMPNUM',$x('P3_MEMIMPNUM').value);
    get.add('P3_ACTIONDATE',$x('P3_ACTIONDATE').value);
    get.add('P3_ACTION',$x('P3_ACTION').value);
    ajaxresult = get.get();
    if (ajaxresult)
    alert("Primary Key Violation!");
    get = null;
    The application process P3PK is processed On Demand and the PL/SQL Block is as follows:
    DECLARE
    str_memimpnum varchar2(15);
    BEGIN
    SELECT memimpnum
    INTO str_memimpnum
    FROM tblaction
    WHERE memimpnum = :P3_MEMIMPNUM AND
    actiondate = :P3_ACTIONDATE AND
    action = :P3_ACTION;
    HTP.prn(str_memimpnum);
    END;
    Finally, the save button is set to redirect to a URL and the URL target is as follows:
    javascript:onclick=checkNull();
    Note: There is more to the checkNull function, but I only included the section that I felt was applicable to this issue.
    Thanks in advance!

    Hello,
    Most likley it's an issue with your OnDemand Process.
    Change your alert to
    alert(ajaxresult);
    And then in your process change it to with a htp.prn('Hello World'); to make sure your calling the right thing.
    Then output the item values.
    htp.prn(:P3_MEMIMPNUM);
    Just work your way through it.
    Also you can easily debug these returns using Firebug addon in Firefox. http://www.getfirebug.com
    then
    Regards,
    Carl
    blog : http://carlback.blogspot.com/
    apex examples : http://apex.oracle.com/pls/otn/f?p=11933:5

  • Anyone use AJAX with Learning Management Systems

    I recently upgraded to Dreamweaver CS3. After looking at it
    briefly the thought occured to me that the AJAX functionality might
    be applied to Learning Management System courses. Typically,
    courses fired through a Learning Management System (LMS) use AICC
    or SCORM compliant JavaScript in order to achieve the user scoring
    interactions.
    Has anyone employed the AJAX functionality in Dreamweaver CS3
    to enhance LMS functionality? Any Thoughts?
    Thank you,
    TPK

    It should be perfectly fine to include it in head - depending on wha you want.
    Try to use Firebug for firefox to debug errors.
    You can add plugins to wordpress that makes it easier to include scripts.

  • Using javascript with struts

    hi ,
    i have a jsp page which has a function to be called in javascript,
    if all the values entered are correct, then the details need to be submitted to the action form in struts.
    the coding is like below:-
    <%@ page language="java"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld"      prefix="bean"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld"     prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-logic.tld"     prefix="logic"%>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Title</title>
    <link href="css/cherrysoft.css" rel="stylesheet" type="text/css" />
    <script language="javascript" src="javascripts/function_client.js" type="text/javascript"></script>
    <script src="javascripts/chgoto.js" language="JavaScript" type="text/javascript"></script>
    <script language="JavaScript">
    function fixSize() {
         buttondiv.style.top =  document.body.offsetTop +(document.body.offsetHeight - buttondiv.offsetHeight );
         contentDiv.style.height = document.body.offsetHeight -  buttonbar.offsetHeight - buttondiv.offsetHeight-14;
         function cancel(obj){
    obj.action="FinanceView.do?do=listBook";
              obj.submit();
         function check_details(obj)
              var frmyear=document.forms[0].fin_fromyear.value;
              var frmmonth=document.forms[0].fin_frommonth.value;
              var toyear=document.forms[0].fin_toyear.value;
              var tomonth=document.forms[0].fin_tomonth.value;
              var yearabbr=document.forms[0].fin_year_abbr.value;
              //alert("From Year : "+frmyear+" frmmonth : "+frmmonth + " : toyear "+toyear+" : to month "+tomonth);
              if(yearabbr.length < 1)
                   alert("The abbreviation field is mandatory");
                   document.forms[0].fin_year_abbr.focus();
              else if(frmyear.length < 1)
                   alert("The from year field is mandatory");
                   document.forms[0].fin_fromyear.focus();               
              else if(frmmonth.length < 1)
                   alert("The from month field is mandatory");
                   document.forms[0].fin_frommonth.focus();
              else if(toyear.length < 1)
                   alert("The to year field is mandatory");
                   document.forms[0].fin_toyear.focus();               
              else if(tomonth.length < 1)
                   alert("The to month field is mandatory");
                   document.forms[0].fin_tomonth.focus();               
              else if(frmyear == toyear)
                   alert("The from and to year cannot be same");
                   document.forms[0].fin_fromyear.focus();
              else if(frmmonth>4)
                   alert("The from month cannot start from "+frmmonth);
              else if(tomonth<3)
                   alert("The to month cannot be less than "+tomonth);
              else if(frmmonth==tomonth)
                   alert("The from month and to month cannot be same");
              else
                   obj.action="FinanceView.do?do=listBook";
                   obj.submit();
    </script>
    </head>
    <body onLoad="fixSize();" >
    <html:form action="/FinanceBeanAdd">
    <div style="height:5%;width:100%" >
         <div id="buttonbar" style="border:0px ;margin-top:0px">
         <table width="100%" cellspacing="0" class="main" >
          <tr>
                   <td class="heading" >Add Financial Year Details</td>
                     <td width="24" background="<%=request.getContextPath()%>/images/bg-titlemid.jpg"></td>
                      <td width="100"  valign="bottom" background="<%=request.getContextPath()%>/images/bgline.gif"></td>
          </tr>
         </table>
         </div>
    </div>
    <DIV id="contentDiv" class="workareadiv"  style="height:85%;width:100%">
    <table width="600px" height="380px" align="center" border"0" cellpadding="0" cellspacing="0">
         <tr>
              <td valign="top">
                   <table border="0"align="center" cellpadding="0" cellspacing="0" >
                        <tr>
                             <td  colspan="2">
                             <table width="600px" height="380px" border="0" align="center" cellpadding="0" cellspacing="0" >
                                  <tr>
                                       <td colspan="3" bgcolor="#FFFFFF">
                                            <tr>
                                                      <td colspan="3" valign="top">
                                       <div  id="enter_details" style=display:block>
                                       <table border="0" bgcolor="#FFFFFF" width="730px" >
    <tr bgcolor="#FFFFFF" class="firstrow">
    <td width='30%' align='left'style="padding-left: 40px" >
    <b>Abbreviation</b><font color='red'>*</font>
    </td>
    <td width='70%'>
    <html:text property="fin_year_abbr" maxlength="7"/></td>
    </tr>
    <tr bgcolor="#FFFFFF" class="secondrow">
    <td width='30%' align='left'style="padding-left: 40px" >
    <b>From Year</b><font color='red'>*</font>
    </td>
    <td width='70%'>
    <html:text property="fin_fromyear" maxlength="4" /></td>
    </tr>
    <tr bgcolor="#FFFFFF" class="firstrow">
    <td width='30%' align='left'style="padding-left: 40px" >
    <b>From Month</b><font color='red'>*</font>
    </td>
    <td width='70%'>
    <html:text property="fin_frommonth" maxlength="2" /></td>
    </tr>
    <tr bgcolor="#FFFFFF" class="secondrow">
    <td width='30%' align='left'style="padding-left: 40px" >
    <b>To Year</b><font color='red'>*</font>
    </td>
    <td width='70%'>
    <html:text property="fin_toyear" maxlength="4" /></td>
    </tr>
    <tr bgcolor="#FFFFFF" class="firstrow">
    <td width='30%' align='left'style="padding-left: 40px" >
    <b>To Month</b><font color='red'>*</font>
    </td>
    <td width='70%'>
    <html:text property="fin_tomonth" maxlength="2" /></td>
    </tr>
                             <tr>
                                                           <td>
                                                           <logic:messagesPresent>
                                                                <ul><font color='red' >
                                                                     <html:messages id="error1">
                                                                          <li><%= error1 %></li>                         </html:messages>
                                                                     </font>
                                                                </ul>
                                                           </logic:messagesPresent>
                                                           </td>
                                                           </tr>
                                                           </table>
                                                           </td>
                                                           </tr>
                                            </td>
                                       </tr>
                                  </table>
                                  </div>
                                  </td>
                             </tr>
                             </table>
                        </td>
                   </tr>
              </table>
    </td>
    </tr>
    </table>
    </div>
               <div id="buttondiv" style="height:10%">
                                                                       <table width="100%" align="left" border="0" cellpadding="3" cellspacing="0"  class="main" >
                                                                     <tr>
                                                                          <td colspan="4" bgcolor="#FFFFFF">
                                                                               <table border="0" cellpadding="2" cellspacing="2" align="left">
                                                                               <tr>
                                                                               <td>
                                                                                    <div align="left" id="save_btn">
                                                                                    <!-- <html:button property="do" value="Save" onclick="check_details(this.form);"/>-->
                                                                                         <!--<html:submit property="do" value="Save"/> -->
                                                                                     <input type="button" value="Save" onclick="check_details(this.form);"%>
                                                                                    </div>
                                                                               </td>
                                                                               <td><div align="left">
                                                                               <html:button property="Cancel" value="Cancel" onclick="cancel(this.form);"/>
                                                                               </div></td>
                                                                               </tr>
                                                                               </table>
              </div>
    </html:form>
    </body>
    </html>
    [/b]the problem right now is when the values are entered the details are not getting stored and it returns to the view.
    pls require someone's help.
    thanks
    sreejith

    I don't see anything at all in that code that has anything to do with JDBC.
    So certainly that code by itself can't store anything in a database.

  • How to plot bar chart using iReport with Struts 2

    Hi All
    Im working on iReport 3.5.1 to generate jasper report for our java enterprise application. Here, I have no problem, when im generating simple report[without any chart]. When i try to add a bar chart to jasper report, i coudnt get the exact chart what i wanted, im just getting some ridiculous chart which is exactly wrong, i guess the problem is with the data given to plot the chart. Do, anybody know how to transport data to plot the bar chart in iReport. For Simple chart im using javabeans to generate report, but for chart, how it should be?
    Thanks in advance
    Thanks and Regards
    Baskaran
    Edited by: Baskaran on May 22, 2009 12:36 PM

    jxl does not support create chart from scratch.
    Maybe you can do it by using excel template:
    define a chart in the sheet,using definedName or fixed range as chart data source.

Maybe you are looking for