2 ningge09 ningge09 于 2016.04.04 01:20 提问

新手求助,Java script的radio控件用法

图片说明

不懂怎么修改,求教一下

8个回答

wojiushiwo945you
wojiushiwo945you   Ds   Rxr 2016.04.04 07:30

user是在哪里定义的,需要先定义啊。看一下编译提示的错误信息。

ningge09
ningge09 回复毕小宝: 后面的jsp页面的 不懂为什么复制不上来,我上图给你吧
一年多之前 回复
ningge09
ningge09 回复毕小宝: 我贴出来,你帮我看看
一年多之前 回复
wojiushiwo945you
wojiushiwo945you 回复ningge09: 你应该把这个页面的全部代码贴出来,user当然是先从某个地方取出来赋值给某个User类型的变量的。
一年多之前 回复
ningge09
ningge09 怎么定义呢?我以为是定义了usersex就可以了
一年多之前 回复
ningge09
ningge09   2016.04.04 14:20

2016-4-4 14:17:10 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\My Eclipse6.5\bin;D:\My Eclipse6.5\myeclipse\eclipse\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_6.5.0.zmyeclipse650200806\tomcat\bin
2016-4-4 14:17:10 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2016-4-4 14:17:10 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 502 ms
2016-4-4 14:17:10 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2016-4-4 14:17:10 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.13
2016-4-4 14:17:10 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(D:\My Eclipse6.5\workspace.metadata.plugins\com.genuitec.eclipse.easie.tomcat.myeclipse\tomcat\webapps\Tryingshoes\WEB-INF\lib\javaee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2016-4-4 14:17:11 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2016-4-4 14:17:16 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2016-4-4 14:17:16 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2016-4-4 14:17:16 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/31 config=null
2016-4-4 14:17:16 org.apache.catalina.startup.Catalina start
信息: Server startup in 6136 ms
Hibernate: select tproduct0_.product_id as product1_5_, tproduct0_.product_name as product2_5_, tproduct0_.product_miaoshu as product3_5_, tproduct0_.product_pic as product4_5_, tproduct0_.product_yanse as product5_5_, tproduct0_.product_shichangjia as product6_5_, tproduct0_.product_tejia as product7_5_, tproduct0_.product_isnottejia as product8_5_, tproduct0_.product_isnottuijian as product9_5_, tproduct0_.product_catelog_id as product10_5_, tproduct0_.product_kucun as product11_5_, tproduct0_.product_Del as product12_5_, tproduct0_.product_shrq as product13_5_, tproduct0_.product_haoping as product14_5_, tproduct0_.product_zhongping as product15_5_, tproduct0_.product_chaping as product16_5_ from t_product tproduct0_ where tproduct0_.product_Del='no' and tproduct0_.product_isnottejia='yes' and tproduct0_.product_isnottuijian='no' order by tproduct0_.product_id desc
Hibernate: select sum(tpingjia0_.haoping) as col_0_0_, tpingjia0_.productId as col_1_0_ from t_pingjia tpingjia0_ group by tpingjia0_.productId order by sum(tpingjia0_.haoping) desc
22&&
Hibernate: select tproduct0_.product_id as product1_5_0_, tproduct0_.product_name as product2_5_0_, tproduct0_.product_miaoshu as product3_5_0_, tproduct0_.product_pic as product4_5_0_, tproduct0_.product_yanse as product5_5_0_, tproduct0_.product_shichangjia as product6_5_0_, tproduct0_.product_tejia as product7_5_0_, tproduct0_.product_isnottejia as product8_5_0_, tproduct0_.product_isnottuijian as product9_5_0_, tproduct0_.product_catelog_id as product10_5_0_, tproduct0_.product_kucun as product11_5_0_, tproduct0_.product_Del as product12_5_0_, tproduct0_.product_shrq as product13_5_0_, tproduct0_.product_haoping as product14_5_0_, tproduct0_.product_zhongping as product15_5_0_, tproduct0_.product_chaping as product16_5_0_ from t_product tproduct0_ where tproduct0_.product_id=?
20&&
Hibernate: select tproduct0_.product_id as product1_5_0_, tproduct0_.product_name as product2_5_0_, tproduct0_.product_miaoshu as product3_5_0_, tproduct0_.product_pic as product4_5_0_, tproduct0_.product_yanse as product5_5_0_, tproduct0_.product_shichangjia as product6_5_0_, tproduct0_.product_tejia as product7_5_0_, tproduct0_.product_isnottejia as product8_5_0_, tproduct0_.product_isnottuijian as product9_5_0_, tproduct0_.product_catelog_id as product10_5_0_, tproduct0_.product_kucun as product11_5_0_, tproduct0_.product_Del as product12_5_0_, tproduct0_.product_shrq as product13_5_0_, tproduct0_.product_haoping as product14_5_0_, tproduct0_.product_zhongping as product15_5_0_, tproduct0_.product_chaping as product16_5_0_ from t_product tproduct0_ where tproduct0_.product_id=?
Hibernate: select tproduct0_.product_id as product1_5_, tproduct0_.product_name as product2_5_, tproduct0_.product_miaoshu as product3_5_, tproduct0_.product_pic as product4_5_, tproduct0_.product_yanse as product5_5_, tproduct0_.product_shichangjia as product6_5_, tproduct0_.product_tejia as product7_5_, tproduct0_.product_isnottejia as product8_5_, tproduct0_.product_isnottuijian as product9_5_, tproduct0_.product_catelog_id as product10_5_, tproduct0_.product_kucun as product11_5_, tproduct0_.product_Del as product12_5_, tproduct0_.product_shrq as product13_5_, tproduct0_.product_haoping as product14_5_, tproduct0_.product_zhongping as product15_5_, tproduct0_.product_chaping as product16_5_ from t_product tproduct0_ where tproduct0_.product_Del='no' and tproduct0_.product_isnottejia='no' and tproduct0_.product_isnottuijian='no' order by tproduct0_.product_id desc
Hibernate: select sum(torderitem0_.product_quantity) as col_0_0_, torderitem0_.product_id as col_1_0_ from t_orderItem torderitem0_ group by torderitem0_.product_id order by sum(torderitem0_.product_quantity) desc
20&&
Hibernate: select tproduct0_.product_id as product1_5_0_, tproduct0_.product_name as product2_5_0_, tproduct0_.product_miaoshu as product3_5_0_, tproduct0_.product_pic as product4_5_0_, tproduct0_.product_yanse as product5_5_0_, tproduct0_.product_shichangjia as product6_5_0_, tproduct0_.product_tejia as product7_5_0_, tproduct0_.product_isnottejia as product8_5_0_, tproduct0_.product_isnottuijian as product9_5_0_, tproduct0_.product_catelog_id as product10_5_0_, tproduct0_.product_kucun as product11_5_0_, tproduct0_.product_Del as product12_5_0_, tproduct0_.product_shrq as product13_5_0_, tproduct0_.product_haoping as product14_5_0_, tproduct0_.product_zhongping as product15_5_0_, tproduct0_.product_chaping as product16_5_0_ from t_product tproduct0_ where tproduct0_.product_id=?
22&&
Hibernate: select tproduct0_.product_id as product1_5_0_, tproduct0_.product_name as product2_5_0_, tproduct0_.product_miaoshu as product3_5_0_, tproduct0_.product_pic as product4_5_0_, tproduct0_.product_yanse as product5_5_0_, tproduct0_.product_shichangjia as product6_5_0_, tproduct0_.product_tejia as product7_5_0_, tproduct0_.product_isnottejia as product8_5_0_, tproduct0_.product_isnottuijian as product9_5_0_, tproduct0_.product_catelog_id as product10_5_0_, tproduct0_.product_kucun as product11_5_0_, tproduct0_.product_Del as product12_5_0_, tproduct0_.product_shrq as product13_5_0_, tproduct0_.product_haoping as product14_5_0_, tproduct0_.product_zhongping as product15_5_0_, tproduct0_.product_chaping as product16_5_0_ from t_product tproduct0_ where tproduct0_.product_id=?
Hibernate: select tcatelog0_.catelog_id as catelog1_4_, tcatelog0_.catelog_name as catelog2_4_, tcatelog0_.catelog_miaoshu as catelog3_4_, tcatelog0_.catelog_del as catelog4_4_ from t_catelog tcatelog0_ where tcatelog0_.catelog_del='no'
Hibernate: select tcatelog0_.catelog_id as catelog1_4_, tcatelog0_.catelog_name as catelog2_4_, tcatelog0_.catelog_miaoshu as catelog3_4_, tcatelog0_.catelog_del as catelog4_4_ from t_catelog tcatelog0_ where tcatelog0_.catelog_del='no'
Hibernate: select tgonggao0_.gonggao_id as gonggao1_2_, tgonggao0_.gonggao_title as gonggao2_2_, tgonggao0_.gonggao_content as gonggao3_2_, tgonggao0_.gonggao_data as gonggao4_2_, tgonggao0_.gonggao_fabuzhe as gonggao5_2_, tgonggao0_.gonggao_del as gonggao6_2_, tgonggao0_.gonggao_one1 as gonggao7_2_, tgonggao0_.gonggao_one2 as gonggao8_2_, tgonggao0_.gonggao_one3 as gonggao9_2_, tgonggao0_.gonggao_one4 as gonggao10_2_, tgonggao0_.gonggao_one5 as gonggao11_2_, tgonggao0_.gonggao_one6 as gonggao12_2_, tgonggao0_.gonggao_one7 as gonggao13_2_, tgonggao0_.gonggao_one8 as gonggao14_2_ from t_gonggao tgonggao0_ order by tgonggao0_.gonggao_id desc

ningge09
ningge09   2016.04.04 14:25

这是运行时出来的信息,求各位大神帮帮忙

ningge09
ningge09   2016.04.04 16:45

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%
String path = request.getContextPath();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">








<br> function closeOpen()<br> {<br> window.returnValue=false;<br> window.close();<br> }<br> function check1()<br> {<br> if(document.form1.userName.value==&quot;&quot;)<br> {<br> alert(&quot;请输入用户名&quot;);<br> return false;<br> }<br> if(document.form1.userPw.value==&quot;&quot;)<br> {<br> alert(&quot;请输入密码&quot;);<br> return false;<br> }<br> if(document.form1.userPw.value!=document.form1.userPw1.value)<br> {<br> alert(&quot;两次密码不一致&quot;);<br> return false;<br> }<br> document.form1.submit();<br> }<br>





用户名:


 





密 码:


 





真实姓名:


 





住址(收货地址):


 





性别:


<% String userSex =userSex.getUserSex(); %>
 
checked="checked"<% } %>/>男
    





