You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Divya B Sridhar <di...@cisco.com> on 2003/11/20 10:34:31 UTC

Struts ActionForm Question

Hi all,
I have a question.
I am new into struts and right now doing a small sample page for the
same.
Right now, I have a form which has a  textbox which can take a stock
code as input - index.jsp
Here it goes:
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
 
<html>
 <head>
  <title>BAT struts application</title>
 </head>
 <body>
  <table width="500" border="0" cellspacing="0" cellpadding="0">
  <tr>
   <td>&nbsp;</td>
  </tr>
  <tr bgcolor="#36566E">
   <td height="68" width="48%">
    <div align="left">
     <img src="images/bulkadmin.jpg" width="220" height="74">
    </div>
   </td>
  </tr>
  <tr>
   <td>&nbsp;</td>
  </tr>
  </table>
 
  <html:form action="Lookup" name="lookupForm" type="bat.LookupForm">
   <table width="45%" border="0">
    <tr>
     <td>Symbol:</td>
     <td><html:text property="symbol" /></td>
    </tr>
    <tr>
     <td colspan="2" align="center"><html:submit /></td>
    </tr>
   </table>
  </html:form>
 </body>
</html>
 
Now, I have a class LookupForm.java. This extends ActionForm. Here it
goes.
 
package batclass;
 
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
 
public class LookupForm extends ActionForm
{
 private String symbol = null;
 
 public String getSymbol()
 {
  return(symbol);
 }
 
 public void setSymbol(String symbol)
 {
  this.symbol = symbol;
 }
 
 public void reset(ActionMapping mapping, HttpServletRequest request)
 {
  this.symbol = null;
 }
}
 
Now, I have installed tomcat 4.1.24 and struts 1.1; set CATALINA_HOME
and JAVA_HOME environment variables. Also, since I use
httpServletRequest, I have set the classpath for servlet.jar as well.
Now when I compile the LookupForm.java, it gives me "cannot resolve
symbol" for ActionForm and ActionMapping classes(made them bold in the
class above). What other configuration/setting classpath etc is required
to overcome this? I mean, what other configuration did I miss in order
that I can get this class compile successfully.
Thanks in advance,
Divya.

Re: Struts ActionForm Question

Posted by Ted Husted <hu...@apache.org>.
This is really a question for the USER list. If there is any followup, 
please continue the thread there.

But, the configuration isn't different from any web application. The 
compiled classes can be under WEB-INF/classes or in a JAR under 
WEB-INF/lib. The Struts JARs (including the Commons and Jakarta ones) 
would go under WEB-INF/lib. Typically, people put their own class files 
under classes, but some people JAR those as well.

HTH, Ted.

Divya B Sridhar wrote:
> Hi all,
> I have a question.
> I am new into struts and right now doing a small sample page for the
> same.
> Right now, I have a form which has a  textbox which can take a stock
> code as input - index.jsp
> Here it goes:
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>  
> <html>
>  <head>
>   <title>BAT struts application</title>
>  </head>
>  <body>
>   <table width="500" border="0" cellspacing="0" cellpadding="0">
>   <tr>
>    <td>&nbsp;</td>
>   </tr>
>   <tr bgcolor="#36566E">
>    <td height="68" width="48%">
>     <div align="left">
>      <img src="images/bulkadmin.jpg" width="220" height="74">
>     </div>
>    </td>
>   </tr>
>   <tr>
>    <td>&nbsp;</td>
>   </tr>
>   </table>
>  
>   <html:form action="Lookup" name="lookupForm" type="bat.LookupForm">
>    <table width="45%" border="0">
>     <tr>
>      <td>Symbol:</td>
>      <td><html:text property="symbol" /></td>
>     </tr>
>     <tr>
>      <td colspan="2" align="center"><html:submit /></td>
>     </tr>
>    </table>
>   </html:form>
>  </body>
> </html>
>  
> Now, I have a class LookupForm.java. This extends ActionForm. Here it
> goes.
>  
> package batclass;
>  
> import javax.servlet.http.HttpServletRequest;
> import org.apache.struts.action.ActionForm;
> import org.apache.struts.action.ActionMapping;
>  
> public class LookupForm extends ActionForm
> {
>  private String symbol = null;
>  
>  public String getSymbol()
>  {
>   return(symbol);
>  }
>  
>  public void setSymbol(String symbol)
>  {
>   this.symbol = symbol;
>  }
>  
>  public void reset(ActionMapping mapping, HttpServletRequest request)
>  {
>   this.symbol = null;
>  }
> }
>  
> Now, I have installed tomcat 4.1.24 and struts 1.1; set CATALINA_HOME
> and JAVA_HOME environment variables. Also, since I use
> httpServletRequest, I have set the classpath for servlet.jar as well.
> Now when I compile the LookupForm.java, it gives me "cannot resolve
> symbol" for ActionForm and ActionMapping classes(made them bold in the
> class above). What other configuration/setting classpath etc is required
> to overcome this? I mean, what other configuration did I miss in order
> that I can get this class compile successfully.
> Thanks in advance,
> Divya.
> 

