weixin_42364570
2010-05-05 17:39
浏览 194
已采纳

ActionForm 无法获取值

URL跳转请求

http://localhost:8080/union/RegistComfig.do?usernumber=aaaaaaa&usercard=1111111111111&User_Account=aaa&User_Password=111111&User_RePassword=111111&User_Sex=%E5%85%88%E7%94%9F&User_Age=2008&User_Shen=%E5%8C%97%E4%BA%AC&User_Town=%E6%9C%9D%E9%98%B3&User_City=%E6%9C%9D%E9%98%B3&User_Email=&User_Question=person&useranswer=111&identifier=1272805041422023&authcode=ADSF&checkbox=checkbox

后台form

package com.myunion.front.struts.form;

import org.apache.struts.action.ActionForm;


public class RegistFormComfig  extends ActionForm {
    
    private String usernumber ;
    private String usercard;
    private String User_Account ;
    private String User_Password;
    private String User_RePassword;
    private String User_Sex ;
    private String User_Age;
    private String User_Shen ;
    private String User_Town;
    private String User_City;
    private String User_Email ;
    private String User_Question;
    private String User_Answer;
    private String identifier;
    private String authcode;
    private String checkbox;
    
    

    public String getUsernumber() {
        return usernumber;
    }

    public void setUsernumber(String usernumber) {
        this.usernumber = usernumber;
    }

    public String getUsercard() {
        return usercard;
    }

    public void setUsercard(String usercard) {
        System.out.println("usercard:"+usercard);
        this.usercard = usercard;
    }

    public String getUser_Account() {
        return User_Account;
    }

    public void setUser_Account(String user_Account) {
        System.out.println("user_Account:"+user_Account);
        User_Account = user_Account;
    }

    public String getUser_Password() {
        return User_Password;
    }

    public void setUser_Password(String user_Password) {
        User_Password = user_Password;
    }


    public String getUser_Age() {
        return User_Age;
    }

    public void setUser_Age(String user_Age) {
        User_Age = user_Age;
    }

    public String getUser_Shen() {
        return User_Shen;
    }

    public void setUser_Shen(String user_Shen) {
        User_Shen = user_Shen;
    }

    public String getUser_Town() {
        return User_Town;
    }

    public void setUser_Town(String user_Town) {
        User_Town = user_Town;
    }

    public String getUser_City() {
        return User_City;
    }

    public void setUser_City(String user_City) {
        User_City = user_City;
    }

    public String getUser_Email() {
        return User_Email;
    }

    public void setUser_Email(String user_Email) {
        User_Email = user_Email;
    }

    public String getUser_Question() {
        return User_Question;
    }

    public void setUser_Question(String user_Question) {
        User_Question = user_Question;
    }

    public String getUser_Answer() {
        return User_Answer;
    }

    public void setUser_Answer(String user_Answer) {
        User_Answer = user_Answer;
    }

    public String getAuthcode() {
        return authcode;
    }

    public void setAuthcode(String authcode) {
        this.authcode = authcode;
    }

    public String getUser_RePassword() {
        return User_RePassword;
    }

    public void setUser_RePassword(String user_RePassword) {
        User_RePassword = user_RePassword;
    }

    public String getCheckbox() {
        return checkbox;
    }

    public void setCheckbox(String checkbox) {
        this.checkbox = checkbox;
    }

    public String getUser_Sex() {
        return User_Sex;
    }

    public void setUser_Sex(String user_Sex) {
        User_Sex = user_Sex;
    }

    public String getIdentifier() {
        return identifier;
    }

    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    @Override
    public String toString() {
        return  "usernumber:"+ usernumber + " usercard:"+usercard+" User_Account:"+User_Account+" User_Password:"+ User_Password
        +" User_Age:"+User_Age+" User_Shen:"+User_Shen +" User_Town:"+ User_Town+" User_City:"+User_City
        +" User_Email:"+User_Email+" User_Question:"+User_Question+" User_Answer:"+User_Answer+" authcode:"+authcode+" checkbox:"+checkbox;
    }

    
}

 后台显示

usernumber:aaaaaaa usercard:1111111111111 User_Account:null User_Password:null User_Age:null User_Shen:null User_Town:null User_City:null User_Email:null User_Question:null User_Answer:null authcode:ADSF checkbox:checkbox

为什么只能获得4个值

<action
      path="/RegistComfig"
      scope="request"
      name="RegistFormComfig"
      type="com.myunion.front.struts.action.RegisterComfig" >
      </action>

 <form-bean name="RegistFormComfig" type="com.myunion.front.struts.form.RegistFormComfig" />
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • 屌丝哥 2010-05-05 21:12
    已采纳

    [size=medium]
    兄弟,我想起来了

    get请求时把参数放在HTTP协议头上,大小好像是256;

    而post请求是放在HTTP协议体上,几乎可以无限大,只要HTTP支持即可。

    希望对你有帮助!

    [/size]

    点赞 打赏 评论
  • 屌丝哥 2010-05-05 20:48

    [size=medium]

    兄弟,URL传参数好像有个限制,你传这这么多个参数好像不行的。最多支持多少个参数我忘记了,但是我记得老师上课曾经讲多的。

    你为什么不用STRUTS标签把数据封装在一起呢,用ACTIONFORM来获取值,这样比较好。

    goog luck!

    [/size]

    点赞 打赏 评论
  • 王启军 2010-05-05 22:33

    好好看看基础吧,规范很重要
    变量为什么要定义成User_Password
    应该是userPassword

    点赞 打赏 评论

相关推荐 更多相似问题