Pass values from jsp pages to pages and from jsp pages

Source: Internet
Author: User

Pass values from jsp pages to pages and from jsp pages

It has not been used for a long time to pass such a value. It is generally. do requests are redirected to the frontend in the background. For example, some of them are only data display functions, so it is unnecessary to do so. If you do not need to talk about it, record it for your next reference.

The a tag of html is used. I only use these two methods here.

Scenarios include:

1: Click to withdraw

The first method is to set the parameter in tag a, which is a json object and a key-value pair.

<A href = "#" class = "a_a" onclick = "judge (this); return false ;"
Params = "({
AgreeNo: '<c: out value = "$ {protocol. agreeNo}"/> ',
AcctNo: '<c: out value = "$ {protocol. acctNo}"/> ',
CardNo: '<c: out value = "$ {protocol. cardNo}"/> ',
DspNo: '<c: out value = "$ {protocol. dspNo}"/> ',
DrCrAcctno: '<c: out value = "$ {protocol. drCrAcctno}"/> ',
DrCrCardNo: '<c: out value = "$ {protocol. drCrCardNo}"/> ',
BussType: '<c: out value = "$ {protocol. bussType}"/> ',
CurrencyType: '<c: out value = "$ {protocol. currencyType}"/> ',
MaturityDate: '<c: out value = "$ {protocol. maturityDate}"/> ',
AgreeAmt: '<fmt: formatNumber pattern = "0.00" value = "$ {protocol. amt}"/> ',
LimitDays: '<c: out value = "$ {protocol. limitDays}"/> ',
DepositRate: '<fmt: formatNumber pattern = "0.00" value = "$ {protocol. depositRate}"/> ',
LendingRate: '<fmt: formatNumber pattern = "0.00" value = "$ {protocol. lendingRate}"/> ',
DiscountLendingRate: '<fmt: formatNumber pattern = "0.00" value = "$ {protocol. discountLendingRate}"/> ',
OpenDate: '<c: out value = "$ {protocol. openDate}"/> ',
MonthTerm: '<c: out value = "$ {protocol. monthTerm}"/> ',
MonthTermDesc: '<c: out value = "$ {protocol. monthTermDesc}"/>'
}) "> Withdrawal </a>

Method 1:

Function judge (obj ){
Params = eval (obj. params );

Var today = '<c: out value = "$ {queryDTO. today}"/> ';
Var openDate = params ['opendate'];

If (today> = openDate ){
Withdraw (obj );
Return false;
} Else {
Var hrefz = "<c: url value = '/work/transfer/flexible_fixed_withdraw_tip.jsp'/>? OpenDate = "+ openDate;
$. Pa_ui.dialog.open ({
Url: hrefz,
Position: [50, 20],
Title: 'receiving hs ',
FrameOverlay: true,
Width: 600,
Height: 250,
Modal: true,
Minimize: false,
Maximize: false
});
Return false;
}
}


2: click Details

This method directly calls the method in the event to pass the value, which is also the json value.

<A href = "#" class = "a_a" onclick = "detailQry ({
AcctNo: '<c: out value = "$ {protocol. cardNo}"/> ',
DspNo: '<c: out value = "$ {protocol. dspNo}"/> ',
Amt: '<fmt: formatNumber pattern = "0.00" value = "$ {protocol. amt}"/> ',
MonthTerm: '<c: out value = "$ {protocol. monthTermDesc}"/> ',
EffDate: '<c: out value = "$ {protocol. effDate}"/> ',
MaturityDate: '<c: out value = "$ {protocol. maturityDate}"/> ',
OpenDate: '<c: out value = "$ {protocol. openDate}"/>'
}); Return false ;"
> Details </a>

 

Method 2:

Function detailQry (obj ){
Var hrefz = "<c: url value = '/work/transfer/flexible_fixed_protocol_detail.jsp'/>? "+ $. Param (obj );
$. Pa_ui.dialog.open ({
Url: hrefz,
Position: [50, 20],
Title: 'flexible deposit protocol details ',
FrameOverlay: true,
Width: 650,
Height: 500,
Modal: true,
Minimize: false,
Maximize: false
});
Return false;
}

 

On the other jsp page, the fields corresponding to the point of the param object with the el label are displayed.

<C: out value = "$ {param. xxx}"/>

 


The issue of passing values between JSP pages

<Html>
<Head>
<Script type = "text/javascript">
Function dojump (id, result ){
Var temp = document. getElementById ('remarktext'). value;
Window. location = "123.jsp? Id = "+ id +" & Result = "+ result +" & RemarkText = "+ temp;
}
</Script>
</Head>
<Body>
<% Int id = 456; %>
<Form action = "" method = "post">
<Table> <tr> <td> Note: </td>
<Td> <textarea cols = "30" rows = "3" name = "RemarkText" id = "RemarkText"> </textarea> </td>
</Tr>
<Tr> <td colspan = "2" align = "center">
<Input type = "button" value = "via" onClick = "dojump (<% = id %>, 1)">
<Input type = "button" value = "reject" onClick = "dojump (<% = id %>, 0)">
<Input type = "button" value = "return" onClick = "javascript: history. back ();">
</Td> </tr> </table> </form>
</Body>
</Html>

Page value passing in JSP

This is about the submission method...
Form. jsp
<Form name = "form1" method = "post" action = "login. jsp">
<Tr>
<Td>
<Input type = "text" name = "txtuesr">
</Td>
</Tr>
<Tr>
<Td>
<Input type = "submit" name = "Submit" value = "submit">
<Input type = "reset" name = "Submit" value = "reset">
</Td>
<Tr>
<Form>
Login. jsp
<%
String uesr = request. getParameter ("txtuesr ");
%>
<% = Uesr %>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.