Hi Mukul

I tried the way you have suggested. However I am getting a JavaScript error
saying that

form.submit() is not a method.

The code I have written is as follows

<INPUT TYPE="button" VALUE="Search" onclick="Checkfn(this)" > </FONT>  </td>

function Checkfn(f)
{

  if(document.Search.Empid.value=="" &&
     document.Search.EmpFname.value=="" &&
     document.Search.EmpLname.value=="" )
  {
    alert("Please enter alleast one Search criterion");
    document.Search.Empid.focus();
  }
 else
   {
    f.METHOD="GET";
    f.ACTION="http://localhost:8080/servlet/SearchEmp";
    f.Submit();
   }

Please let me know what the problem is

Thanks
 Nitin


Stein M. Eliassen wrote:

> Hi Mukul and sorry for the late response,
>
> The problem are solved.
> The problem with IE where because I didn't format the arguments
> properly.
>
> I just reloads the servlet or det html page to get the result I wanted.
>
> I use the ECS from the Apache group to do the html stuff and do like
> this in the doPost after inserting some data into database:
>
> Meta m = new Meta();
> m.setHttpEquiv("refresh");
> m.setContent("0; url=http://" + req.getHeader("Host") +
> "/servlet/SomeServlet;");
> Head h = new Head();
> h.addElement(m);
> Html html = new Html(h);
> out.println(html);
>
> It's not fast, but it works.
> Maybe someone on this list knows a better way?
>
> regards
> Stein
>
> Mukul Gandhi wrote:
> >
> > Hi Stein,
> > You want - On first invocation of servlet call doPost() , and on second
> > invocation of the same servlet call doGet() .
> > I can suggest a HTML/JavaScript trick . Instead of having a usual Submit
> > button in the form, u can have two normal form buttons(say b1 & b2). On
> > onClick() event of b1 u will call -
> > function b1Click(form) {
> >   form.action = "http://server/Servlet/someservlet"
> >   form.method = "POST"
> >   form.submit()
> > }
> > And, on onClick() of b2 u can call -
> > function b2Click(form) {
> >   form.action = "http://server/Servlet/someservlet"
> >   form.method = "GET"
> >   form.submit()
> > }
> >
> > If u want strict ordering for clicking b1 & b2(i.e click b1 after b2), u
> > can write some html/javascript for this. I can help the ordering problem
> > also if u want.
> > I hope, this should solve ur purpose.
> > --Mukul Gandhi
> >
> > At 12:45 AM 7/12/99 +0200, you wrote:
> > >Hello,
> > >
> > >I'm writing my first servlet that actually to do something other then
> > >writing helloworld..
> > >
> > >This is a single servlet that do some database stuff in the doGet and
> > >doPost methods..
> > >
> > >After putting data into the database in doPost I want to call the doGet
> > >method, but then I just get the 'Repost form data' if the user reloads
> > >the page..
> > >
> > >I 'solved it' by redirecting after zero seconds, but there got to be a
> > >better way. Right?
> > >
> > >
> > >Stein
> >
> > ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to