联系方式:


 





E-mail:


 





QQ:


 





 


 








ningge09
ningge09   2016.04.04 16:46

package com.action;

import java.util.List;
import java.util.Map;

import org.apache.struts2.ServletActionContext;

import com.dao.TUserDAO;
import com.model.TUser;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.util.Cart;

public class UserAction extends ActionSupport
{
private int userId;
private String userName;
private String userPw;
private String userRealname;
private String userAddress;
private String userSex;
private String userTel;
private String userEmail;
private String userQq;

private String newUserPw;




private String message;
private String path;

private TUserDAO userDAO;



public String userReg()
{
    TUser user=new TUser();
    user.setUserName(userName);
    user.setUserPw(userPw);
    user.setUserAddress(userAddress);
    user.setUserTel(userTel);
    user.setUserRealname(userRealname);
    user.setUserEmail(userEmail);
    user.setUserSex(userSex);
    user.setUserQq(userQq);
    user.setUserDel("no");
    userDAO.save(user);
    Map session= ServletActionContext.getContext().getSession();
    session.put("user", user);
    return "successAdd";
}
public String userEdit()
{
    TUser user=userDAO.findById(userId);
    user.setUserName(userName);
    user.setUserPw(userPw);
    user.setUserAddress(userAddress);
    user.setUserTel(userTel);
    user.setUserRealname(userRealname);
    user.setUserEmail(userEmail);
    user.setUserSex(userSex);
    user.setUserQq(userQq);
    user.setUserDel("no");
    userDAO.attachDirty(user);
    Map session= ServletActionContext.getContext().getSession();
    session.put("user", user);
    return "successAdd";
}


public String userLogin()
{
    String sql="from TUser where userName=? and userPw=? and userDel='no'";
    Object[] con={userName,userPw};
    List userList=userDAO.getHibernateTemplate().find(sql,con);
    if(userList.size()==0)
    {
        this.setMessage("用户名或密码错误");
        this.setPath("qiantai/default.jsp");
    }
    else
    {
         Map session= ServletActionContext.getContext().getSession();
         TUser user=(TUser)userList.get(0);
         session.put("user", user);

         Cart cart=new Cart();
         session.put("cart", cart);

         this.setMessage("成功登录");
         this.setPath("qiantai/default.jsp");
    }
    return "succeed";
}


public String userLogout()
{
    Map session= ServletActionContext.getContext().getSession();
    session.remove("user");
    return ActionSupport.SUCCESS;
}






public String userDel()
{
    TUser user=userDAO.findById(userId);
    user.setUserDel("yes");
    userDAO.attachDirty(user);
    this.setMessage("删除成功");
    this.setPath("userMana.action");
    return "succeed";
}


public String userXinxi()
{
    TUser user=userDAO.findById(userId);
    Map request=(Map)ServletActionContext.getContext().get("request");
    request.put("user", user);
    return ActionSupport.SUCCESS;
}


public String userMana()
{
    List userList=userDAO.findAll();
    Map request=(Map)ServletActionContext.getContext().get("request");
    request.put("userList", userList);
    return ActionSupport.SUCCESS;
}



public String getUserAddress()
{
    return userAddress;
}

public void setUserAddress(String userAddress)
{
    this.userAddress = userAddress;
}

public String getUserEmail()
{
    return userEmail;
}

public void setUserEmail(String userEmail)
{
    this.userEmail = userEmail;
}

public String getUserQq()
{
    return userQq;
}

public void setUserQq(String userQq)
{
    this.userQq = userQq;
}

public String getUserRealname()
{
    return userRealname;
}

public void setUserRealname(String userRealname)
{
    this.userRealname = userRealname;
}

public String getUserSex()
{
    return userSex;
}

public void setUserSex(String userSex)
{
    this.userSex = userSex;
}

public String getUserTel()
{
    return userTel;
}

public void setUserTel(String userTel)
{
    this.userTel = userTel;
}

public int getUserId()
{
    return userId;
}


public void setUserId(int userId)
{
    this.userId = userId;
}


public String getUserName()
{
    return userName;
}

public void setUserName(String userName)
{
    this.userName = userName;
}

public TUserDAO getUserDAO()
{
    return userDAO;
}


public String getMessage()
{
    return message;
}


public String getNewUserPw()
{
    return newUserPw;
}

public void setNewUserPw(String newUserPw)
{
    this.newUserPw = newUserPw;
}

public void setMessage(String message)
{
    this.message = message;
}


public String getPath()
{
    return path;
}


public void setPath(String path)
{
    this.path = path;
}


public void setUserDAO(TUserDAO userDAO)
{
    this.userDAO = userDAO;
}


public String getUserPw()
{
    return userPw;
}

public void setUserPw(String userPw)
{
    this.userPw = userPw;
}

}

