【发布时间】:2015-02-10 18:02:06
【问题描述】:
我有一个signup.jsp 页面,新用户可以在其中输入他的电子邮件 ID。这个页面的一个sn-p如图:
<s:form action="signupprocess">
<s:textfield label="E-Mail" key="userid"></s:textfield>
<s:password label="Password" key="password" cssStyle="margin-top:5px;"></s:password>
<s:password label="Retype Passowrd" key="repass" cssStyle="margin-top:5px;"></s:password>
<s:submit cssStyle="margin-top:5px;" />
</s:form>
现在,在完成所有后端流程后,即将用户的电子邮件和密码添加到数据库中,用户将被定向到“user.jsp”,他必须在其中填写个人详细信息。这个页面如图:
<s:form action="user_details">
<s:textfield label="First Name" key="firstname"></s:textfield>
<s:textfield label="Last Name" key="lastname" cssStyle="margin-top:5px;"></s:textfield>
<s:label label="Adress" cssStyle="margin-top:5px;"></s:label>
<s:textfield label="Line1" key="addr_1" cssStyle="margin-top:5px;"></s:textfield>
<s:textfield label="Line2" key="addr_2" cssStyle="margin-top:5px;"></s:textfield>
<s:textfield label="Line3" key="addr_3" cssStyle="margin-top:5px;"></s:textfield>
<s:textfield label="City" key="city" cssStyle="margin-top:5px;"></s:textfield>
<s:textfield label="State" key="state" cssStyle="margin-top:5px;"></s:textfield>
<s:textfield label="Mobile" key="mobile" cssStyle="margin-top:5px;"></s:textfield>
<s:checkboxlist list="areas" name="userareas" label="Areas of Interest" cssStyle="margin-top:5px;"></s:checkboxlist>
<s:submit cssStyle="margin-top:10px;" />
</s:form>
现在,在这个 jsp 的操作类中,我希望能够访问特定用户的电子邮件 ID,以便在数据库中仅在该用户的行中创建条目。如何从 user.jsp 的操作类中的 signup.jsp 页面访问用户 ID 的值。
如果需要,我可以提供任何进一步的信息。
【问题讨论】:
-
您可以通过许多不同的方式,您有什么具体问题?
-
@RomanC 我的具体问题是这样的: PreparedStatement ps = conn.prepareStatement("update user set first_name=?,last_name=?,address=?,mobile=? where email=? ");所以我想要最后一个'?来自 signup.jsp
-
@RomanC 从评论中是否清楚,或者我应该对我的问题进行编辑?
-
您可以将 session 中的值存储在 signup.jsp 的动作类中,并在 user.jsp 的动作类中检索
-
@Arkantos 只有当用户登录时才会在我的应用程序中创建会话,而不仅仅是在他注册时。那么还有其他解决方案吗?