小弟初学struts,写了个例子,使用的是 普通的标签,就是HTML里的标签,程序出现问题,
weblogic提示The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. 
找了一下午错,最后把标签都换成 struts的标签就可以了,不知这是为什么,struts不支持普通的HTML标签吗? 
大家帮帮我,谢谢!

解决方案 »

  1.   

    struts-config.xml
    /////////////////////////////////////////////////////////////////////////
    <struts-config>
    <form-beans>
    <form-bean name="informForm" type="sso.form.InformForm" />
    </form-beans><action-mappings>
    <action path="/addInform" type="sso.action.InformAction"
    name="informForm" scope="request" >
    <forward name="addInformSucc" path="/graduate/informList.jsp" />
    <forward name="addInformFail" path="/error.jsp" />
    </action>
    </action-mappings>
    </struts-config>//////////////////////////////////////////////////////////////////////////////////////////////////
    jsp
    /////////////////////////////////////////////////////////////////////////////////////////////////
    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>通知</title>
    <link href="right.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    .STYLE1 {
    color: #FFFFFF;
    font-size: 18px;
    font-weight: bold;
    }
    body {
    margin-left: 50px;
    margin-top: 50px;
    }
    -->
    </style>
    </head>
    <%
    String departmentid = "";
    String sendman = "";
    if(request.getParameter("departmentid")!=null)
    {
    departmentid = request.getParameter("departmentid");
    }
    if(request.getParameter("sendman")!=null)
    {
    sendman = request.getParameter("sendman");
    }
    %>
    <body>
       <form name="form1"  method="post" action="addInform">
    <table width="559" border="1" cellpadding="0" cellspacing="0" bordercolor="#668EEA" >

    <tr>
    <td  colspan="2"  height="30" width="501" align="center" valign="middle" bgcolor="#668EEA" >发布通知</td>
    </tr>
    <tr>
    <td align="center"  valign="middle" width="50" >标题</td>
    <td  align="left" valign="middle">
    <input type="text"  name="title"  size="60"/>
    </td>
    </tr> <tr><td  align="center" valign="middle" >内容</td>
    <td  align="left" valign="middle">
    <textarea  name="content" cols="60" rows="8"/></textarea></td>
    </tr>
    <tr align="center">
    <td colspan="2"  align="center" valign="middle">
    <input type="hidden"  name="departmentid" value="<%=departmentid%>"/>
    <input type="hidden"  name="sendman" value="<%=sendman%>"/>
    <input type="submit"  value="提交" />&nbsp;&nbsp;&nbsp;
                 </td>
    </tr>
    </table>
    </form>
     </body>
    </html>
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    form
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////
    package sso.form;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;public class InformForm extends ActionForm { private String departmentid = "";
    private String title = "";
    private String content = "";
    private String sendman = ""; public InformForm() {
    } public void setDepartmentID(String depid) {
    this.departmentid = depid;
    } public String getDepartmentID() {
    return this.departmentid;
    } public void setTitle(String title) {
    this.title = title;
    } public String getTitle() {
    return this.title;
    } public void setContent(String content) {
    this.content = content;
    } public String getContent() {
    return this.content;
    } public void setSendMan(String sendman) {
    this.sendman = sendman;
    } public String getSendMan() {
    return this.sendman;
    }
    }
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////action
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    package sso.action;import java.io.IOException;import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;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 org.apache.struts.action.ActionMessage;
    import org.apache.struts.action.ActionMessages;import sso.common.CommonUtil;
    import sso.form.InformForm;
    import sso.graduate.InformBean;
    import sso.graduate.InformOperation;public final class InformAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {

    InformForm inform = (InformForm) form;

    String departmentid = inform.getDepartmentID();
    String title = inform.getTitle();
    String content = inform.getContent();
    String sendtime = inform.getSendTime();
    String sendman = inform.getSendMan(); InformOperation ifo = new InformOperation();
    InformBean ifb = new InformBean();

    ifb.setDepartmentID(departmentid);
    ifb.setTitle(title);
    ifb.setContent(content);
    ifb.setSendMan(sendman);
    ifb.setFlag("0"); if (ifo.addInform(ifb)) {
    return mapping.findForward("addInformSucc");
    }else { return (mapping.findForward("addInformFail")); }
    }}