Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
237 views
in Technique[技术] by (71.8m points)

javascript - How to convert js textarea to java String?

I want to send data from frontend (ReactJS) to backend (Spring BOOT). I want to receive "row1 row3 row5".

How can i add after each newline, in a word, how to convert from textarea to String?

For form, i use Formik

<fieldset className="form-group">
    <label>Message</label>
    <Field className="textarea" component="textarea" type="textarea" name="message" />
</fieldset>

My request form axios

sendMail(from,subject,text){
    console.log(from);
    console.log(subject);
    console.log(text)
    return axios.put(`http://localhost:8080/contact/sendMail/${from}/${subject}/${text}`)
}

Google Chrome console

Java variables values

Thanks!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...