how to achieve it ? If you can give the code , very grateful ! !
on the map below .
------ Solution ------- -------------------------------------
First, you need to change first screenshot place , form the action specified you say jsp, and then all of the input tag inside to add the name attribute , this is a key acquisition parameters ,
then used inside jsp
<%
String param = request.getParameter ("paramName") ;/ / paramName is your label inside the input 's name
%>
receive parameters . . .
------ For reference only -------------------------------------- -
actually want to achieve the effect of which is this:
A , enter the data in the page , click Submit , you jump to the page of B .
then B page it accepted the A page of data .
how to achieve Jump ? How to achieve data transfer ?
------ For reference only -------------------------------------- -
use form form , together with all of the data package submitted to the process after the jump page request.getParameter ("name") so that the child receives . .
------ For reference only -------------------------------------- -
amount of how to extract data ? how package ah ?
------ For reference only -------------------------------------- -
your first screenshot of the action inside the form is submitted by how static html ah ? ? ? ? Static pages receive parameters more trouble ah. .
------ For reference only -------------------------------------- -
amount , then how to submit dynamic ah ? Form does is to use the action to jump and submit it ?
------ For reference only -------------------------------------- -
Yes, yes, but get the data through these dynamic pages asp jsp or to operate , what is your project environment . .
------ For reference only ---------------------------------- -----
can use JSP. With eclipse and tomcat.
------ For reference only -------------------------------------- -
oh , the value of each input are using this method to get it ?
Then on another page taken out ?
I have been using document.getElementById.value to obtain input in value, but also did not know how to pass ......
------ For reference only ---------- -----------------------------
A page
<input type="text" name="user.name" value="">
<input type="text" name="user.address" value="">
User entity class
private String name;
private String address;
public User(){
}
public User(String name,String address){
this.name=name;
this.address=address;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name= name;
}
public String getAddress() {
return this.address;
}
public void setAddress(String name) {
this.address= address;
}
Action class
public class UserActon extends ActionSupport implements ModelDriven<User> {
private User user;
public User getUser () {
return user;
}
public void setUser (User user) {
this.user = user;
}
public String getUsersssssss(){
// 此时的User已经得到
return SUCCESS;
}
A page of the form = "getUsersssss.action"
sturts.xml
configured as
<action name="getUserssssss" class="UserAction" method="getUserssssss">
<result name="success">/B页面.jsp</result>
<result name="error">error.jsp</result>
</action>
}
B page text box
code above pure hand- detailed enough to beat !
------ For reference only ---------------------------------- -----
complemented , UserAction
public User getModel () {
/ / TODO Auto-generated method stub
return user;
}
correct the A page should action = "getUsersssss.action"
------ For reference only ----------------- ----------------------
I would.
------ For reference only ----- ----------------------------------
This method can also be
can reach the goal , come ! ! !
------ For reference only -------------------------------------- -
Now I just do not understand the data inside the JSP , javascript can be used inside ?
As just extracted parameter name, the B pages, can not be used as the parameters of this function to use ?
If you can use how to use ?
turn it , javascript where the parameters can be used in a JSP, you ?
------ For reference only ---------------------------------- -----
no answer yet ?
------ For reference only -------------------------------------- -
you can crawl through js , you can put your name on the value of a hidden input , by id to capture
------ For reference only ------ ---------------------------------
specifically how to do it ?
give you a piece of code ? Thank you
------ For reference only ------------------------------------ ---
directly
------ For reference only ------------ ---------------------------
Now I just do not understand the data inside the JSP , javascript can be used inside ?
As just extracted parameter name, the B pages, can not be used as the parameters of this function to use ?
If you can use how to use ?
turn it , javascript where the parameters can be used in a JSP, you ?
First correct it , which is not of type String , with the var alternative , you can use this page B receives the data , but not as good as what your method .
没有评论:
发表评论