-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Struts ActionForm Question

Posted by Ted Husted <hu...@apache.org>.
This is really a question for the USER list. If there is any followup, 
please continue the thread there.

But, the configuration isn't different from any web application. The 
compiled classes can be under WEB-INF/classes or in a JAR under 
WEB-INF/lib. The Struts JARs (including the Commons and Jakarta ones) 
would go under WEB-INF/lib. Typically, people put their own class files 
under classes, but some people JAR those as well.

HTH, Ted.

Divya B Sridhar wrote:
> Hi all,
> I have a question.
> I am new into struts and right now doing a small sample page for the
> same.
> Right now, I have a form which has a  textbox which can take a stock
> code as input - index.jsp
> Here it goes:
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>  
> <html>
>  <head>
>   <title>BAT struts application</title>
>  </head>
>  <body>
>   <table width="500" border="0" cellspacing="0" cellpadding="0">
>   <tr>
>    <td>&nbsp;</td>
>   </tr>
>   <tr bgcolor="#36566E">
>    <td height="68" width="48%">
>     <div align="left">
>      <img src="images/bulkadmin.jpg" width="220" height="74">
>     </div>
>    </td>
>   </tr>
>   <tr>
>    <td>&nbsp;</td>
>   </tr>
>   </table>
>  
>   <html:form action="Lookup" name="lookupForm" type="bat.LookupForm">
>    <table width="45%" border="0">
>     <tr>
>      <td>Symbol:</td>
>      <td><html:text property="symbol" /></td>
>     </tr>
>     <tr>
>      <td colspan="2" align="center"><html:submit /></td>
>     </tr>
>    </table>
>   </html:form>
>  </body>
> </html>
>  
> Now, I have a class LookupForm.java. This extends ActionForm. Here it
> goes.
>  
> package batclass;
>  
> import javax.servlet.http.HttpServletRequest;
> import org.apache.struts.action.ActionForm;
> import org.apache.struts.action.ActionMapping;
>  
> public class LookupForm extends ActionForm
> {
>  private String symbol = null;
>  
>  public String getSymbol()
>  {
>   return(symbol);
>  }
>  
>  public void setSymbol(String symbol)
>  {
>   this.symbol = symbol;
>  }
>  
>  public void reset(ActionMapping mapping, HttpServletRequest request)
>  {
>   this.symbol = null;
>  }
> }
>  
> Now, I have installed tomcat 4.1.24 and struts 1.1; set CATALINA_HOME
> and JAVA_HOME environment variables. Also, since I use
> httpServletRequest, I have set the classpath for servlet.jar as well.
> Now when I compile the LookupForm.java, it gives me "cannot resolve
> symbol" for ActionForm and ActionMapping classes(made them bold in the
> class above). What other configuration/setting classpath etc is required
> to overcome this? I mean, what other configuration did I miss in order
> that I can get this class compile successfully.
> Thanks in advance,
> Divya.
> 

-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: Struts ActionForm Question

Posted by Revathi Balakrishnan <re...@yahoo.com>.
Hi Divya,
 
Verify if you had qualified your class names correctly in your struts-config.xml and had put them in the right package specified in the configuration file.  I had the same problem wherein I did not qualify my class name correctly in the config file.
 
GoodLuck
 
Reva.


Divya B Sridhar <di...@cisco.com> wrote:
Hi all,
I have a question.
I am new into struts and right now doing a small sample page for the
same.
Right now, I have a form which has a textbox which can take a stock
code as input - index.jsp
Here it goes:










 










 






Symbol:










Now, I have a class LookupForm.java. This extends ActionForm. Here it
goes.

package batclass;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class LookupForm extends ActionForm
{
private String symbol = null;

public String getSymbol()
{
return(symbol);
}

public void setSymbol(String symbol)
{
this.symbol = symbol;
}

public void reset(ActionMapping mapping, HttpServletRequest request)
{
this.symbol = null;
}
}

Now, I have installed tomcat 4.1.24 and struts 1.1; set CATALINA_HOME
and JAVA_HOME environment variables. Also, since I use
httpServletRequest, I have set the classpath for servlet.jar as well.
Now when I compile the LookupForm.java, it gives me "cannot resolve
symbol" for ActionForm and ActionMapping classes(made them bold in the
class above). What other configuration/setting classpath etc is required
to overcome this? I mean, what other configuration did I miss in order
that I can get this class compile successfully.
Thanks in advance,
Divya.


---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now