aspose file tools*
The moose likes Servlets and the fly likes Form.submit() and WebSphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Form.submit() and WebSphere" Watch "Form.submit() and WebSphere" New topic
Author

Form.submit() and WebSphere

Doug Harding
Greenhorn

Joined: Apr 03, 2005
Posts: 8
Hi All,

I am running websphere version 5.6.x.x.

I have an application that I am trying to trouble shoot. There is a javascript form.submit() function in an html page. Something is going on with the java class file that is performing the processing for this form. The trouble that I am having now is that while I think I know which class is being invoked, I don't know which one it really is.

I have been searching the web for a few days trying to get an insight into how I would locate this program. I have been told that if I were using struts that there would be a config.xml file someplace that would link the html page with a java class.

Is the same thing true for a non-struts application?

Any and all suggestions would be greatly appreciated.

Thanks,

Doug Harding
State of Utah / Division of Finance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

If your app is not using a front controller, the servlet or JSP will be named in the action attribute of the form. What's there?

If it's a servelt reference, it should be mapped in the deployment descriptor (web.xml).

As this is not an HTML or JavaScript question, I'm moving it off to the servelts forum ('cause I don't thinkthis is websphere=specific either).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Doug Harding
Greenhorn

Joined: Apr 03, 2005
Posts: 8
Thank you Bear,

I had seen the <FORM tag but hadn't realized that what all of the attributes for it were.

I do appreciate your help.

Doug
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

If you have trouble interpreting what you see, please post back.
Doug Harding
Greenhorn

Joined: Apr 03, 2005
Posts: 8
Thanks again Bear,

The attributes for the FORM tag consist of
name=htmlfile
action=application
method=post
vsform="true"

The only remaining question that I have is in regard to determining the entry point to the class file that the name attribute is pointing to. I am editing the java program in Sun Java Studio Enterprise 8.1. When I click on the Navigator button and select the Inheritance View, I see 9 objects listed.

I have looked in all of the objects with the exception of the second to last one which I don't have the source code to so it is a class file. I would assume that I should be looking for a file that has a "main" class. That may not be true, but I don't know how to determine the entry point.

What I am trying to accomplish is this. I made a modification to the html that is displayed and submits to the top level of the class file. My modification works however another action that formerly displayed a message in a status control in the html is now displaying an alert message box.

I am trying to follow the code through from the submit in the javascript in the html, through the java classes and back to the html. This is all in trying to figure out why it is doing the alert command. Worse still is that this is only happening in IE7. IE6 works fine.

I do appreciate any help you can through my direction. If you could even recommend a reference manual that would explain these things to me, I will get it and study to find out what I need to know.

Thanks again,

Doug
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Originally posted by Doug Harding:
action=application
That is odd. Most servlet paths will start with /.
I would assume that I should be looking for a file that has a "main" class. That may not be true
It is not true. Java web apps do not have main classes. They are based on the servlet specification. Assuming that the target of the submission is a servlet, it will be a class that extends HttpServlet. But if the app is wired differently all bets are off until you can determine what the form action "application" maps to.

Is there an entry in the web.xml for "application"?
[ September 11, 2007: Message edited by: Bear Bibeault ]
Doug Harding
Greenhorn

Joined: Apr 03, 2005
Posts: 8
There are actually two entries for "application" in the web.xml. In my last message I had changed the actual names of the name and application attributes because this system I am working on is one we have licensed from a fairly large software company.

Let's change the application attribute to be
application=General_Accounting
name=payvoucher

The first entry in web.xml for the aplication is

<servlet id="Servlet_General_Accounting_1">
<servlet-name>General_Accounting</servlet-name>
<display-name>General_Accounting Servlet</display-name>
<servlet-class>packagename.General_Accounting.General_AccountingServlet
</servlet-class>
</servlet>

This is subordinate to a <web-app> tag.

The second entry is

<servlet-mapping id="ServletMapping_General_Accounting_1">
<servlet-name>General_Accounting</servlet-name>
<url-pattern>/General_Accounting</url-pattern>
</servlet-mapping>

This is also subordinate to the <web-app> tag.

Sir Bear, your help with this issue is being invaluable. Can you recommend a book that I could use as a reference for this area? I am a big believer in getting the proper tools when I do a job. I'm just not sure what the proper tool would be.

Thanks again for the knowledge you are transfering to me.

Doug
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

According to your mapping the action should be /General_Accounting and that would map to the servlet at: packagename.General_Accounting.General_AccountingServlet

With regards to resources, I'm a big believer in the horse's mouth: grab a copy of the Servlet Spec and start reading. It's actually an easier read than you might think, and it has all the info you need to know about servlets.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Form.submit() and WebSphere
 
Similar Threads
Struts within an existing application
am I using MVC correctly?
Form.submit() and WebSphere
Enabling/Installing Struts Tiles
HTML to Text via Screen scrape