ningge09
ningge09   2016.04.04 16:49

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%
String path = request.getContextPath();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">








<br> function closeOpen()<br> {<br> window.returnValue=false;<br> window.close();<br> }<br> function check1()<br> {<br> if(document.form1.userName.value==&quot;&quot;)<br> {<br> alert(&quot;请输入用户名&quot;);<br> return false;<br> }<br> if(document.form1.userPw.value==&quot;&quot;)<br> {<br> alert(&quot;请输入密码&quot;);<br> return false;<br> }<br> if(document.form1.userPw.value!=document.form1.userPw1.value)<br> {<br> alert(&quot;两次密码不一致&quot;);<br> return false;<br> }<br> document.form1.submit();<br> }<br>





用户名:


 





密 码:


 





真实姓名:


 





住址(收货地址):


 





性别:


<% String userSex =userSex.getUserSex(); %>
 
checked="checked"<% } %>/>男
    





联系方式:


 





E-mail:


 





QQ:


 





 


 








ningge09
ningge09   2016.04.04 16:56

![![图片说明](http://img.ask.csdn.net/upload/201604/04/1459760207_498151.png)图片说明](http://img.ask.csdn.net/upload/201604/04/1459760199_302435.png)图片说明

zhaihonghonghzh
zhaihonghonghzh   2016.04.06 17:21

user在页面上没有定义 这个是要在后头传过来数据 然后比较是吗?

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!